



1. 分成单独的模块进行开发 |
|---|
![]() |
1. 创建一个新的包并将dao包中内容复制到新的包中 |
|---|
![]() |
1. 在原始项目包中引用新项目包坐标 |
|---|
![]() |
2. 引入后发现新项目中方法都在报错!!!(引入依赖) |
|---|
![]() |
1. 创建新的项目包将原始domain中的程序复制到新项目包中(删除原始项目包中的domain文件夹) |
|---|
![]() |
2. 在dao项目包中引入daomin包坐标 |
|---|
![]() |
3. 在domain包中导入lombok依赖 |
|---|
![]() |
1. 将项目包install到仓库(否则会找不到而报错) |
|---|
![]() |
2. 测试 |
|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
1. 创建一个Maven工程 |
|---|
![]() |
![]() ![]() |

1. 创建Maven模块,设置打包类型为pom |
|---|
![]() |
2. 在父工程中配置子工程需要用的依赖 |
|---|
![]() |
<dependencies>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
<version>5.3.18version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-jdbcartifactId>
<version>5.3.18version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-testartifactId>
<version>5.3.18version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatisartifactId>
<version>3.4.6version>
dependency>
<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<version>4.13version>
<scope>testscope>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>servlet-apiartifactId>
<version>2.5version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
<version>2.13.3version>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>8.0.28version>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druidartifactId>
<version>1.2.8version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatis-springartifactId>
<version>2.0.6version>
dependency>
dependencies>
3. 配置子工程中可选的依赖关系 |
|---|
![]() ![]() |
4. 在子工程中配置当前工程所继承的工程 |
|---|
![]() ![]() |
5. 在子工程中配置使用父工程中可选依赖坐标 |
|---|
![]() |

![]() |
1. 定义属性及使用 |
|---|
![]() |
1. 定义属性 |
|---|
![]() |
2. 引入属性 |
|---|
![]() |
3.开启资源文件目录加载属性的过滤器 |
|---|
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
![]() |
4. 配置maven打war包时,忽略web.xml检查 |
|---|
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
![]() |
5.测试 |
|---|
![]() |

![]() |

1. 定义的多环境 |
|---|
![]() |
![]() |
2. 测试 |
|---|
![]() ![]() ![]() |
1. 方法一(缺点:全部测试都会跳过) |
|---|
![]() |
2. 方法二(插件配置) |
|---|
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<!-- 是否跳过测试 false -->
<skipTests>false</skipTests>
<!-- 排除掉不参与测试的内容-->
<excludes>
<exclude>**/BookServiceTest.java</exclude>
</excludes>
</configuration>
</plugin>
![]() ![]() |
3. 方法三(使用命令跳过测试) |
|---|
![]() |

Nexus
网盘下载
1. 下载 |
|---|
![]() |
2. 绿色版的(直接解压即可) |
|---|
![]() |
3. 直接启动服务器(缺点:关闭cmd窗口后私服服务自动关闭) |
|---|
使用管理员运行cmdnexus-2.14.11-01\bin目录中执行以下命令3.1 启动指令:nexus.exe /run nexus |
|---|
![]() ![]() |
3.2 如果因为其他版本而启动失败(先卸载其他版本) |
|---|
![]() |
3.3 将服务安装到本地(推荐使用:cmd命令窗口关闭后私服不会自动停止) |
|---|
nexus.exe /install <optional-service-name> //安装服务
(optional-service-name是服务别名,默认是nexus)
nexus.exe /uninstall //卸载服务
nexus.exe /start <optional-service-name> //启动服务
nexus.exe /stop <optional-service-name> //停止服务
扩展:
可以安装多个服务名不同的服务,分别启动
nexus.exe /install nexus01 //安装服务
nexus.exe /start nexus01 //启动服务
nexus.exe /install nexus02 //安装服务
nexus.exe /start nexus02 //启动服务
安装指令 |
|---|
![]() |
4. 访问私服:[http://localhost:8081/](http://localhost:8081/) |
|---|
![]() |
5. 根据向导完成 密码修改 及 匿名访问 |
|---|
![]() ![]() ![]() ![]() |
可根据需求进行更改(此处我并没有做修改) |
|---|
![]() |


1. 新建一个 Snapshot 类型的 存快照的仓库 |
|---|
![]() |
|
2. 新建一个 Release 类型的 存发行版的仓库 |
|---|
![]() |
新建的两个仓库都是同样的操作 |
|---|
![]() |
添加阿里中央仓库 |
|---|
![]() ![]() |


配置本地仓库 (Maven) 访问私服的权限 |
|---|
![]() |
<server>
<id>coke-Releaseid>
<username>adminusername>
<password>admin123password>
server>
<server>
<id>coke-Snapshotid>
<username>adminusername>
<password>admin123password>
server>
<server>
<id>aliyunid>
<username>adminusername>
<password>admin123password>
server>
<mirror>
<id>maven-publicid>
<mirrorOf>*mirrorOf>
<url>http://localhost:8081/repository/maven-public/url>
mirror>
配置私服的访问地址URL为仓库组的 |
|---|
![]() ![]() ![]() |
<distributionManagement>
<repository>
<id>coke-Releaseid>
<url>http://localhost:8081/repository/coke-Release/url>
repository>
<snapshotRepository>
<id>coke-Snapshotid>
<url>http://localhost:8081/repository/coke-Snapshot/url>
snapshotRepository>
distributionManagement>
配置当前工程保存在私服中的具体位置 |
|---|
![]() |
2. 查看私服中的文件 |
|---|
![]() |
3. 上传发布 |
|---|
![]() ![]() |

4. 下载测试 |
|---|
![]() ![]() ![]() |