<> hit jar package

springboot Project packaging by environment
hit jar package

If it is a multi module project , For example, I have the following directory structure

among api The project configuration is as follows

1 First configure in the top-level project pom Add the following configuration to the file
<!-- Define the corresponding profileActive Variable value --> <profiles> <profile> <id>dev</id>
<properties> <profileActive>dev</profileActive> </properties> <activation>
<!-- Specify default activation --> <activeByDefault>true</activeByDefault> </activation> </profile>
<profile> <id>prd</id> <properties> <profileActive>prd</profileActive>
</properties> </profile> </profiles>
2 And then api engineering pom Add the following configuration to the file
<!--maven pack --> <build> <finalName>ftyj</finalName> <resources> <resource>
<directory>src/main/resources</directory> <filtering>true</filtering>
<excludes> <exclude>application-prd.properties</exclude>
<exclude>application.properties</exclude> </excludes> </resource>
<!-- Resources that need to be added dynamically --> <resource> <directory>src/main/resources</directory>
<filtering>true</filtering> <includes> <!-- Read the environment specified in the packaging command -->
<include>application.properties</include> </includes> </resource> </resources>
3 stay application.properties Add the following reference variable configuration to

4 Then start using maven Command packaging , If is idea Environmental Science , Right click item selection open in terminal

Open console

Enter the following packaging command , Clean up compilation package prd development environment , It just means application-prd.properties and application.properties Drive in jar package

mvn clean compile package -Dmaven.test.skip=true -Pprd
6 View compilation results

Open with decompression software jar package

Replace packing dev Environmental Science
mvn clean compile package -Dmaven.test.skip=true -Pdev

You can see that the bag has been changed to dev And general profile

7 If it is a single project instance, the top-level project will be directly pom Configuration and api The environmental configuration summary of the engineering team can be transferred to a single project

©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library )Unity3D of UGUI Basics -- Three modes of canvas os Simple use of module computer network --- Basic concepts of computer network ( agreement , system )html Writing about cherry trees , Writing about cherry trees Some East 14 Pay change 16 salary , Sincerity or routine ?Unity-Demo Examples ✨ realization UI- Backpack equipment drag function 06【 Interpretation according to the frame 】 Data range filtering -- awesome java Four functional interfaces ( a key , simple )