MavenJppTesting

Differences between revisions 1 and 2
Revision 1 as of 2008-09-04 13:57:35
Size: 1775
Editor: lns-bzn-48f-81-56-218-246
Comment:
Revision 2 as of 2008-09-04 14:59:08
Size: 10637
Editor: lns-bzn-48f-81-56-218-246
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Testing Maven with the JPP patchset = == Testing Maven with the JPP patchset ==
Line 4: Line 4:
We are trying to do a minimal proof-of-concept for the maven-jpp design alternative presented in [[https://wiki.ubuntu.com/JavaTeam/Specs/MavenSupportSpec|MavenSupportSpec]].
Line 5: Line 6:
Install the modified maven on an up-to-date intrepid machine :
 *
Add "deb http://ppa.launchpad.net/ubuntu-java/ubuntu intrepid main" to your /etc/apt/sources.list
 * sudo apt-get update
 * sudo apt-get install default-jdk maven2
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
}}}
Line 10: Line 12:
Create a helloWorld maven2 project
 * $ mvn archetype:create -DgroupId=com.mycompany.test -DartifactId=helloWorld
 * $ rm -rf .m2
 * $ cd helloWorld/
Create a helloWorld maven2 project:
{{{
$ mvn archetype:create -DgroupId=com.mycompany.test -DartifactId=helloWorld
}}}
Line 15: Line 17:
The JPP-ized maven2 will lack a few files (that can be brought by separate packages or as additions to existing packages).
 * wget http://people.ubuntu.com/~koon/maven-jpp-addons.tar.gz
 * tar zxf maven-jpp-addons.tar.gz
 * cd maven-jpp-addons
 * sudo cp etc/maven2/maven2-versionless-depmap.xml /etc/maven2
 * sudo cp -r usr/share/maven2/plugins /usr/share/maven2
 * sudo cp -r 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
Don't cheat, remove the resulting .m2 directory:
{{{
$ rm -rf .m2
}}}
Line 25: Line 22:
Then you can try to build the project offline:
 * sudo apt-get install libplexus-compiler-api-java libplexus-compiler-javac-java libplexus-compiler-manager-java junit
 * mvn -Dmaven2.offline.mode -Dmaven2.ignore.versions -Dmaven2.usejppjars compile
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)
Line 31: Line 46:
{{{
Line 33: Line 49:
}}}
Line 34: Line 51:
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
}}}
Line 35: Line 140:

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.

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

Help 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)