1、关于archetype:https://blog.youkuaiyun.com/cx1110162/article/details/78297654
2、环境配置文件:
- 创建配置文件对于不同环境的文件后放入一个文件夹中(如例子中的/ProfilesConfig/development.properties)
- 然后在root的配置文件中添加<profiles>标签用于配置开发/测试/生产环境变量(如:mysql数据库、redis数据库等需要区分环境的配置参数)
<!--配置参数-->
<profiles>
<profile>
<id>development</id>
<properties>
<env>development</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<filters>
<filter>../ProfilesConfig/development.properties</filter>
</filters>
</build>
</profile>
<profile>
<id>test</id>
<properties>
<env>test</env>
</properties>
<build>
<filters>
<filter>../ProfilesConfig/test.properties</filter>
</filters>
</build>
</profile>
<profile>
<id>product</id>
<properties>
<env>product</env>
</properties>
<build>
<filters>
<filter>../ProfilesConfig/product.properties</filter>
</filters>
</build>
</profile>
</profiles>
3、添加lombok插件:https://blog.youkuaiyun.com/a2267378/article/details/81180373
4、在一个maven项目中需要在一个子类包里引入另一个子类包,则只需将被引入的包的artifactID加入到需要引入的包的pom文件依赖中即可,如,需要在包cts-web中引入cts-common的包,则在cts-web的pom文件中添加依赖
<dependency>
<groupId>com.practice</groupId>
<artifactId>cts-common</artifactId>
</dependency>
本文详细介绍了如何使用Maven进行环境配置,包括不同环境的配置文件设置,以及如何通过配置<profiles>标签来区分开发、测试和生产环境。此外,还讲解了如何在Maven项目中引入子类包的依赖。
1万+

被折叠的 条评论
为什么被折叠?



