Creating a new phase - maven

I am working on a project using Maven for which I need two new phases: 'analyze' and 'eval' (for different phases of data analysis). I've read all the docs I can find, and created versions of components.xml and lifecycle.xml that are as close as I can get to correct, but Maven refuses to run the new phases. (I should emphasize that I have no problem getting my plugins to work, and no problem binding them to the existing phases provided by the default lifecycle. My problem is that the new phases I create seem to be ignored by maven.) What do I need to do to get my new phases to work?
lifecycles.xml:
<lifecycles>
<lifecycle>
<id>lenskit</id>
<phases>
<phase>
<id>analyze</id>
<executions>
<execution>
<goals>
<goal>greet</goal>
</goals>
</execution>
</executions>
</phase>
<phase>
<id>validate</id>
<executions>
<execution>
<goals>
<goal>greet</goal>
</goals>
</execution>
</executions>
</phase>
</phases>
</lifecycle>
</lifecycles>
components.xml:
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>lenskit</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
<configuration>
<id>lenskit</id>
<phases>
<phase>get-data</phase>
<phase>analyze</phase>
<phase>eval</phase>
</phases>
<default-phases>
<verify> org.apache.maven.plugins:maven-resources-plugin:resources </verify>
<get-data> org.riedl:hello-lenskit-plugin:greet </get-data>
<analyze> org.riedl:hello-lenskit-plugin:greet </analyze>
<eval> org.riedl:hello-lenskit-plugin:greet </eval>
<package> org.riedl:hello-lenskit-plugin:greet </package>
</default-phases>
</configuration>
</component>
</components>
</component-set>

One of the wizards on the Maven mailing list pointed me to a complete working example that does exactly what I wanted: it creates a custom lifecycle with phases named whatever you want, and lets you use that lifecycle from the maven command-line. The example is at:
https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-scm-publish-plugin
The key missing insight is that the components.xml file must have both a LifecycleMapping component and a Lifecycle component. The correct, working components.xml is below.
Note that you may only define an additional lifecycle (i.e. additional to the three default lifecycles: the build, clean and site lifecycles). The original lifecycles and their phases will always be present and you cannot include any phases with names that match an existing lifecycle in your new lifecycle, which is too bad, since it makes it more awkward to redefine a complete lifecycle for a project. Still, this is a nice step forward.
Also, remember that when you use the new lifecycle, you must mark it as an extension:
<extensions>true</extensions>
so the plugin is allowed to redefine the lifecycle. To indicate that your pom.xml should use the new lifecycle, include the lifecycle name as the "packaging" for your project.
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>lenskit</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
</component>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>lenskit</role-hint>
<configuration>
<id>lenskit</id>
<phases>
<phase>get-data</phase>
<phase>analyze</phase>
<phase>eval</phase>
</phases>
<default-phases>
<get-data>org.riedl:hello-lenskit-plugin:greet</get-data>
<analyze>org.riedl:hello-lenskit-plugin:greet</analyze>
<eval>org.riedl:hello-lenskit-plugin:greet</eval>
</default-phases>
</configuration>
</component>
</components>
</component-set>

