Extra plugins in child pom which are not inherited - java

I know the concept of super pom and inheritance. But still I see extra plugins magically coming up in my child module effective pom.
The project is very simple :
We have 2 POM -one for parent module and one for child module.
Parent module :
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.practice</groupId>
<artifactId>learning-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>child-module1</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>fr.jcgay.maven.plugins</groupId>
<artifactId>buildplan-maven-plugin</artifactId>
<version>1.3</version>
</plugin>
</plugins>
</build>
</project>
Child module 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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.practice</groupId>
<artifactId>learning-maven</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>child-module1</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
If I generate effective POM of child and parent module I get this :
(I am showing the effective POM data of plugins and goals through buildplan-maven-plugin for ease of reading. I have checked these plugin data with respect to effective POM too.)
[INFO] ------------------------------------------------------------------------
[INFO] Building learning-maven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- buildplan-maven-plugin:1.3:list (default-cli) # learning-maven ---
[INFO] Build Plan for learning-maven:
----------------------------------------------------------
PLUGIN | PHASE | ID | GOAL
----------------------------------------------------------
maven-install-plugin | install | default-install | install
maven-deploy-plugin | deploy | default-deploy | deploy
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building child-module1 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- buildplan-maven-plugin:1.3:list (default-cli) # child-module1 ---
[INFO] Build Plan for child-module1:
---------------------------------------------------------------------------------------
PLUGIN | PHASE | ID | GOAL
---------------------------------------------------------------------------------------
maven-resources-plugin | process-resources | default-resources | resources
maven-compiler-plugin | compile | default-compile | compile
maven-resources-plugin | process-test-resources | default-testResources | testResources
maven-compiler-plugin | test-compile | default-testCompile | testCompile
maven-surefire-plugin | test | default-test | test
maven-jar-plugin | package | default-jar | jar
maven-install-plugin | install | default-install | install
maven-deploy-plugin | deploy | default-deploy | deploy
[INFO] ------------------------------------------------------------------------
If you see in child module , you are getting more plugins than the parent.
If you want to see the super POM , it is here.
So where does this extra plugins coming from in child module ?

I do not see it in your child pom, but you probably set the packaging to jar somewhere. The standard lifecycle of Maven defines several goals to be called depending on the packaging, and the Maven plugins you list would fit well to those goals.

Related

Overriding properties in profile in multi module projects is not working properly in Maven

Pom A is parent of Pom B and Pom C.
Pom A has a profile sample-profile that overwrites a property <scala.version> defined in Pom A.
The default value of <scala.version> is 2.11, the value defined in sample-profile for this property is is 2.12.
In dependencyManagement section of Pom A, one dependency's artifactId depends on the value of <scala.version>.
<dependency>
<groupId>com.github.scopt</groupId>
<artifactId>scopt_${scala.version}</artifactId>
<version>3.7.0</version>
</dependency>
Project C depends on scopt_${scala.version}. Project B depends on Project C.
Desired behavior is :
run mvn clean install -DskipTests -Psample-profileand get Project C depend on scopt_2.12.
Actual behavior is :
When I run mvn clean install -DskipTests -Psample-profile or mvn dependency:tree -Psample-profile within the directory of Project B , the artifactId of Project C is scopt_2.11 instead of scopt_2.12
mvn help:effective-pom -Psample-profile yields no trace of scopt_2.11 though.
How shall I fix this ?
[Edit] - Initially, I build everything from Pom A with sample-profile (When I do so, I have the desired behavior, i.e. having scopt_2.12 as a dependency for project C). Then after doing code modifications on project B, I only need to build from Pom B (with the same sample-profile). And this is when I have the unexpected behavior (i.e. having scopt_2.11 as a dependency for project C).
I'm not sure about the real reason but maven might try to resolve dependencies before it resolves profiles. Especially since they may affect plugin, which may extends maven (see maven extensions).
You could try this:
Declare both versions in your dependencyManagement, without any profile jinx.
In the child project (B), use <artifactId>scopt_${scala.version}</artifactId> as artifactId.
This may work.
The following works for me, using a Junit jar for convienience.
Parent pom is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.essexboy</groupId>
<artifactId>parent-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent-demo</name>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
<profile>
<id>profile1</id>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>
<modules>
<module>mod-b</module>
<module>mod-c</module>
</modules>
</project>
Project C looks like:
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent-demo</artifactId>
<groupId>com.essexboy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>mod-c</artifactId>
<name>mod-a</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project>
Project B looks like:
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent-demo</artifactId>
<groupId>com.essexboy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>mod-b</artifactId>
<name>mod-a</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.essexboy</groupId>
<artifactId>mod-c</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
greg.clinker#lldevuk-gclinke:~/work/parent-demo/mod-b$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.essexboy:mod-b >-------------------------
[INFO] Building mod-a 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # mod-b ---
[INFO] com.essexboy:mod-b:jar:1.0-SNAPSHOT
[INFO] \- com.essexboy:mod-c:jar:1.0-SNAPSHOT:compile
[INFO] \- junit:junit:jar:4.11:compile
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.774 s
[INFO] Finished at: 2021-05-27T09:47:47+01:00
[INFO] ------------------------------------------------------------------------
greg.clinker#lldevuk-gclinke:~/work/parent-demo/mod-b$ mvn dependency:tree -Pprofile1
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.essexboy:mod-b >-------------------------
[INFO] Building mod-a 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # mod-b ---
[INFO] com.essexboy:mod-b:jar:1.0-SNAPSHOT
[INFO] \- com.essexboy:mod-c:jar:1.0-SNAPSHOT:compile
[INFO] \- junit:junit:jar:4.13.2:compile
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.620 s
[INFO] Finished at: 2021-05-27T09:47:51+01:00
[INFO] ------------------------------------------------------------------------

