我的
Spring Boot项目有构建描述:
<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>
我希望我的JAR文件名在一个分支中是app-1.0-SNAPSHOT.jar,在另一个分支中是1.0-RELEASE.jar,由Jenkins控制(使用某种mvn设置或JVM参数,如-D ..
我可以这样做吗?
解决方法
这么简单,在一个分支中,你有pom.xml
<build> <finalName>app-1.0-SNAPSHOT</finalName> </build>
在其他分支中,您有pom.xml
<build> <finalName>1.0-RELEASE</finalName> </build>