Maven: same artifactID in shared plugin and profile build plugin - java

I have a maven pom.xml which will run some group of ant tasks. Some tasks are only for specific profile and some tasks for common for all profile. This is mine
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- Some of my common task -->
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<build>
<profiles>
<profile>
<id>developement</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- Task specifics for profile -->
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<build>
</profile>
</profiles>
I run the project using the the below command
mvn clean install -P developement
while building this project the common tasks is not running. Tasks in profile only running. Is it happened because of I am using same artifactID in both shared and profile plugin..?
My Env:
Java 1.6
Maven 2.2.1
Windows 7 64 bit

Both of the executions shown are missing <id> elements. Thus, Maven uses its default execution ID, and the profile execution overwrites the common one.
To fix, add IDs to both as shown, with values of your choice.
<!-- common configuration -->
<executions>
<execution>
<id>antrun-common</id>
<phase>test</phase>
....
<!-- development profile configuration -->
<executions>
<execution>
<id>antrun-development</id>
<phase>test</phase>

Related

Using plugin and execution steps based on Profiles

I have a pom as below
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>X.0.0</modelVersion>
<parent>
<groupId>asdasd</groupId>
<artifactId>asdasd</artifactId>
<version>0.334.0-SNAPSHOT</version>
<relativePath>../something/pom.xml</relativePath>
</parent>
<!-- ======================================================================= -->
<!-- P R O J E C T -->
<!-- ======================================================================= -->
<artifactId>dfdfd</artifactId>
<name>xxxxx</name>
<packaging>content-package</packaging>
<properties>
<sonar.sources>${basedir}/src/main/angular/src</sonar.sources>
<sonar.tests>${basedir}/src/main/angular/src</sonar.tests>
</properties>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/content/jcr_root</directory>
<excludes>
<exclude>**/*.iml</exclude>
</excludes>
<targetPath>jcr_root</targetPath>
</resource>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/content/META-INF/xxx/definition</directory>
<targetPath>../xxx/META-INF/vault/definition</targetPath>
</resource>
</resources>
<sourceDirectory>${basedir}/src/main/content/jcr_root</sourceDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
</plugin>
<!-- start frontend -->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.8.0</version>
<inherited>false</inherited>
<configuration>
<nodeVersion>v16.17.0</nodeVersion>
<npmVersion>8.15.0</npmVersion>
<nodeDownloadRoot>xxxxx</nodeDownloadRoot>
<npmDownloadRoot>xxxxx</npmDownloadRoot>
<installDirectory>src/main/angular</installDirectory>
<workingDirectory>src/main/angular</workingDirectory>
</configuration>
<executions>
<execution>
......
</execution>
<execution>
<id>npm rebuild node-sass</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>rebuild node-sass</arguments>
</configuration>
</execution>
<execution>
<id>npm run e2e</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run e2e</arguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- end frontend -->
</plugins>
</build>
</project>
I want to run execution step with id npm run e2e based on profile. What I have in mind is 2 profiles default and e2eTests. With default, I can set activeByDefault as true and skip the e2e test. And when I pass e2eTests using -P , I should be able to run all execution including id=npm run e2e
I tried to move them into <profiles> but then the <sourceDirectory> was complaining. I found some links like this for it, but the problem comes on how to access plugins when I have <profiles> outside of <build>
I am not able to structure it properly.
Normally, it is not required to copy entire <build> configuration into profile definition - it should be enough to just define extra plugin execution, smth. like that:
<profiles>
<profile>
<id>e2eTests</id>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.8.0</version>
<executions>
<execution>
<id>npm run e2e</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run e2e</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
However, I would configure that in different way:
either bind execution of e2e tests to the lifecycle phase designed for that (integration-test) - in this case mvn package won't trigger e2e tests:
...
<execution>
<id>npm run e2e</id>
<phase>integration-test</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run e2e</arguments>
</configuration>
</execution>
...
or take advantage of properties and profiles, for example:
<properties>
...
<skip.e2e>true</skip.e2e>
...
</properties>
<profiles>
<profile>
<id>e2eTests</id>
<properties>
<skip.e2e>false</skip.e2e>
</properties>
</profile>
</profiles>
...
<execution>
<id>npm run e2e</id>
<phase>integration-test</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<skip>${skip.e2e}</skip>
<arguments>run e2e</arguments>
</configuration>
</execution>
...

Specify the order in which Maven plugins' executions run

I'm using the copy-rename-maven-plugin during the package phase to first copy the jar that I just generated to another directory, then using launch4j-maven-plugin I'm generating exes that wrap the jar and then I need to rename one of the exes (to scr), so, I'm using copy-rename-maven-plugin again.
The problem is that all copy-rename-maven-plugin executions are run together, before launch4j-maven-plugin, so, the second execution fails.
How do define the order of executions? I'm happy creating more phases if that's what's necessary, but creating a Maven plugin seemed a bit of an overkill.
A simplified example of what's going with my pom.xml would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>tech.projecx</groupId>
<artifactId>projecx</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution> <!-- Copy the just-built projecx jar to targte/win32/jars -->
<id>copy-jar-for-exe</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.build.directory}/${project.build.finalName}.jar</sourceFile>
<destinationFile>${project.build.directory}/win32/jars/${project.build.finalName}.jar
</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <!-- Make the exes -->
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.21</version>
<executions>
<execution> <!-- Make the screensaver exe -->
<id>wrap-screensaver-as-exe</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<outfile>${project.build.directory}\win32\${screensaverExe}.exe</outfile>
<jar>jars\${project.build.finalName}.jar</jar>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution> <!-- Copy the screensaver from the exe to the proper scr -->
<id>rename-screensaver-to-scr</id>
<phase>package</phase>
<goals>
<goal>rename</goal>
</goals>
<configuration>
<sourceFile>${project.build.directory}/win32/${screensaverExe}.exe</sourceFile>
<destinationFile>${project.build.directory}/win32/${screensaverExe}.scr</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The order in which executions need to run is this:
copy-jar-for-exe
wrap-screensaver-as-exe
rename-screensaver-to-scr
Any other order doesn't work, but because, I think, copy-jar-for-exe and renamer-screensaver-to-scr are executions from the same plugin, Maven runs it like this:
copy-jar-for-exe
rename-screensaver-to-scr
wrap-screensaver-as-exe
so, it fails.
You could run the copy-jar-for-exe in the prepare-package phase. I beleive you could define both executions in the same plugin configuration but declare the plugin after the launch4j plugin.
Basic idea is, the plugins with executions in the same phase are executed in the order of appearance in the pom. If you bind a single execution to another (earlier) phase, it should be executed before.
I haven't tested this, but I think it should work
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.21</version>
<executions>
<execution> <!-- Make the screensaver exe -->
<id>wrap-screensaver-as-exe</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<outfile>${project.build.directory}\win32\${screensaverExe}.exe</outfile>
<jar>jars\${project.build.finalName}.jar</jar>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>copy-jar-for-exe</id>
<phase>prepare-package</phase> <!-- run this execution before package phase -->
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.build.directory}/${project.build.finalName}.jar</sourceFile>
<destinationFile>${project.build.directory}/win32/jars/${project.build.finalName}.jar
</destinationFile>
</configuration>
</execution>
<execution>
<id>rename-screensaver-to-scr</id>
<phase>package</phase>
<goals>
<goal>rename</goal>
</goals>
<configuration>
<sourceFile>${project.build.directory}/win32/${screensaverExe}.exe</sourceFile>
<destinationFile>${project.build.directory}/win32/${screensaverExe}.scr</destinationFile>
</configuration>
</execution>
</executions>
</plugin>

determine repository URL for maven deploy-file

I am using Maven to build a particular project, and within the POM I am building 3 different variants of the primary artifact using the maven shade plugin (I'm creating uber jars with various combinations of included logging frameworks). The shade plugin creates jars with alternative artifact IDs and their respective dependency-reduced-poms.
My challenge is now how to deploy these new artifacts to my remote repositories. I'm using the maven install plugin to install them to my local repo, but the maven deploy plugin requires explicit configuration of a repository URL. What I want to happen is for the plugin to adopt whichever remote repo the default deploy uses, whether its the snapshot or release repo or another repo URL that I pass in via command-line. I was hoping to find some maven property like ${project.remoterepo.url} that equated to the resolved repo. It seems silly to have to explicitly configure the remote URL when the deploy goal already does this.
Any advice appreciated. Thanks!
This is what I did to automatically select either the SNAPSHOT or RELEASE repro based on the version pattern: (I know that this is a kind of code smell but as far as the ASF is not willing to include your code for what ever reason I could solve my requirement)
<properties>
<deploy.repositoryUrl>.. url release repo ..</deploy.repositoryUrl>
<deploy.repositoryId>.. id release repo ..</deploy.repositoryId>
<deploy.repositorySnapshotUrl>.. snapshot repo ..</deploy.repositorySnapshotUrl>
<deploy.repositorySnapshotId>.. id snapshot repo ..</deploy.repositorySnapshotId>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- sets the isSnapshot property to true if SNAPSHOT was used -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>isSnapshot</name>
<value>${project.version}</value>
<regex>.*-SNAPSHOT</regex>
<replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<!-- set the properties deploy.Url and deploy.Id during validation to
either the snapshot repository or the release repository
depending on the version pattern.-->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source><![CDATA[
pom.properties['deploy.Url']=pom.properties['isSnapshot'].equals('true') ? pom.properties['deploy.repositorySnapshotUrl'] : pom.properties['deploy.repositoryUrl'];
pom.properties['deploy.Id']=pom.properties['isSnapshot'].equals('true') ? pom.properties['deploy.repositorySnapshotId'] : pom.properties['deploy.repositoryId'];
]]></source>
</configuration>
</execution>
</executions>
</plugin>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>DeployToArtifactory</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>${deploy.Url}</url>
<repositoryId>${deploy.Id}</repositoryId>
<file>target/${project.build.finalName}.${project.packaging}</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<classifier>resources</classifier>
<pomFile>${project.build.directory}/pom/pom.xml</pomFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Tiemo Vorschütz method is a good idea, but may not work for me.
It case some 'Exception in thread "main" BUG! exception in phase 'conversion' in source unit 'script' errors.
I have changed the gmaven plugin to a newer version and fixed errors, change it from 'gmaven-plugin' 1.x to 'groovy-maven-plugin' 2.x
like this:
<properties>
<deploy.repositoryUrl>.. url release repo ..</deploy.repositoryUrl>
<deploy.repositoryId>.. id release repo ..</deploy.repositoryId>
<deploy.repositorySnapshotUrl>.. snapshot repo ..</deploy.repositorySnapshotUrl>
<deploy.repositorySnapshotId>.. id snapshot repo ..</deploy.repositorySnapshotId>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<!-- sets the isSnapshot property to true if SNAPSHOT was used -->
<id>build-helper-regex-is-snapshot-used</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>isSnapshot</name>
<value>${project.version}</value>
<regex>.*-SNAPSHOT</regex>
<replacement>true</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<!-- set the properties deploy.Url and deploy.Id during validation to
either the snapshot repository or the release repository
depending on the version pattern.-->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source><![CDATA[
project.getProperties().put('deploy.Url',properties['isSnapshot'].equals('true') ? properties['deploy.repositorySnapshotUrl'] : properties['deploy.repositoryUrl']);
project.getProperties().put('deploy.Id',properties['isSnapshot'].equals('true') ? properties['deploy.repositorySnapshotId'] : properties['deploy.repositoryId']);
]]></source>
</configuration>
</execution>
</executions>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>DeployToArtifactory</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<url>${deploy.Url}</url>
<repositoryId>${deploy.Id}</repositoryId>
<file>target/${project.build.finalName}.${project.packaging}</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<classifier>resources</classifier>
<pomFile>${project.build.directory}/pom/pom.xml</pomFile>
</configuration>
</execution>
</executions>
</plugin>
A simple way to do this is leveraging distributionManagement and build-helper-maven-plugin as pointed our by Tiemo Vorschütz's answer.
...
<distributionManagement>
<repository>
<id>my-release</id>
<name>my-release</name>
<url>https://example.com/release</url>
</repository>
<snapshotRepository>
<id>my-snapshot</id>
<name>my-snapshot</name>
<url>https://example.com/snapshot</url>
</snapshotRepository>
</distributionManagement>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<!-- sets the repoUrl property to the correct repository depending on the type of version -->
<id>build-deploy-url</id>
<phase>validate</phase>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>repoUrl</name>
<value>${project.version}</value>
<regex>.*-SNAPSHOT</regex>
<replacement>${project.distributionManagement.snapshotRepository.url}</replacement>
<failIfNoMatch>${project.distributionManagement.repository.url}</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>deploy-file</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/<!--your-file--></file>
<url>${repoUrl}</url>
<repositoryId><!--repo as per settings.xml if credentials are the same--></repositoryId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging><!--your packaging--></packaging>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...

How to have specific maven goal appear on Life-cycle or plugins without run configuration

I have a maven project, in my pom.xml file, I'm using org.codehaus.mojo
I have generated an option to run the main class with a synonym name:
mvn exec:java#genSql
mvn exec:java#runSql
I would like these goals to appear under Maven LifeCycle/Plugins just like Clean, instal, etc.
I don't want to use Maven run configuration since it's not on git
How do make it shown on the Lifecycle or Plugins?
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>genSql</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.myCompany.build.SqlGenerator</mainClass>
</configuration>
</execution>
<execution>
<id>runSql</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.myCompany.build.DBLauncher</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Conditionally Execute JMeter Maven Plugin

I'm trying to figure out how to execute my JMeter performance test plan conditionally. I want to have my Jenkins CI job execute it, but when developers run mvn clean install I don't want the below plugins to run. Any ideas on how I can modify my pom.xml to conditionally run the below plugins?
Maven POM.xml JMeter Plugins:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.8.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<testFilesDirectory>${project.basedir}/src/test/jmeter</testFilesDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<testResultsTimestamp>false</testResultsTimestamp>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/jmeter/results</dir>
<stylesheet>${project.basedir}/src/test/resources/jmeter-results-detail-report_21.xsl</stylesheet>
<outputDir>${project.build.directory}/jmeter/results</outputDir>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
<pattern>(.*?)\s(.*?)</pattern>
<replacement>$1$2</replacement>
<replaceAll>true</replaceAll>
</fileMapper>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<version>0.1.2</version>
<executions>
<execution>
<id>send a mail</id>
<phase>install</phase>
<goals>
<goal>send-mail</goal>
</goals>
<inherited>false</inherited>
<configuration>
<from>admin#test.com</from>
<subject>Load Test Results</subject>
<failonerror>true</failonerror>
<mailhost>relay.apple.com</mailhost>
<htmlMessageFile>${project.build.directory}/jmeter/results/LoadTestPlan.html</htmlMessageFile>
<receivers>
<receiver>email#me.com</receiver>
</receivers>
<fileSets>
<fileSet>
<directory>${project.build.directory}/jmeter/results</directory>
<includes>
<include>LoadTestPlan.html</include>
</includes>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>
The best way to achieve this is with profiles. You define a profile which contains your plugin configuration. This profile would by default be turned off (so when a developer executes mvn clean install it is not activated), and you would only activate it during your Jenkins job.
So for example in your pom you would have something along these lines:
<project>
...
<profiles>
<profile>
<id>ci-environment</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>build.environment</name>
<value>jenkins</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<!-- rest of your jmeter configuration goes here -->
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<!-- rest of your xml-maven configuration goes here -->
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<!-- rest of your postman configuration goes here -->
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
So by default this profile is not active, and the plugins wont execute. On Jenkins you would configure the build to be executed as follows:
mvn clean install -Dbuild.environment=jenkins
As the profile has an id you can also configure Jenkins to specifically use the profile by name as follows:
mvn clean install -Pci-environment
For details on possible ways to activate a profile see the following sonatype resource:
http://books.sonatype.com/mvnref-book/reference/profiles-sect-activation.html

Categories