How can I disable default lifecycle phases in Maven 3? - maven

By disable I mean completely, entirely cut the phase from the lifecycle, so that it is not even invoked.
I might need a custom lifecycle but I could not find an easy way to define it straight in my pom.xml. It appears I need to write a plugin just to list phases I want.
For example, I would like default-testResources, default-testCompile and default-test phases to never happen and turn my build log from this:
[INFO] ------------------------------------------------------------------------
[INFO] Building HelpDesk Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # helpdesk ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory d:\proj\HelpDesk\repo\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) # helpdesk ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # helpdesk ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) # helpdesk ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # helpdesk ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.3:war (default-war) # helpdesk ---
[INFO] Packaging webapp
[INFO] Assembling webapp [helpdesk] in [d:\proj\HelpDesk\repo\target\helpdesk]
[INFO] Processing war project
[INFO] Copying webapp resources [d:\proj\HelpDesk\repo\src\main\webapp]
[INFO] Webapp assembled in [40 msecs]
[INFO] Building war: d:\proj\HelpDesk\repo\target\helpdesk.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
into this:
[INFO] ------------------------------------------------------------------------
[INFO] Building HelpDesk Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # helpdesk ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory d:\proj\HelpDesk\repo\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) # helpdesk ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-war-plugin:2.3:war (default-war) # helpdesk ---
[INFO] Packaging webapp
[INFO] Assembling webapp [helpdesk] in [d:\proj\HelpDesk\repo\target\helpdesk]
[INFO] Processing war project
[INFO] Copying webapp resources [d:\proj\HelpDesk\repo\src\main\webapp]
[INFO] Webapp assembled in [40 msecs]
[INFO] Building war: d:\proj\HelpDesk\repo\target\helpdesk.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

If you want to continue using a predefined packaging (jar, war, etc.) you cannot totally remove them. You may leave the packaging as pom and define your own lifecycle by binding the goals you want to the desired phases, or you may define your own lifecycle entirely. You may also bind a default goal to phase none to prevent the goal from doing any real work as shown.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>default-testResources</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
All that said - khmarbaise's question is a good one. Generally it's not a best practice to change the existing pre-built lifecycles.

Related

Maven doesn't build -runner.jar

I have generated a new project with the archetype and I have run the following maven
./mvnw -Dskiptests clean package
It should build two jar files xxx.jar and xx-runner.jar but it only build one (xxx.jar).
I have configured JAVA_HOME and GRAALVM_HOME pointing to the GraalVM that I have downloaded.
I have installed the Native Image.
My OS is UBUNTU
Maven should build the two JAR files but I don't why. Could someone help me.
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< es.olivar.jaen:atomic-fruit-service >-----------------
[INFO] Building atomic-fruit-service 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # atomic-fruit-service ---
[INFO] Deleting /home/sobremesa/Documents/Develop/java/quarkus/poc/atomic-fruit-service/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # atomic-fruit-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- quarkus-maven-plugin:2.11.3.Final:generate-code (default) # atomic-fruit-service ---
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # atomic-fruit-service ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/sobremesa/Documents/Develop/java/quarkus/poc/atomic-fruit-service/target/classes
[INFO]
[INFO] --- quarkus-maven-plugin:2.11.3.Final:generate-code-tests (default) # atomic-fruit-service ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # atomic-fruit-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/sobremesa/Documents/Develop/java/quarkus/poc/atomic-fruit-service/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # atomic-fruit-service ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/sobremesa/Documents/Develop/java/quarkus/poc/atomic-fruit-service/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) # atomic-fruit-service ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # atomic-fruit-service ---
[INFO] Building jar: /home/sobremesa/Documents/Develop/java/quarkus/poc/atomic-fruit-service/target/atomic-fruit-service-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:2.11.3.Final:build (default) # atomic-fruit-service ---
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 1475ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.615 s
[INFO] Finished at: 2022-08-29T23:38:29+02:00
Thank very much indeed.
The output jar is target/quarkus-app/quarkus-run.jar

Maven surefire plugin doesn't run our Unit test case