There are a number of bugs in Maven that interfer with John's approach:
The following should actually be part of John's answer but my edits were confused with commenting about his approach rather than highlighting the current limitations of the approach... so here they are as a second answer :rolleyes:
This requires Maven 3.0 or newer to work. When you try to use this in Maven 2.x you will get a error such as:
$ mvn eval
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task 'eval': you must specify a valid lifecycle phase, or a goal
in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Sep 18 15:58:12 IST 2012
[INFO] Final Memory: 2M/81M
[INFO] ------------------------------------------------------------------------
At least as of Maven 3.0.4 it does not list these phases in the help text when you invoke Maven without a goal or phase:
$ mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.224s
[INFO] Finished at: Tue Sep 18 16:03:20 IST 2012
[INFO] Final Memory: 2M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid
lifecycle phase or a goal in the format <plugin-prefix>:<goal> or
<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available
lifecycle phases are: validate, initialize, generate-sources, process-sources,
generate-resources, process-resources, compile, process-classes,
generate-test-sources, process-test-sources, generate-test-resources,
process-test-resources, test-compile, process-test-classes, test,
prepare-package, package, pre-integration-test, integration-test,
post-integration-test, verify, install, deploy, pre-clean, clean, post-clean,
pre-site, site, post-site, site-deploy. -> [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/NoGoalSpecifiedException
In a multi-module build you can end up screwed.
Consider the following two extenions modules:
Extension 1
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>fancy</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
</component>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>fancy</role-hint>
<configuration>
<id>fancy</id>
<phases>
<phase>fancy</phase>
</phases>
<default-phases>
<fancy>org.codehaus.mojo:rpm-maven-plugin:version</fancy>
</default-phases>
</configuration>
</configuration>
</component>
</components>
</component-set>
Extension 2
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>poncy</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
</component>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>poncy</role-hint>
<configuration>
<id>poncy</id>
<phases>
<phase>poncy</phase>
<phase>fancy</phase>
</phases>
<default-phases>
<poncy>org.apache.maven.plugins:maven-enforcer-plugin:display-info</poncy>
<fancy>org.codehaus.mojo:build-helper-maven-plugin:parse-version</fancy>
</default-phases>
</configuration>
</component>
</components>
</component-set>
Parent 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localdomain.localhost</groupId>
<artifactId>fancy-lifecycle-parent</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>poncy-test</module>
<module>fancy-test</module>
</modules>
</project>
Fancy-test 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localdomain.localhost</groupId>
<artifactId>fancy-test</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>fancy</packaging>
<build>
<extensions>
<extension>
<groupId>localdomain.localhost</groupId>
<artifactId>fancy-lifecycle</artifactId>
<version>0.1-SNAPSHOT</version>
</extension>
</extensions>
</build>
</project>
Poncy-test 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localdomain.localhost</groupId>
<artifactId>poncy-test</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>poncy</packaging>
<build>
<extensions>
<extension>
<groupId>localdomain.localhost</groupId>
<artifactId>poncy-lifecycle</artifactId>
<version>0.1-SNAPSHOT</version>
</extension>
</extensions>
</build>
</project>
Some tests
$ mvn -f pom.xml fancy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] poncy-test
[INFO] fancy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (default-parse-version) # poncy-test ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- rpm-maven-plugin:2.1-alpha-2:version (default-version) # fancy-test ---
[WARNING] rpm version string truncated to 0.1
[INFO] setting [rpm.version] property to value [0.1].
[INFO] setting [rpm.release] property to value [SNAPSHOT20120918152051].
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-lifecycle-parent 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] poncy-test ........................................ SUCCESS [0.727s]
[INFO] fancy-test ........................................ SUCCESS [0.196s]
[INFO] fancy-lifecycle-parent ............................ SUCCESS [0.001s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.152s
[INFO] Finished at: Tue Sep 18 16:20:51 IST 2012
[INFO] Final Memory: 4M/81M
[INFO] ------------------------------------------------------------------------
This first test is from the parent pom and everything builds just fine. Notice that the two phases (poncy and fancy's executions are invoked for the poncy-test module but only one phase (fancy) is invoked for the fancy-test module, as you would expect.
Now try the same only with the poncy phase
$ mvn poncy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] poncy-test
[INFO] fancy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] poncy-test ........................................ SUCCESS [0.588s]
[INFO] fancy-test ........................................ FAILURE [0.033s]
[INFO] fancy-lifecycle-parent ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.853s
[INFO] Finished at: Tue Sep 18 16:23:27 IST 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "poncy". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, fancy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
Notice that we now have a build failure because the phase is unknown for the fancy-test module.
If we build the parent and poncy-test explicitly all works just fine:
$ mvn poncy -pl :fancy-lifecycle-parent,:poncy-test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] poncy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-lifecycle-parent 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] poncy-test ........................................ SUCCESS [5.247s]
[INFO] fancy-lifecycle-parent ............................ SUCCESS [0.001s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.488s
[INFO] Finished at: Tue Sep 18 16:24:45 IST 2012
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
And finally, on a positive note, if we add a jar packaging module without the extension defined into the mix, all hell does not break loose:
$ mvn fancy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] jar-test
[INFO] poncy-test
[INFO] fancy-test
[INFO] fancy-lifecycle-parent
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jar-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building poncy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.1.1:display-info (default-display-info) # poncy-test ---
[INFO] Maven Version: 3.0.4
[INFO] JDK Version: 1.6.0_35 normalized as: 1.6.0-35
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.8.1
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (default-parse-version) # poncy-test ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- rpm-maven-plugin:2.1-alpha-2:version (default-version) # fancy-test ---
[WARNING] rpm version string truncated to 0.1
[INFO] setting [rpm.version] property to value [0.1].
[INFO] setting [rpm.release] property to value [SNAPSHOT20120918152733].
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fancy-lifecycle-parent 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] jar-test .......................................... SUCCESS [0.001s]
[INFO] poncy-test ........................................ SUCCESS [0.809s]
[INFO] fancy-test ........................................ SUCCESS [0.198s]
[INFO] fancy-lifecycle-parent ............................ SUCCESS [0.001s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.244s
[INFO] Finished at: Tue Sep 18 16:27:33 IST 2012
[INFO] Final Memory: 4M/81M
[INFO] ------------------------------------------------------------------------

Related

Problem getting maven plugin from jfrog artifactory

I'm trying to get an old maven project connected to private artifactory to download plugins when building. I'm sitting in a coporate network (using vpn), using a jfrog artifactory.
"mvn clean install -U" returns:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProjektYXZ - parent POM [pom]
[INFO] ProjektYXZ - main POM [pom]
[INFO]
[INFO] ---------------------< com.*:mvn-project >----------------------
[INFO] Building ProjektYXZ - parent POM 1.14.0-SNAPSHOT [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mvn-project ---
[INFO] Deleting **mvn-project\target
[INFO]
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources # mvn-project >>>
[INFO]
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) < generate-sources # mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) # mvn-project ---
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) # mvn-project ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-checkstyle-plugin:3.0.0:check (default) # mvn-project ---
[INFO]
[INFO] >>> spotbugs-maven-plugin:3.1.11:check (default) > :spotbugs # mvn-project >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:spotbugs (spotbugs) # mvn-project ---
[INFO]
[INFO] <<< spotbugs-maven-plugin:3.1.11:check (default) < :spotbugs # mvn-project <<<
[INFO]
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:check (default) # mvn-project ---
[INFO]
[INFO] >>> maven-pmd-plugin:3.11.0:check (default) > :pmd # mvn-project >>>
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:pmd (pmd) # mvn-project ---
[INFO]
[INFO] <<< maven-pmd-plugin:3.11.0:check (default) < :pmd # mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:check (default) # mvn-project ---
[INFO]
[INFO] --- plugin:1.4.1:enforce (default) # mvn-project ---
Downloading from central-mirror: https://artifactory.*.de/artifactory/maven/**/*-1.0.2.pom
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
[WARNING] The POM for com.**:jar:1.0.2 is missing, no dependency information available
Downloading from central-mirror: https://artifactory.**.de/artifactory/maven/**/*-1.0.2.jar
Downloading from company-releases: https://artifactory.**.de/artifactory/**/*-1.0.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ProjektYXZ - main POM 1.14.0-SNAPSHOT:
[INFO]
[INFO] ProjektYXZ - parent POM .................................. FAILURE [ 7.645 s]
[INFO] ProjektYXZ - main POM .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.826 s
[INFO] Finished at: 2022-04-12T10:18:02+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:plugin:1.4.1:enforce (default) on project mvn-project: Execution default of goal org.apache.maven.plugins:plugin:1.4.1:enforce failed: Plugin org.apache.maven.plugins:plugin:1.4.1 or one of its dependencies could not be resolved: Could not find artifact com.**:jar:1.0.2 in central-mirror (https://artifactory.**.de/artifactory/maven) -> [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/PluginResolutionException
in the line:
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
maven looks at the correct place. I'm able to download it with curl:
curl -u username:password -X GET "https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom"
but if I paste that path into Chrome, I get an 404 Error.
I also configured the settings.xml in my C:/Users/Username/.m2/ folder:
<server>
<id>company-releases</id>
<username>my_username</username>
<password>my_password</password>
</server>
I also checked the possible errors of the Link shown at the bottom of the log, but as I'm able to "curl" it these don't seem to be the reasons. Currently I'm out of ideas. I hope you can help me :) Please tell me if you need to see additional sources.
okay, the solution was to set preemptive authentification in settings.xml:
for example:
<server>
<username>*****</username>
<password>*****</password>
<id>central</id>
<configuration>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
Explanation: maven first tries to request without authentification. If the Repo is private (this means that without authentification, artifacts are hidden), jfrog artifactory responses with 404 instead of unauthenticated. After 404 maven doesn't try again, but sees it as failed.
For more details see: https://jfrog.com/knowledge-base/why-does-my-maven-builds-are-failing-with-a-404-error-when-hide-existence-of-unauthorized-resources-is-enabled/

A simple example about Maven from a textbook

I am using Apache Maven 3.6.0.
I'm studying a book on Maven, namely this one:
https://books.sonatype.com/mvnex-book/pdf/mvnex-pdf.pdf. Page 7 / 155.
We are given a Sample Maven pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>my-project</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
Then it is written that we should run:
mvn install
I tried, it is OK. Target directory is created.
Then it is written: "Without modification, you can run mvn site".
I did that and get this: https://pastebin.com/9Zrmws9T
Well, it seems that something has to do with maven-site-plugin. But I don't know what this means for me, or whether the book is worth reading, given that it turns such somersaults at the very beginning.
Can I fix this problem with Maven?
Best way to learn maven is to start.
Let maven create an example project from an archetype:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=RELEASE
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-sources # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.0:generate (default-cli) < generate-sources # standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.0:generate (default-cli) # standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.4] found in catalog remote
Define value for property 'groupId': com.essexboy
Define value for property 'artifactId': site-example
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.essexboy: :
Confirm properties configuration:
groupId: com.essexboy
artifactId: site-example
version: 1.0-SNAPSHOT
package: com.essexboy
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: maven-archetype-quickstart:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.essexboy
[INFO] Parameter: artifactId, Value: site-example
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.essexboy
[INFO] Parameter: packageInPathFormat, Value: com/essexboy
[INFO] Parameter: package, Value: com.essexboy
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.essexboy
[INFO] Parameter: artifactId, Value: site-example
[INFO] Project created from Archetype in dir: /home/greg/work/site-example
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.041 s
[INFO] Finished at: 2020-09-30T11:40:30+01:00
[INFO] ------------------------------------------------------------------------
Change directory into your new project where you'll have a pom and some code.
greg#greg-XPS-13-9360:~/work$ cd site-example/
Run the site command
greg#greg-XPS-13-9360:~/work/site-example$ mvn site
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.essexboy:site-example >----------------------
[INFO] Building site-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.7.1:site (default-site) # site-example ---
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:3.0.0
[INFO] 15 reports detected for maven-project-info-reports-plugin:3.0.0: ci-management, dependencies, dependency-info, dependency-management, distribution-management, index, issue-management, licenses, mailing-lists, modules, plugin-management, plugins, scm, summary, team
[INFO] Rendering site with default locale English (en)
[INFO] Relativizing decoration links with respect to localized project URL: http://www.example.com
[INFO] Rendering content with org.apache.maven.skins:maven-default-skin:jar:1.2 skin.
[INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin:3.0.0:dependencies
[INFO] Generating "Dependency Information" report --- maven-project-info-reports-plugin:3.0.0:dependency-info
[INFO] Generating "About" report --- maven-project-info-reports-plugin:3.0.0:index
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.0.0:plugin-management
[INFO] Generating "Plugins" report --- maven-project-info-reports-plugin:3.0.0:plugins
[INFO] Generating "Summary" report --- maven-project-info-reports-plugin:3.0.0:summary
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.829 s
[INFO] Finished at: 2020-09-30T11:40:46+01:00
[INFO] ------------------------------------------------------------------------
Your site will be generated under target/site. You can open the index.html in a browser:
Yes, the example from the book didn't seem to work for me either.
However, after I added the following build/plugins section into the pom.xml, mvn site started to work for me:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</build>
Please, also take a look at this answer here:
maven-site plugins 3.3 java.lang.ClassNotFoundException: org.apache.maven.doxia.siterenderer.DocumentContent

Maven Dependency Issue: Could not resolve dependencies for project

I'm having an issue with the github CLIFF repository building a Tomcat .war.
https://github.com/c4fcm/CLIFF
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ mvn -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00)
Maven home: /Users/davidlaxer/Downloads/apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
David-Laxers-MacBook-Pro:CLIFF davidlaxer$
The project builds (e.g. - mvn package) in the CLIFF parent:
E.g.
[INFO] Reactor Summary:
[INFO]
[INFO] CLIFF ............................................. SUCCESS [ 0.003 s]
[INFO] common ............................................ SUCCESS [ 2.854 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [01:21 min]
[INFO] cliff ............................................. SUCCESS [ 18.804 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ----------------------------------------------------------------
It gets a dependency error in the child:
e.g stanford-entity-extractor:
[WARNING] The POM for org.mediameter:common:jar:2.3.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ----------------------------------------------------------------
[ERROR] Failed to execute goal on project stanford-entity-extractor: Could not resolve dependencies for project org.mediameter:stanford-entity-extractor:jar:2.3.0: Could not find artifact org.mediameter:common:jar:2.3.0 in central (http://repo.maven.apache.org/maven2) -> [Help 1
David-Laxers-MacBook-Pro: davidlaxer$ ls -l ~/.m2/repository/org/mediameter/stanford-entity-extractor/2.3.0/
total 16
-rw-r--r-- 1 davidlaxer staff 242 Aug 24 10:28 stanford-entity-extractor-2.3.0.jar.lastUpdated
-rw-r--r-- 1 davidlaxer staff 242 Aug 24 12:02 stanford-entity-extractor-2.3.0.pom.lastUpdated
I don't see .jar for stanford-entity-extractor:jar:2.3.0 here:
http://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp
or here:
https://search.maven.org/#search%7Cga%7C1%7Cstanford-entity-extractor
Maven then gets an error in the CLIFF parent build building Tomcat:
mvn tomcat7:deploy -DskipTests
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] CLIFF
[INFO] common
[INFO] stanford-entity-extractor
[INFO] cliff
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CLIFF 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF >>>
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # CLIFF ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building common 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # common >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # common ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # common ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # common ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # common ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) # common <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) # common ---
[INFO] Skipping non-war project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stanford-entity-extractor 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) # stanford-entity-extractor >>>
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] CLIFF ............................................. SUCCESS [ 1.716 s]
[INFO] common ............................................ SUCCESS [ 1.870 s]
[INFO] stanford-entity-extractor ......................... FAILURE [ 0.061 s]
[INFO] cliff ............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.184 s
[INFO] Finished at: 2015-08-25T10:05:16-08:00
[INFO] Final Memory: 12M/181M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project stanford-entity-extractor: Could not resolve dependencies for project org.mediameter:stanford-entity-extractor:jar:2.3.0: Failure to find org.mediameter:common:jar:2.3.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :stanford-entity-extractor
D
pom.xml in child:
<?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>CLIFF</artifactId>
<groupId>org.mediameter</groupId>
<version>2.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>stanford-entity-extractor</artifactId>
<dependencies>
<dependency>
<groupId>org.mediameter</groupId>
<artifactId>common</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.bericotech</groupId>
<artifactId>clavin</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>
David-Laxers-MacBook-Pro:stanford-entity-extractor davidlaxer$ mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stanford-entity-extractor 2.3.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/mediameter/common/2.3.0/common-2.3.0.pom
[WARNING] The POM for org.mediameter:common:jar:2.3.0 is missing, no dependency information available
Downloading: http://repo.maven.apache.org/maven2/org/mediameter/common/2.3.0/common-2.3.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.961 s
[INFO] Finished at: 2015-08-26T07:57:53-08:00
[INFO] Final Memory: 8M/167M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project stanford-entity-extractor: Could not resolve dependencies for project org.mediameter:stanford-entity-extractor:jar:2.3.0: Could not find artifact org.mediameter:common:jar:2.3.0 in central (http://repo.maven.apache.org/maven2) -> [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/DependencyResolutionException
David-Laxers-MacBook-Pro:stanford-entity-extractor davidlaxer$
Looks like stanford-entity-extractor and common are submodule jars that aren't available locally or publicly. If you haven't run mvn install their jars will not have been installed in your local repo yet, so they will be unresolvable.

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>
...

why do i need thrift to build flume?

i have downloaded flume from "https://github.com/apache/flume/downloads"..but i am unable to build it..do i need to install thrift first in order to build flume??if so, what is the reson..i am getting following error when i run mvn compile -
mohammad#ubuntu:~/apache-flume-b01a760$ mvn compile
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Flume
[INFO] Flume Core
[INFO] Flume Master Config Web Application
[INFO] Flume Node Web
[INFO] Flume Distribution Project
[INFO] A log4j appender for Flume
[INFO] Flume Hello World Plugin
[INFO] Flume HBase Plugin
[INFO] ------------------------------------------------------------------------
[INFO] Building Flume
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] No goals needed for project - skipping
[INFO] ------------------------------------------------------------------------
[INFO] Building Flume Core
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [antlr3:antlr {execution: default}]
[INFO] ANTLR: Processing source directory /home/mohammad/apache-flume-b01a760/flume-core/src/main/antlr3
ANTLR Parser Generator Version 3.2 Sep 23, 2009 14:05:07
com/cloudera/flume/conf/FlumeDeploy.g
com/cloudera/flume/shell/antlr/FlumeShell.g
[INFO] [antrun:run {execution: generate-version-file}]
[INFO] Executing tasks
main:
[copy] Copying 1 file to /home/mohammad/apache-flume-b01a760/flume-core/target/generated-sources/version/com/cloudera/flume
[INFO] Executed tasks
[INFO] [avro:idl-protocol {execution: default}]
[INFO] [thrift:compile {execution: default}]
[ERROR] thrift failed output:
[ERROR] thrift failed error: /bin/sh: null/bin/thrift: not found
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] thrift did not exit cleanly. Review output for more information.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Mon Jun 04 16:10:47 IST 2012
[INFO] Final Memory: 28M/243M
[INFO] ------------------------------------------------------------------------
Flume has some code generation that utilizes thrift as a transport communications serialization mechanism.
In the flume-core/pom.xml, you can see this:
<plugin>
<groupId>org.apache.thrift.tools</groupId>
<artifactId>maven-thrift-plugin</artifactId>
<version>0.1.10</version>
<configuration>
<thriftExecutable>${thrift.executable}</thriftExecutable>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
You need to install thrift, and then configure the location in the parent pom.xml:
<properties>
<!-- NB: The version of the thrift compiler must match that of the dependency
on the jar file below. -->
<thrift.executable>${env.THRIFT_HOME}/bin/thrift</thrift.executable>
<!-- Set default encoding to UTF-8 to remove maven complaints -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- defaults for flaky test and focused test exclusions -->
<test.exclude.pattern>$</test.exclude.pattern> <!-- junk pattern -->
<test.include.pattern>**/Test*.java</test.include.pattern>
</properties>

Resources