MavenJppTesting

Testing Maven with the JPP patchset

This document describes how you can play with Maven-Jpp so far. We are trying to do a minimal proof-of-concept for the maven-jpp design alternative presented in MavenSupportSpec.

Add "deb http://ppa.launchpad.net/ubuntu-java/ubuntu intrepid main" to your /etc/apt/sources.list then install maven2:

$ sudo apt-get update
$ sudo apt-get install default-jdk maven2

Create a helloWorld maven2 project:

$ mvn archetype:create -DgroupId=com.mycompany.test -DartifactId=helloWorld

Don't cheat, remove the resulting .m2 directory:

$ rm -rf .m2

The JPP-ized maven2 will lack a few files (that should be provided by missing separate packages or as additions to existing packages). We'll copy them from a tar file for the time being:

$ wget http://people.ubuntu.com/~koon/maven-jpp-addons.tar.gz
$ tar zxf maven-jpp-addons.tar.gz
$ cd maven-jpp-addons
$ sudo cp maven-jpp-addons/etc/maven2/maven2-versionless-depmap.xml /etc/maven2
$ sudo cp -r maven-jpp-addons/usr/share/maven2/plugins /usr/share/maven2
$ sudo cp -r maven-jpp-addons/usr/share/maven2/default_poms /usr/share/maven2
$ sudo mkdir /usr/share/java/maven2
$ sudo ln -s /usr/share/maven2/default_poms /usr/share/java/maven2/default_poms
$ sudo ln -s /usr/share/maven2/plugins /usr/share/java/maven2/plugins

Then you can try to compile the project in JPP-mode !

$ sudo apt-get install libplexus-compiler-api-java libplexus-compiler-javac-java libplexus-compiler-manager-java junit
$ cd helloWorld/
$ mvn -Dmaven2.offline.mode -Dmaven2.ignore.versions -Dmaven2.usejppjars compile

(the CHECKSUM warnings are normal)

You should get the error I get:

[INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-compiler-plugin:2.1-SNAPSHOT:compile': Unable to find the mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.1-SNAPSHOT:compile' in the plugin 'org.apache.maven.plugins:maven-compiler-plugin' 
Component descriptor cannot be found in the component repository: org.codehaus.plexus.compiler.manager.CompilerManager.

With stack traces on:

$ mvn -e -Dmaven2.offline.mode -Dmaven2.ignore.versions -Dmaven2.usejppjars compile
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building helloWorld
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-project.pom
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-project.pom
[WARNING] Skipping non filebased repository http://repo1.maven.org/maven2 in full offline mode
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-project.pom
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-project.pom
[WARNING] Skipping non filebased repository http://repo1.maven.org/maven2 in full offline mode
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-model.pom
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-model.pom
[WARNING] Skipping non filebased repository http://repo1.maven.org/maven2 in full offline mode
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-model.pom
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-model.pom
[WARNING] Skipping non filebased repository http://repo1.maven.org/maven2 in full offline mode
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-artifact.pom
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-artifact.pom
[WARNING] Skipping non filebased repository http://repo1.maven.org/maven2 in full offline mode
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-artifact.pom
Downloading: file:///usr/share/maven2/repository/JPP/maven2/default_poms/JPP.maven2-artifact.pom
[WARNING] Skipping non filebased repository http://repo1.maven.org/maven2 in full offline mode
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile': Unable to find the mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile' in the plugin 'org.apache.maven.plugins:maven-compiler-plugin'
Component descriptor cannot be found in the component repository: org.codehaus.plexus.compiler.manager.CompilerManager.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile': Unable to find the mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile' in the plugin 'org.apache.maven.plugins:maven-compiler-plugin'
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:562)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to find the mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile' in the plugin 'org.apache.maven.plugins:maven-compiler-plugin'
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:618)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:429)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        ... 16 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Unable to lookup component 'org.apache.maven.plugin.Mojoorg.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile', it could not be started
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:339)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:609)
        ... 18 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLifecycleException: Error starting component
        at org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle(AbstractComponentManager.java:109)
        at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:95)
        at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
        ... 20 more
Caused by: org.codehaus.plexus.personality.plexus.lifecycle.phase.PhaseExecutionException: Error composing component
        at org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:33)
        at org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:101)
        at org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle(AbstractComponentManager.java:105)
        ... 23 more
Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed of field compilerManager in object of type org.apache.maven.plugin.CompilerMojo because the requirement ComponentRequirement{role='org.codehaus.plexus.compiler.manager.CompilerManager', roleHint='null', fieldName='compilerManager'} was missing
        at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:154)
        at org.codehaus.plexus.component.composition.FieldComponentComposer.assembleComponent(FieldComponentComposer.java:73)
        at org.codehaus.plexus.component.composition.DefaultComponentComposerManager.assembleComponent(DefaultComponentComposerManager.java:68)
        at org.codehaus.plexus.DefaultPlexusContainer.composeComponent(DefaultPlexusContainer.java:1486)
        at org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:29)
        ... 25 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Component descriptor cannot be found in the component repository: org.codehaus.plexus.compiler.manager.CompilerManager.
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:323)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:312)
        at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:129)
        ... 29 more

Suggestions

Robilad: Google points to https://www.zarb.org/pipermail/jpackage-discuss/2008-April/012424.html It seems that maven has some problems with use of SNAPSHOT jars that point in that direction, too: http://techpolesen.blogspot.com/2007/06/work-around-to-unable-to-find-mojo.html

Deepak Bhole: It does look like an error with registration, either due to a bug in the patch, or an incorrect descriptor in the compiler manager jar.

Help is welcome !

Feel free to continue that wiki page if you find a solution. The final goal is to build completely that helloWorld project in a mode that allows it to be used on a buildd.

JavaTeam/MavenJppTesting (last edited 2008-09-05 14:22:06 by lns-bzn-48f-81-56-218-246)