Complex multi module maven project failed to build

I stuck on building complex maven multi module project based on Hexagonal architecture.
My maven module structure look like that
| graphql-intro (root module)
| graphql-intro.xml
+-- bootloader (module)
| +--- src/main/java/com/intro/graphql/ApplicationInitializer
| +--- bootloader.xml
|
+-- domain (module)
| +--- domain.xml
|
+-- infrastructure-adapters (module, root module for adapters)
| +--- infrastructure-adapters.xml
|
| +--- adapter-api-graphql (module)
| | +--- adapter-api-graphql.xml
|
| +--- adapter-persistence-in-memory (module)
| | +--- adapter-persistence-in-memory.xml
|
| +--- adapter-persistence-spring-data-jpa (module)
| | +--- adapter-persistence-spring-data-jpa.xml
root.xml look like that
...
<packaging>pom</packaging>
<modules>
<module>domain</module>
<module>infrastructure-adapters</module>
<module>bootloader</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
</parent>
<groupId>com.into.graphql</groupId>
<artifactId>graphql-into</artifactId>
<version>0.0.1-SNAPSHOT</version>
...
<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.intro.graphql.ApplicationInitializer</mainClass>
</configuration>
</plugin>
...
and this is infrastructure-adapters.xml
<parent>
<artifactId>graphql-into</artifactId>
<groupId>com.into.graphql</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<artifactId>infrastructure-adapters</artifactId>
<name>infrastructure-adapters</name>
<description>infrastructure-adapters</description>
<modules>
<module>adapter-persistence-spring-data-jpa</module>
<module>adapter-persistence-in-memory</module>
<module>adapter-api-graphql-kickstarter</module>
</modules>
The problem is that during build persistence adapters cannot see class from domain module, and this is pom in spring data jpa persistence adapter
<parent>
<groupId>com.into.graphql</groupId>
<artifactId>infrastructure-adapters</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>adapter-persistence-spring-data-jpa</artifactId>
<name>adapter-persistence-spring-data-jpa</name>
<description>adapter-persistence-spring-data-jpa</description>
<dependencies>
...
<dependency>
<groupId>com.into.graphql</groupId>
<artifactId>domain</artifactId>
</dependency>
...
</dependencies>
The error is
[INFO] graphql-into ....................................... SUCCESS [ 1.875 s]
[INFO] domain ............................................. SUCCESS [ 2.582 s]
[INFO] infrastructure-adapters ............................ SUCCESS [ 0.092 s]
[INFO] adapter-persistence-spring-data-jpa ................ FAILURE [ 2.118 s]
[INFO] adapter-persistence-in-memory ...................... SKIPPED
[INFO] adapter-api-graphql-kickstarter .................... SKIPPED
[INFO] bootloader ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.152 s
[INFO] Finished at: 2020-04-30T11:17:26+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project adapter-persistence-spring-data-jpa: Compilation failure: Compilation failure:
[ERROR] path/graphql-into/infrastructure-adapters/adapter-persistence-spring-data-jpa/src/main/java/com/intro/graphql/persistance/jpa/products/ProductDaoAdapter.java:[3,33] package com.intro.grap
hql.dealers does not exist (it is package from domain module)
Has anyone know what could be a problem, can inside module depend from outside module or maybe the order of build is bad ?
Problem solved, I moved build configuration with spring-boot-maven-plugin to the bootloader pom and now build work. Unfortunatelly I dont know the reason why it solved problem.

Setting different builds for Maven Dev and Prod

