springboot多模块项目打包
今天在项目开发中,项目经理说实现以下APP和web端单独打包功能实现。因为app和web端是单独的modules,这样的话,app的代码修改,不影响web端的代码。而且可以单独部署,方便维护升级版本升级。
项目结构
比如我们的项目就这样,怎么样才可以hr单独打包,user
只需要添加下面的即可,不单独部署的项目不要添加下面的依赖
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 跳过单元测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
main方法:
@EnableAsync
@EnableTransactionManagement
@ConfigurationPropertiesScan
@EnableConfigurationProperties
@SpringBootApplication
@MapperScan(basePackages = {""})
public class WebRun {
public static void main(String[] args) {
SpringApplication.run(WebRun.class, args);
}
@Bean
public SpringContextHolder springContextHolder() {
return new SpringContextHolder();
}
}
欢迎关注