Apache Maven 3.5.2 - the pom.xml doesn't declare the surefire plugin explicitly, but the effective pom.xml shows 2.18.1
When I run 'mvn test' - it ends successfully, it doesn't say that it can't find any test cases, but there is no trace of the test cases. This is all I see:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpreadSheetUploadWeb 1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:1.9.10 is missing, no dependency information available
[WARNING] The POM for com.fasterxml.jackson.core:jackson-annotations:jar:1.9.10 is missing, no dependency information available
[WARNING] The POM for com.fasterxml.jackson.core:jackson-core:jar:1.9.10 is missing, no dependency information available
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SpreadSheetUploadWeb ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 22 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # SpreadSheetUploadWeb ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SpreadSheetUploadWeb ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # SpreadSheetUploadWeb ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # SpreadSheetUploadWeb ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
My pom.xml has jar specified, and my test case is in:
c:/SpreadSheetUploadWeb/src/test/java/com/ibm/cio/cloud/cost/spreadsheet/dao/UnitTestJdbcCostSpreadsheetDAO.java
It works perfectly when I run test explicitly like this:
mvn surefire:test -Dtest=UnitTestJdbcCostSpreadsheetDAO.java
Why won't it run when I just run: mvn test ?
By default surefire search for files following this patterns:
**/Test*.java
**/*Test.java
**/*Tests.java
**/*TestCase.java
http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

Maven don't execute junit test

I'm trying to test this project: https://github.com/deglans/jenktest
but maven say that:
$ mvn clean install
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] jenktest
[INFO] hello
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jenktest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # jenktest ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # jenktest ---
[INFO] Installing /documenti/deglans/Programs/IdeaProjects/jenktest/pom.xml to /home/deglans/.m2/repository/io/github/deglans/jenktest/0.0.1-SNAPSHOT/jenktest-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hello 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # hello ---
[INFO] Deleting /documenti/deglans/Programs/IdeaProjects/jenktest/hello/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /documenti/deglans/Programs/IdeaProjects/jenktest/hello/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /documenti/deglans/Programs/IdeaProjects/jenktest/hello/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /documenti/deglans/Programs/IdeaProjects/jenktest/hello/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # hello ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # hello ---
[INFO] Building jar: /documenti/deglans/Programs/IdeaProjects/jenktest/hello/target/hello-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # hello ---
[INFO] Installing /documenti/deglans/Programs/IdeaProjects/jenktest/hello/target/hello-0.0.1-SNAPSHOT.jar to /home/deglans/.m2/repository/io/github/deglans/hello/0.0.1-SNAPSHOT/hello-0.0.1-SNAPSHOT.jar
[INFO] Installing /documenti/deglans/Programs/IdeaProjects/jenktest/hello/pom.xml to /home/deglans/.m2/repository/io/github/deglans/hello/0.0.1-SNAPSHOT/hello-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] jenktest ........................................... SUCCESS [ 0.449 s]
[INFO] hello .............................................. SUCCESS [ 1.715 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.360 s
[INFO] Finished at: 2017-12-16T11:41:59+01:00
[INFO] Final Memory: 14M/48M
[INFO] ------------------------------------------------------------------------
What is the warning and why maven completely skip the test phase?
The final purpose of this work is to test email jenkins feature, but for now I'm blocked by this problem...
Thanks
Summary
You need to either rename GreetingTests.java to GreetingTest.java, or update your maven-surefire-plugin. Updating surefire plugin can provide better pattern for inclusions of tests. You can declare it in project's parent POM ./pom.xml:
<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">
<!-- ... -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Detail
What is the warning and why maven completely skip the test phase?
Maven didn't skip the test phase. Maven unit tests are executed by maven-surefire-plugin, and it has been triggered correctly:
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # hello ---
You need to rename your test to GreetingTests.java to GreetingTest.java. Because the surefire-plugin:2.12.4 does not recognize pattern *Tests.java, as documented here:
By default, the plugin will automatically include all test classes with the following wildcard patterns:
"**/Test*.java" - includes all of its subdirectories and all java
filenames that start with "Test".
"**/*Test.java" - includes all of its subdirectories and all java
filenames that end with "Test".
"**/*TestCase.java" - includes all of its subdirectories and all java
filenames that end with "TestCase".

Can't get 'mvn test' run the tests

For some reason I don't know, sometimes, when I create a new Test project (I use IntelliJ + Maven module), I use the same pom file with some plugins which currently works in another projects, but then when I run the command line
mvn test
it doesn't run the JUnit test methods I have written. And I don't know what's wrong, it says:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building n26 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # n26 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # n26 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # n26 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Automation\NewHomePage\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # n26 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Automation\NewHomePage\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # n26 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.713 s
[INFO] Finished at: 2015-09-24T13:02:50+02:00
[INFO] Final Memory: 19M/306M
[INFO] ------------------------------------------------------------------------
Normally, it will execute tests afterwards, but sometimes it stops here.
#wemu thanks, I named my file was xxxTests.java, and the naming convention is xxxTest.java. It works, thanks

