Java – spring boot control target jar file name
•
Java
My spring boot project has a build Description:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit47</artifactId> <version>2.18.1</version> </dependency> </dependencies> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring-boot.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <mainClass>com.app.MainClass</mainClass> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
I want my jar file name to be app - 1.0 - snapshot. In a branch Jar, in the other branch is 1.0 - release Jar, controlled by Jenkins (using some MVN setting or JVM parameter, such as - d...)
Can I do this?
Solution
So simple, in a branch, you have POM xml
<build> <finalName>app-1.0-SNAPSHOT</finalName> </build>
In other branches, you have POM xml
<build> <finalName>1.0-RELEASE</finalName> </build>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码