Using maven release plugin on multi-module project - maven

I have a multi-module project with two modules: war and ear module. I'm trying to use Maven release plugin to manage releases.
My config so far...
parent pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>Test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>Test-WAR</module>
<module>Test-EAR</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- some other properties -->
</properties>
<dependencyManagement>
<dependencies>
<!-- some dependencies -->
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>nexus-snapshots</id>
<name>nexus</name>
<url>http://nexus.example.com:8081/repository/maven-snapshots</url>
</repository>
<repository>
<id>nexus-releases</id>
<name>nexus</name>
<url>http://nexus.example.com:8081/repository/maven-releases</url>
</repository>
</repositories>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>nexus</name>
<url>http://nexus.example.com:8081/repository/maven-snapshots</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<name>nexus</name>
<url>http://nexus.example.com:8081/repository/maven-releases</url>
</repository>
</distributionManagement>
<scm>
<connection>scm:git:http://gitlab.example.com/test/Test.git</connection>
<developerConnection>scm:git:http://gitlab.example.com/test/Test.git</developerConnection>
<url>http://gitlab.example.com/test/Test</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>v#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.8</version>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>deploy-parent</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
war module pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>Test</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>Test-WAR</artifactId>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<!-- some dependencies -->
</dependencies>
<profiles>
<!-- dev -->
<profile>
<id>dev</id>
<properties>
<CREATE_EJB_STUBS_SCRIPT_FILE>createEJBStubs.bat</CREATE_EJB_STUBS_SCRIPT_FILE>
<APP_CLASSES_DIR>${basedir}/target/classes</APP_CLASSES_DIR>
<EJB_LOCATION>src/test/resources/build/${project.parent.artifactId}.jar</EJB_LOCATION>
<EJB_CLIENT_LOCATION>src/test/resources/build/${project.parent.artifactId}-${project.parent.version}.jar</EJB_CLIENT_LOCATION>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>deploy-ejb-client</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>nexus-snapshots</repositoryId>
<file>${EJB_CLIENT_LOCATION}</file>
<url>http://nexus.example.com:8081/repository/maven-snapshots</url>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-EJB-CLIENT</artifactId>
<version>${project.parent.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>deploy-ejb</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>nexus-snapshots</repositoryId>
<file>${EJB_LOCATION}</file>
<url>http://nexus.example.com:8081/repository/maven-snapshots</url>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-EJB</artifactId>
<version>${project.parent.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- release -->
<profile>
<id>release</id>
<properties>
<CREATE_EJB_STUBS_SCRIPT_FILE>createEJBStubs.bat</CREATE_EJB_STUBS_SCRIPT_FILE>
<APP_CLASSES_DIR>../../../Test-WAR/target/classes</APP_CLASSES_DIR>
<EJB_LOCATION>../../../Test-WAR/src/test/resources/build/${project.parent.artifactId}.jar</EJB_LOCATION>
<EJB_CLIENT_LOCATION>../../../Test-WAR/src/test/resources/build/${project.parent.artifactId}-${project.parent.version}.jar</EJB_CLIENT_LOCATION>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>ant-build</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<property name="server.dir" value="${SERVER_DIR}" />
<property name="createEjbStubsScriptFile" value="${CREATE_EJB_STUBS_SCRIPT_FILE}" />
<property name="appClassesDir" value="${APP_CLASSES_DIR}" />
<property name="author" value="${project.organization.name}" />
<property name="maven.root" value="${project.parent.artifactId}" />
<property name="maven.war.artifactId" value="${project.artifactId}" />
<property name="maven.war.version" value="${project.parent.version}" />
<ant antfile="${basedir}/src/test/resources/ant/build.xml">
<target name="run" />
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>deploy-ejb-client</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>nexus-releases</repositoryId>
<file>${EJB_CLIENT_LOCATION}</file>
<url>http://nexus.example.com:8081/repository/maven-releases</url>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-EJB-CLIENT</artifactId>
<version>${project.parent.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>deploy-ejb</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>nexus-releases</repositoryId>
<file>${EJB_LOCATION}</file>
<url>http://nexus.example.com:8081/repository/maven-releases</url>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-EJB</artifactId>
<version>${project.parent.version}</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<packagingExcludes>WEB-INF/classes/rebel.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>package</phase>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/test/resources</directory>
<includes>
<include>log4j2.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>ant-build</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<property name="server.dir" value="${SERVER_DIR}" />
<property name="createEjbStubsScriptFile" value="${CREATE_EJB_STUBS_SCRIPT_FILE}" />
<property name="appClassesDir" value="${APP_CLASSES_DIR}" />
<property name="author" value="${project.organization.name}" />
<property name="maven.root" value="${project.parent.artifactId}" />
<property name="maven.war.artifactId" value="${project.artifactId}" />
<property name="maven.war.version" value="${project.parent.version}" />
<ant antfile="${basedir}/src/test/resources/ant/build.xml">
<target name="run" />
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<verbose>true</verbose>
<fork>true</fork>
<executable>${IBM_JDK_1_8}/bin/javac</executable>
<compilerVersion>1.6</compilerVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- some config -->
</configuration>
</plugin>
</plugins>
</build>
</project>
ear module pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>Test</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>Test-EAR</artifactId>
<packaging>ear</packaging>
<dependencies>
<!-- WAR -->
<dependency>
<groupId>com.example</groupId>
<artifactId>Test-WAR</artifactId>
<version>${project.parent.version}</version>
<type>war</type>
</dependency>
<!-- some other dependencies -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9</version>
<configuration>
<modules>
<!-- some jar modules -->
<webModule>
<groupId>com.example</groupId>
<artifactId>Test-WAR</artifactId>
<contextRoot>/Test</contextRoot>
</webModule>
</modules>
<version>6</version>
<finalName>${project.parent.artifactId}-${project.parent.version}</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>deploy-ear</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>nexus-snapshots</repositoryId>
<file>target/${project.parent.artifactId}-${project.parent.version}.ear</file>
<url>http://nexus.example.com:8081/repository/maven-snapshots</url>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>ear</packaging>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I have two profiles - dev (which is active by default) and release (which is activated by release plugin). First, I had some problems with ant run (file paths) when releasing version, so I've used two profiles with some properties defined, that are used in ant run. Ant script is now executed properly, but I have another problem: plugin attempts to upload some release files twice which causes error:
executing mvn release:prepare "-Darguments=-Dmaven.test.skip=true": log
executing mvn release:perform "-Darguments=-Dmaven.test.skip=true": log
As you can see form logs, Test-WAR-0.0.1-sources.jar is uploading twice. Why is that? How can I edit my configuration to upload it only once?

It is quite possible that you suffer from the same bug as I did some years ago:
Maven deploy-file goal: Why does the first execution interfere with the second one?
Try to update the Maven deploy plugin to version 3.0.0-M1.

Related

Can not resolve ${project.parent.version} to download dependency

i am using/tried with following versions:
Intellij 2022.3.3 and the prev. one.
Maven 3.8.5, 3.8.4, 3.8.1
I also tried following envs:
Maven-Tool integrated into IntelliJ
IntelliJ terminal
OS terminal
And i always get this error:
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
Could not find artifact io.swagger:swagger-annotations:pom:${project.parent.version} in mirror-maven.
[INFO]
[INFO] --- openapi-generator-maven-plugin:5.1.0:generate (generate) # XXX-parent-application ---
[WARNING] The POM for io.swagger.core.v3:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.core.v3:swagger-models:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v2-converter:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v3:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for org.openapitools:openapi-generator-core:jar:${project.parent.version} is missing, no dependency information available
[INFO] --- swagger-maven-plugin:3.1.8:generate (default) # XXX-projectname ---
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-core:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-jaxrs:jar:${project.parent.version} is missing, no dependency information available
URL_TO_MY_CENTRAL_REPO/io/swagger/core/v3/swagger-annotations/$%7Bproject.parent.version%7D/swagger-annotations-$%7Bproject.parent.version%7D.pom
I am the only one in my team who has this issue, we checked a lot of stuff:
delete maven-repo-folder
check maven-configuration in intellij and settings.xml
insert a static version (but it does not overwrite ${project.parent.version}
yes, it does exist on our artifactory-server
fresh pull from github
So, my question is, where can i find this used property, because i cant find it anywhere in the project.
Update:
added pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>PARENT</artifactId>
<groupId>GROUP_ID_APP</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>application-a</module>
<module>application-b</module>
<module>application-c</module>
<module>application-d</module>
</modules>
<artifactId>PARENT-application</artifactId>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!--Properties for swagger generating-->
<swaggerJsonDir>${basedir}/target/generated</swaggerJsonDir>
<swaggerJsonVersion>${project.version}</swaggerJsonVersion>
<swaggerLocation>Override in child project</swaggerLocation>
<swaggerTitle>Override in child project</swaggerTitle>
<!--Override in child project with "compile"-->
<swaggerPhase>none</swaggerPhase>
<!--Properties for client generation-->
<client-generation-application-package>Override in child project</client-generation-application-package>
<sonar.exclusions>
**/foldername/**/*_generated/**/*.java
</sonar.exclusions>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- START: added this part below to check if this may solve my problem -->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-core</artifactId>-->
<!-- <version>1.6.5</version>-->
<!-- </dependency>-->
<!-- 2.1.23 -->
<!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-models -->
<!-- <dependency>-->
<!-- <groupId>io.swagger.core.v3</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>2.1.13</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>2.0.30</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.4.0</version>
</dependency>
<!-- END: added this part above to check if this may solve my problem -->
</dependencies>
<build>
<plugins>
<!--Build executable jar from spring application.-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<!--Generate swagger.json-->
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.8</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>
<location>${swaggerLocation}</location>
</locations>
<info>
<title>${swaggerTitle}</title>
<version>${swaggerJsonVersion}</version>
</info>
<outputFormats>json</outputFormats>
<swaggerDirectory>${swaggerJsonDir}</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>${swaggerPhase}</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>generate-application-b-client</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<input>${project.basedir}/../application-b/target/generated/swagger.json</input>
<targetDirectory>${project.basedir}/target/application-b</targetDirectory>
<modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.model</modelPackage>
<apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.service.client</apiPackage>
<sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
<modelDirectory>${sourceDirectory}/application_b_generated/model</modelDirectory>
<apiDirectory>${sourceDirectory}/application_b_generated/service</apiDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<id>generate</id>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${input}</inputSpec>
<output>${targetDirectory}</output>
<skipValidateSpec>true</skipValidateSpec>
<generatorName>java</generatorName>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<configOptions>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-models</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modelDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${modelDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-services</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${apiDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${apiDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-old</id>
<phase>compile</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${modelDirectory}</directory>
</fileset>
<fileset>
<directory>${apiDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
<execution>
<id>auto-clean</id>
<phase>integration-test</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${targetDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>generate-application-a-client</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<input>${project.basedir}/../application-a/target/generated/swagger.json</input>
<targetDirectory>${project.basedir}/target/application-a</targetDirectory>
<modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.model</modelPackage>
<apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.service.client</apiPackage>
<sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
<modelDirectory>${sourceDirectory}/application_a_generated/model</modelDirectory>
<apiDirectory>${sourceDirectory}/application_a_generated/service</apiDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<id>generate</id>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${input}</inputSpec>
<output>${targetDirectory}</output>
<skipValidateSpec>true</skipValidateSpec>
<generatorName>java</generatorName>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<configOptions>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-models</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modelDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${modelDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-services</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${apiDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${apiDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-old</id>
<phase>compile</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${modelDirectory}</directory>
</fileset>
<fileset>
<directory>${apiDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
<execution>
<id>auto-clean</id>
<phase>integration-test</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${targetDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Maven often doesn't resolve version number for transitive dependencies - "${project.version}"
ill post my solution there.

Maven release failing : A zip file cannot include itself

I am facing an issue while releasing a Maven project to nexus repository. I am doing this by Jenkins job. I am getting the error:
Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.0.1:jar (attach-sources) on project xyz: Error creating source archive: A zip file cannot include itself -> [Help 1]
I am using maven assembly plugin and external.atlassian.jgitflow:jgitflow-maven-plugin.
I have followed below article on StackOveflow : A zip file cannot include itself - Maven-assembly plugin
But this did not solve the problem. Below is how I am using the plugin
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.x</groupId>
<artifactId>y</artifactId>
<packaging>jar</packaging>
<version>2.0.0</version>
<name>myArtifact</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>myRepoId</id>
<url>http://my/repo/location/releases/</url>
</repository>
<snapshotRepository>
<id>mySnapshotRepoId</id>
<url>http://my/repo/location/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>myRepoId</id>
<url>http://my/repo/location/releases/</url>
</repository>
<repository>
<id>mySnapshotRepoId</id>
<url>http://my/snapshot/repo/location/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!-- http://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<profiles>
<profile>
<id>local</id>
<properties>
<build.profile.id>local</build.profile.id>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>pre_prod</id>
<properties>
<build.profile.id>pre_prod</build.profile.id>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<build.profile.id>prod</build.profile.id>
</properties>
</profile>
</profiles>
<build>
<testResources>
<testResource>
<directory>${project.build.directory}</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<enableSshAgent>true</enableSshAgent>
<allowUntracked>true</allowUntracked>
<allowSnapshots>true</allowSnapshots>
<autoVersionSubmodules>true</autoVersionSubmodules>
<pushFeatures>true</pushFeatures>
<pushReleases>true</pushReleases>
<pushHotfixes>true</pushHotfixes>
<noDeploy>false</noDeploy>
<scmCommentPrefix>TC-61</scmCommentPrefix>
<flowInitContext>
<developBranchName>development</developBranchName>
<versionTagPrefix>My-APP-</versionTagPrefix>
</flowInitContext>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.8.1</version>
<configuration>
<tag>Release-${project.artifactId}-${project.version}</tag>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<manifest>
<mainClass>com.mains.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<encoding>UTF-8</encoding>
<resources>
<resource>
<directory>src/main/resources/config/${build.profile.id}</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources/velocities/html</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
<!-- START: Maven Jacoco Plugin -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<!-- Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed. -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>jacoco-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<!-- Ensures that the code coverage report for unit tests is created
after unit tests have been run. -->
<execution>
<id>jacoco-report</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>
Can someone point me where I am making the mistake.
Thanks.

Removing surefire plugin

I have the following parent POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my_group</groupId>
<artifactId>my_artifact</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<modules>
<module>../common-module</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<https.website>http://intosimple.blogspot.com</https.website>
<snapshot.version>0.0.1</snapshot.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And the corresponding child POM is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>My_group1</groupId>
<artifactId>my_artifact_1</artifactId>
<version>0.0.1-</version>
<relativePath>../base/pom.xml</relativePath>
</parent>
<artifactId>some_module</artifactId>
<properties>
<jdk.version>1.8</jdk.version>
<jacoco.version>0.7.5.201505241946</jacoco.version>
</properties>
<dependencies>
<!-- some packages here-->
</dependencies>
<build>
<finalName>my_artifact_1</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.0400</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
<outputDirectory>target/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
Even though, there is no mention of surefire plugin, the effective POM somehow is getting that. Could it be coming from any dependency?
I doubt that surefire might be causing Jacoco to fail. I want to remove it completely. What is right way of doing it?

Get svn revision number trough Maven as a variable for later use in Java code

How can I do this?
I want to get the build number from the checked out branch and build it with Maven. Later in my java application I want to use the buildNumber variable as a Revision ID so i'll have more specific details on each project build.
I am currently using this code for getting the buildNumber and use resource filtering on it in a build.properties file but the ${buildNumber} from the file doesn't get updated with the revision number.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>myProject</artifactId>
<version>2.5</version>
<packaging>pom</packaging>
<name>myProject</name>
<description>myProject Modules</description>
<!-- Module list must match directory name (Camel Case) -->
<modules>
....
<!-- Contains modules -->
</modules>
<properties>
<myProject.version>${project.version}</myProject.version>
<java-version>1.7</java-version>
<svn.root>http://SVNmyCompanyURL/Project/myProject/trunk</svn.root>
<apsf.groupId>com.myCompany.aps</apsf.groupId>
<aji.version>13.22</aji.version>
<pim.version>1.8</pim.version>
<apsf.version>1.5.0.0</apsf.version>
<springframework.version>4.2.3.RELEASE</springframework.version>
<apsf.service.groupId>com.myCompany.aps.adf</apsf.service.groupId>
<apsf.service.version>1.5.0.0</apsf.service.version>
<apsf.codegen.groupId>com.myCompany.aps.adf</apsf.codegen.groupId>
<apsf.codegen.version>1.5.0.0</apsf.codegen.version>
<apsf.module.scope>compile</apsf.module.scope>
<myProject.buildNumber>${project.version}.{buildNumber}</myProject.buildNumber>
</properties>
<scm>
<url>${svn.root}</url>
<connection>scm:svn:${svn.root}</connection>
<developerConnection>scm:svn:${svn.root}</developerConnection>
<tag>HEAD</tag>
</scm>
<issueManagement>
<!-- Jira stuff -->
</issueManagement>
<organization>
<!-- Company stuff -->
</organization>
<dependencyManagement>
<dependencies>
<!--Lots of dependencies-->
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>dev</id>
<properties>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<profile>
<id>skipTests</id>
<properties>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
<profile>
<id>integration-test</id>
<properties>
<build.profile.id>integration-test</build.profile.id>
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<timestampFormat>{0,date,dd-MM-yyyy HH:mm:ss}</timestampFormat>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<compilerArgument>-Xlint:none</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<skipTests>${skip.unit.tests}</skipTests>
<argLine>-XX:-UseSplitVerifier</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Implementation-Build>${buildNumber}</Implementation-Build>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Vendor>ENTERPRISE</Implementation-Vendor>
<Implementation-Version>${project.version}</Implementation-Version>
<Built-By>${user.name}</Built-By>
<Built-OS>${os.name}</Built-OS>
<Build-Date>${timestamp}</Build-Date>
<SCM-Revision>${buildNumber}</SCM-Revision>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<version>1.0-beta-6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.1,)</versionRange>
<goals>
<goal>copy</goal>
<goal>unpack</goal>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>add-test-source</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.3,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<versionRange>[1.2.3,)</versionRange>
<goals>
<goal>bind</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
You should use the following to configure it correctly as aalready mentioned not defining executions in pluginManagement.
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>myProject</artifactId>
<version>2.5</version>
<packaging>pom</packaging>
<name>myProject</name>
<description>myProject Modules</description>
<!-- Module list must match directory name (Camel Case) -->
<modules>
<!-- Contains modules -->
</modules>
<properties>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<svn.root>http://SVNmyCompanyURL/Project/myProject/trunk</svn.root>
<apsf.groupId>com.myCompany.aps</apsf.groupId>
<aji.version>13.22</aji.version>
<pim.version>1.8</pim.version>
<apsf.version>1.5.0.0</apsf.version>
<springframework.version>4.2.3.RELEASE</springframework.version>
<apsf.service.groupId>com.myCompany.aps.adf</apsf.service.groupId>
<apsf.service.version>1.5.0.0</apsf.service.version>
<apsf.codegen.groupId>com.myCompany.aps.adf</apsf.codegen.groupId>
<apsf.codegen.version>1.5.0.0</apsf.codegen.version>
<apsf.module.scope>compile</apsf.module.scope>
</properties>
<scm>
<url>${svn.root}</url>
<connection>scm:svn:${svn.root}</connection>
<developerConnection>scm:svn:${svn.root}</developerConnection>
<tag>HEAD</tag>
</scm>
<issueManagement>
<!-- Jira stuff -->
</issueManagement>
<organization>
<!-- Company stuff -->
</organization>
<dependencyManagement>
<dependencies>
<!--Lots of dependencies -->
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>dev</id>
<properties>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<profile>
<id>skipTests</id>
<properties>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
<profile>
<id>integration-test</id>
<properties>
<build.profile.id>integration-test</build.profile.id>
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<timestampFormat>{0,date,dd-MM-yyyy HH:mm:ss}</timestampFormat>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<compilerArgument>-Xlint:none</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<skipTests>${skip.unit.tests}</skipTests>
<argLine>-XX:-UseSplitVerifier</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Implementation-Build>${buildNumber}</Implementation-Build>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Vendor>ENTERPRISE</Implementation-Vendor>
<Implementation-Version>${project.version}</Implementation-Version>
<Built-By>${user.name}</Built-By>
<Built-OS>${os.name}</Built-OS>
<Build-Date>${timestamp}</Build-Date>
<SCM-Revision>${buildNumber}</SCM-Revision>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<version>1.0-beta-6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
<!--
! Wrong plugin.
!
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
<!--
! This is the correct one!
-->
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.1,)
</versionRange>
<goals>
<goal>copy</goal>
<goal>unpack</goal>
<goal>
copy-dependencies
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
build-helper-maven-plugin
</artifactId>
<versionRange>
[1.7,)
</versionRange>
<goals>
<goal>add-test-source</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>
[1.3,)
</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jibx</groupId>
<artifactId>
jibx-maven-plugin
</artifactId>
<versionRange>
[1.2.3,)
</versionRange>
<goals>
<goal>bind</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I had to create a separate <plugins> tag </plugins> outside the <pluginManagement> tag and insert the plugin there and now it works.

maven-deploy-plugin not executing its execution

I need to deploy custom jar's from my project itself I overrides maven-deploy-plugin with two more execution with its default execution. below are my pom.xml with distributionManagement and maven-deploy-plugin which I use for my deployment.
<groupId>mycompany</groupId>
<artifactId>myproject</artifactId>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>temp</id>
<name>Release Repository</name>
<url>http://localhost:8000/nexus/content/repositories/temp/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
some dependency
</dependency>
<dependency>
some dependency
</dependency>
<dependency>
some dependency
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
<execution>
<id>myjar-one</id>
<phase>deploy</phase>
<configuration>
<repositoryId>temp</repositoryId>
<url>http://localhost:8000/nexus/content/repositories/temp/</url>
<packaging>jar</packaging>
<artifactId>myjar-one</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<sources>${project.build.directory}/build/lib/myjar-one.jar</sources>
</configuration>
</execution>
<execution>
<id>myjar-two</id>
<phase>deploy</phase>
<configuration>
<repositoryId>temp</repositoryId>
<url>http://localhost:8000/nexus/content/repositories/temp/</url>
<packaging>jar</packaging>
<artifactId>myjar-two</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<sources>${project.build.directory}/build/lib/myjar-two.jar</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Guys I figure out the issue, there are following thing I need to fix.
Need to add goal.
Need to use file tag instead of source tag.
So final maven-deploy-plugin looks like.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
<execution>
<id>myjar-one</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>temp</repositoryId>
<url>http://localhost:8000/nexus/content/repositories/temp/</url>
<packaging>jar</packaging>
<artifactId>myjar-one</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>${project.build.directory}/build/lib/myjar-one.jar</file>
</configuration>
</execution>
<execution>
<id>myjar-two</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>temp</repositoryId>
<url>http://localhost:8000/nexus/content/repositories/temp/</url>
<packaging>jar</packaging>
<artifactId>myjar-two</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>${project.build.directory}/build/lib/myjar-two.jar</file>
</configuration>
</execution>
</executions>
</plugin>
after fixing this issue, my both custom jar's are deployed at my maven repository. Thanks for help

Resources