I am migrating from ant to maven.
I need to make the environment specific builds for dev and prod, I have seen many questions related to that but in my case I have some java files which will only goes into prod. How can I use those java fils to separate the builds.
my project structure looks like
parent
project A
| src
| pom
project B
| src
| pom
project C
| src
| pom
project D
| src
| pom
Parent-POM
Java files which are only used in Prod are the password utilities files.
Please let me know if you have any confusion.
Thanks in advance.
I agree with #khmarbaise, nevertheless a dirty approach could be to define the library name as a property and use 2 different profile to decide with library to use.
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>${my.library}</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
<properties>
<slf4j.version>1.7.25</slf4j.version>
</properties>
<profiles>
<profile>
<id>prod</id>
<properties>
<my.library>slf4j-jdk14</my.library>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<my.library>slf4j-log4j12</my.library>
</properties>
</profile>
</profiles>
mvn -P dev dependency:tree
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # test ---
[INFO] test:test:jar:1.0-SNAPSHOT
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] \- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile
[
mvn -P prod dependency:tree
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # test ---
[INFO] test:test:jar:1.0-SNAPSHOT
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] \- org.slf4j:slf4j-jdk14:jar:1.7.25:compile
[

Multi-module spring boot configuration

I'm trying to configure a multi-module Spring boot application. The simplest example is:
pom1
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>testExample</groupId>
<artifactId>testExample</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/>
</parent>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>module1</module>
</modules>
</project>
pom2:
<?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>testExample</artifactId>
<groupId>testExample</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>module1</artifactId>
<properties>
<start-class>testExamplePackage.RootConfig</start-class>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>
RootConfig:
package testExamplePackage;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class RootConfig {
public static void main(String[] args) {
System.out.println("Doing some work...");
}
}
Why am I getting an ERROR starting maven 'clean spring-boot:run'?
"C:\Program Files\Java\jdk1.8.0_102\bin\java" -Dmaven.multiModuleProjectDirectory=D:\PROGRAMACION\Projects\TEMP_PROJECTS\testExample "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2017.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2017.1\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2017.1\lib\idea_rt.jar=57646:C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2017.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2017.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.1 clean spring-boot:run
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] testExample
[INFO] module1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testExample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # testExample ---
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) > test-compile # testExample >>>
[INFO]
[INFO] <<< spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) < test-compile # testExample <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) # testExample ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] testExample ........................................ FAILURE [ 0.487 s]
[INFO] module1 ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.884 s
[INFO] Finished at: 2017-03-25T16:44:47+02:00
[INFO] Final Memory: 18M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) on project testExample: Unable to find a suitable main class, please add a 'mainClass' property -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
It wants mainClass, but this class is already specified.
mvn clean spring-boot:run has to be executed from the module that contains the SpringBootApplication.
You execute it from the parent pom.
Execute this command from module1, it should work.
By the way, this duplicated declaration in module1 pom.xml is not required as it is already specified by your parent :
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
This is how I do it.
From the root of the multi-module project, run this:
mvn -pl module1 spring-boot:run
Now, if you have a config folder in the root of your multi-module spring boot project, Spring-boot will also scan that folder for property files (n addition to src/main/resources), making those properties global to all your modules.

Why is maven release skipping my child modules

What I am trying to do is to push out a couple of parent poms for all of our sub projects. I have a single project that contains a single parent pom with two child module poms. Packaging for all three are of type pom if this makes a difference. When I deploy though it is failing to deploy the child modules saying that they are skipped.
Parent Pom
<groupId>com.test.cpbx</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.1-SNAPSHOT</version>
<name>Parent Pom</name>
<scm>
<connection>scm:svn:https://url/trunk</connection>
</scm>
<modules>
<module>appia</module>
<module>rialto</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<goals>deploy</goals>
<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.0.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
This is one of my child poms, they are the same with the only change being the artifactId name
Child 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test.cpbx</groupId>
<artifactId>parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<artifactId>rialto-parent</artifactId>
<packaging>pom</packaging>
<name>Rialto Parent POM</name>
</project>
Output
mvn -B -DreleaseVersion=1.1 -DdevelopmentVersion=1.2.0-SNAPSHOT release:prepare -DdryRun
...
[INFO] Not removing release POMs
[INFO] Executing completion goals - since this is simulation mode it is running against the original project, not the rewritten ones
[INFO] Full run would be commit 3 files with message: '[maven-release-plugin] prepare for next development iteration'
[INFO] Release preparation simulation complete.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Parent Pom ........................................ SUCCESS [2.573s]
[INFO] Appia Parent POM .................................. SKIPPED
[INFO] Rialto Parent POM ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.749s
[INFO] Finished at: Wed May 21 14:52:30 CDT 2014
[INFO] Final Memory: 15M/114M
[INFO] ------------------------------------------------------------------------
There was some confusion with the output of maven.
The output does not mean it is skipping building the modules or deploying the modules.
It is a message about the refactoring of the versions. The output is telling us that the parent pom owns the version and the child versions are dependent on the parent pom. This means that it does not need to refactor the child modules pom.xml so it prints the child in the reactor summary as SKIPPED.
Another possibility is that it mean that the process did not worked until being able to build those modules:
In case of an activated parallel execution it can show something like this:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Parent Pom ........................................ SUCCESS [2.573s]
[INFO] Child1 POM ........................................ SKIPPED
[INFO] Child2 POM ........................................ SKIPPED
[INFO] Dependent Sibling POM ............................. FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
If one of the Childx artifacts is needed by the dependent sibling, it can be requesting the dependency before this even was built. This causes the whole build to fail.
It is just misleading to think the last was only failed because the other were missed during build. An ABORTED state in the overview would have saved some time.

Categories