How to avoid duplicate forking when generating aggregated javadoc in a multimodule project

I am trying to configure a Maven multimodule project to produce a distribution zip via the assembly plugin, which should include aggregated javadoc for all submodules in the project.
The project structure is (simplified, in reality there's about 20 modules):
Project X Core
+- pom.xml (1)
+- module-A
| +- pom.xml (2)
+-module-B
| +- pom.xml (3)
+-assembly
+- pom.xml (4)
where assembly is the submodule that produces the distribution zip. The root pom lists all submodules as modules, each submodule's pom has, in turn, the root pom as its parent. The assembly plugin is bound to the package phase. All of this works fine.
The problem occurs when I try to create aggregated javadoc (not javadoc jars, but a directory with html), to include in the assembly. To achieve this, I have configured the maven-javadoc-plugin as a build plugin in the root pom, as follows:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>1.6</source>
<encoding>utf8</encoding>
<quiet>true</quiet>
<links>
<link>http://docs.oracle.com/javase/6/docs/api/</link>
</links>
</configuration>
<executions>
<execution>
<id>create-javadoc</id>
<phase>package</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
In addition, I have configured my assembly descriptor, in the assembly submodule, to include a fileSet with the javadocs, picked from the target dir of its parent project:
<fileSet>
<directory>../target/site/apidocs</directory>
<outputDirectory>docs/apidocs</outputDirectory>
</fileSet>
The problem I face with this setup is this: I see the following output when running mvn package:
[INFO] Reactor Build Order:
[INFO]
[INFO] Project X Core
[INFO] Project X: module A
[INFO] Project X: module B
[INFO] Project X: assembly
[INFO] ------------------------------------------------------------------------
[INFO] Building Project X Core 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-core ---
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.13:check (default) # projectX-core ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java16:1.0
[INFO]
[INFO] >>> maven-javadoc-plugin:2.10.1:aggregate (create-javadoc) > generate-sources # projectX-core >>>
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X Core 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-core ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X: module A 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-modA ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X: module B 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-modB ---
Downloading: https://example.org/repositories/snapshots/org/example/project/projectX-modB/1.0.0-SNAPSHOT/modB-1.0.0-20141121.022310-7.jar
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X: Assembly 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Downloading: https://example.org/repositories/snapshots/org/example/project/projectX-modC/1.0.0-SNAPSHOT/maven-metadata.xml
2/2 KB
(snip for brevity)
[INFO] ------------------------------------------------------------------------
[INFO] Building Project X: module A 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-modA ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # projectX-modA ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jeen/Projects/projectX/modA/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # projectX-modA ---
[INFO] Compiling 52 source files to /Users/jeen/Projects/projectX/modA/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # projectX-modA ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jeen/Projects/projectX/modA/util/src/test/resources
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) # projectX-modA ---
[INFO] Building jar: /Users/jeen/Projects/projectX/modA/target/modA-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] >>> maven-javadoc-plugin:2.10.1:aggregate (create-javadoc) > generate-sources # projectX-modA >>>
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X Core 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-core ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X Module A 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # projectX-modA ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking ProjectX Module B 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.....
This is just a snippet, but these "Forking" messages are repeated a great number of times for each submodule (in fact, in reality about 60 times per module). This worries me: it looks as if there is an awful lot of duplicate work going on. A second thing that worries me is that it apparently downloads remote snapshots of artifacts that are part of the current reactor (see the 'Downloading' messages in the snippet above). I should point out that despite all these duplicate messages, the goal is achieved: the aggregate javadoc is produced, and is included in the assembly.
So, the question is really: what (if anything) am I doing wrong? Should I just ignore these repeating "Forking" messages and the snapshot downloads, or are they an indication of an incorrect setup? If the latter, does anybody have an idea how I should tweak the setup to get this to work correctly?
FWIW I have already tried several alternative configurations, including moving the javadoc plugin config to the assembly submodule, but none of it gave me the expected results.
I've tried to keep it brief and to the point, if additional info is needed let me know.
Running Maven 3.2.3, by the way.
I seem to have found the answer to my own question.
The problem is in the javadoc plugin configuration. Because the plugin is in the aggregator project's build section, it gets inherited by the submodules (which then each execute it in turn, apparently).
Simply making sure the plugin does not get inherited fixed the issue:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<inherited>false</inherited>
...

Resources