fornax-oaw-m2-plugin classpath conflicts

76 views
Skip to first unread message

Ron Smith

unread,
Oct 11, 2011, 12:29:23 PM10/11/11
to Fornax-Platform
I'm encountering classpath conflicts when running the fornax-oaw-m2-
plugin Maven plugin. Specifically, I need to use a specific version
of guice in my project, and the following dependency is being brought
in from the sculptor DSL projects which has some classes conflicting
with guice:
<dependency>
<groupId>p2.osgi.bundle</groupId>
<artifactId>com.google.inject</artifactId>
<version>2.0.0.v201003051000</version>
</dependency>

Is there a way to execute the fornax-oaw-m2-plugin plugin with its own
classpath and not include my entire project classpath, or to be able
to specify some dependencies to be excluded?

Ron

Karsten Thoms

unread,
Oct 11, 2011, 4:17:07 PM10/11/11
to fornax-...@googlegroups.com
No, this is not possible. The classpath is computed by the project dependencies. You need to bring your project to use the other dependency. Check with -X which jars are added to the classpath, the plugin prints them out on debug level.

You could try to add dependencies to the plugin itself
<plugin>
   ...
   <dependencies>
    ...
 </plugin>

I'm not sure if they would be taken.

~Karsten

Ron Smith

unread,
Oct 14, 2011, 8:01:07 PM10/14/11
to Fornax-Platform
Unfortunately the difference is pretty great so I couldn't make my
project use the dependency.

I worked around it by moving the code generation into a separate POM
in the same directory, and invoking it from the regular project POM.
For anyone that needs to do the same:

Make a copy of your project pom (in my case it was the web project) to
codegen-pom.xml.

In your project pom, remove the fornax-oaw-m2-plugin plugin, and add
the following to automatically invoke the code generation POM at the
generate-sources phase:
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.5</version>
<configuration>
<projectsDirectory>${project.dir}</projectsDirectory>
<pom>codegen-pom.xml</pom>
<goals>
<goal>install</goal>
</goals>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

In your codegen-pom.xml, configure the maven-compiler-plugin to skip
compile and add a property to skip tests:

<properties>
<maven.test.skip>true</maven.test.skip>
...
</properties>
...
<plugin>
<artifactId>maven-compiler-plugin</
artifactId>
<configuration>
<excludes>
<exclude>**/*.*</
exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>comp</id>
<phase>compile</phase>
<goals></goals>
<configuration>
<excludes>

<exclude>**/*.*</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Reply all
Reply to author
Forward
0 new messages