I am trying to create multiple Maven profiles in a single Jenkins task. Each profile changes some code and then creates a jar by executing mvn -Pdev install and then mvn -Pprod install on the command line (according to Maven using mvn -Pdev,prod install should work, but it does not work for me) . Here are two profiles in my pom.xml project:
<profiles> <profile> <id>prod</id> <build> <plugins> <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <version>1.5.2</version> <executions> <execution> <phase>process-resources</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <file>src/main/java/com/IQzone/android/configuration/AbstractHoldingRefreshable.java</file> <replacements> <replacement> <token>TrUe</token> <value>TOAST_SWITCH</value> </replacement> </replacements> </configuration> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <classifier>prod</classifier> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>dev</id> <build> <plugins> <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <version>1.5.2</version> <executions> <execution> <phase>process-resources</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <file>src/main/java/com/IQzone/android/configuration/AbstractHoldingRefreshable.java</file> <replacements> <replacement> <token>TOAST_SWITCH</token> <value>TrUe</value> </replacement> </replacements> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <classifier>dev</classifier> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>
How do I configure Jenkins to automatically create both of these profiles for the same Jenkins job whenever a job strikes to build? And put both of these jars in Artifactory? I have very little Jenkins knowledge, and there is little information on the Internet about this.
maven build jenkins artifactory
user2639215
source share