fornax-oaw-m2-plugin classpath conflicts

已查看 76 次
跳至第一个未读帖子

Ron Smith

未读,
2011年10月11日 12:29:232011/10/11
收件人 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

未读,
2011年10月11日 16:17:072011/10/11
收件人 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

未读,
2011年10月14日 20:01:072011/10/14
收件人 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>
回复全部
回复作者
转发
0 个新帖子