觉哥java网站搭建笔记——后端开发环境搭建

一.后端环境搭建(jdk17+springboot3.0)

1.1maven 配置文件修改

设置编译jdk的版本:

<profiles>
    <profile>
     <id>jdk-17</id>
     <activation>
      <activeByDefault>true</activeByDefault>
      <jdk>17</jdk>
     </activation>
     <properties>
      <maven.compiler.source>17</maven.compiler.source>
      <maven.compiler.target>17</maven.compiler.target>
      <maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
     </properties>
     </profile>
</profiles>

设置镜像仓库地址:

<mirror>
			<id>
				alimaven
			</id>
			<mirrorOf>
				central
			</mirrorOf>
			<name>
				aliyun maven
			</name>
			<url>
				https://maven.aliyun.com/repository/central
			</url>
</mirror>

1.2创建父工程及子模块+依赖版本设置

jdk版本选择选择本地的jdk17 然后后面的java选项选17 如果17没出来要再点下 (idea bug或者是网的问题)

 

目前初步创建 父工程 名:juegejava

子模块名 :jjorder  jjproduct  jjuser

父工程 pom 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0-SNAPSHOT</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.juege.java</groupId>
    <artifactId>juejue-user</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>juegejava</name>
    <description>聚合服务</description>
    <packaging>pom</packaging>

    <modules>
        <module>jjuser</module>
        <module>jjproduct</module>
        <module>jjorder</module>
    </modules>
</project>

子模块pom,不断更新中,springboot 3.0正式发布版还没出来 现在用的snapshot版本,springcloud

中的组件都是用的最新版本 (注释了某些组件的依赖 后面用到时再引入)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.0.0-SNAPSHOT</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.juege.java</groupId>
	<artifactId>juejue-order</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>jjorder</name>
	<description>juegejava</description>
	<properties>
		<java.version>17</java.version>
		<spring-cloud.version>2022.0.0-RC1</spring-cloud.version>
		<cloud-component.version>3.1.4</cloud-component.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-amqp</artifactId>
		</dependency>
<!--		<dependency>-->
<!--			<groupId>org.springframework.boot</groupId>-->
<!--			<artifactId>spring-boot-starter-data-elasticsearch</artifactId>-->
<!--		</dependency>-->
<!--		<dependency>-->
<!--			<groupId>org.springframework.boot</groupId>-->
<!--			<artifactId>spring-boot-starter-data-jpa</artifactId>-->
<!--		</dependency>-->
<!--		<dependency>-->
<!--			<groupId>org.springframework.boot</groupId>-->
<!--			<artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!--		</dependency>-->
<!--		<dependency>-->
<!--			<groupId>org.springframework.boot</groupId>-->
<!--			<artifactId>spring-boot-starter-data-redis</artifactId>-->
<!--		</dependency>-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-quartz</artifactId>
		</dependency>
		<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.kafka</groupId>
			<artifactId>kafka-streams</artifactId>
		</dependency>
<!--		<dependency>-->
<!--			<groupId>org.springframework.cloud</groupId>-->
<!--			<artifactId>spring-cloud-starter-gateway</artifactId>-->
<!--			<version>${cloud-component.version}</version>-->
<!--		</dependency>-->
<!--		<dependency>-->
<!--			<groupId>org.springframework.cloud</groupId>-->
<!--			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
<!--			<version>${cloud-component.version}</version>-->
<!--		</dependency>-->
<!--		<dependency>-->
<!--			<groupId>org.springframework.cloud</groupId>-->
<!--			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>-->
<!--			<version>${cloud-component.version}</version>-->
<!--		</dependency>-->
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-openfeign</artifactId>
			<version>${cloud-component.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.kafka</groupId>
			<artifactId>spring-kafka</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
<!--		<dependency>-->
<!--			<groupId>org.springframework.amqp</groupId>-->
<!--			<artifactId>spring-rabbit-test</artifactId>-->
<!--			<scope>test</scope>-->
<!--		</dependency>-->
		<dependency>
			<groupId>org.springframework.kafka</groupId>
			<artifactId>spring-kafka-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<!--    <build>-->
	<!--        <plugins>-->
	<!--            <plugin>-->
	<!--                    <groupId>org.springframework.boot</groupId>-->
	<!--                    <artifactId>spring-boot-maven-plugin</artifactId>-->
	<!--                    <version>2.7.5</version>-->
	<!--                <configuration>-->
	<!--                    <excludes>-->
	<!--                        <exclude>-->
	<!--                            <groupId>org.projectlombok</groupId>-->
	<!--                            <artifactId>lombok</artifactId>-->
	<!--                        </exclude>-->
	<!--                    </excludes>-->
	<!--                </configuration>-->
	<!--            </plugin>-->
	<!--        </plugins>-->
	<!--    </build>-->
	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<releases>
				<enabled>false</enabled>
			</releases>
		</repository>
		<repository>
			<id>netflix-candidates</id>
			<name>Netflix Candidates</name>
			<url>https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
		<pluginRepository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<releases>
				<enabled>false</enabled>
			</releases>
		</pluginRepository>
	</pluginRepositories>

</project>

1.3腾讯云server配置

防火墙  -》端口开放

 密钥,一般默认就有

1.4安装docker 并配置加速

安装 docker

配置加速

1.5 拉取常用软件镜像 及创建并运行容器

安装mysql

安装redis

配置自动重启

docker update mysql --restart=always

docker update redis --restart=always

1.6版本控制gitee配置

版本控制的准备(码云+git+配置SSH免密连接)

1.7建库建表需在server上进入 mysql bash控制台操作

[root@localhost ~]# docker exec -it mysqlaa bash

root@31e36f35d688:/# mysql -uroot -p

输入密码root

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我才是真的封不觉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值