Maven classpath isolation

I remember some issues I had with maven about classpath due to classpath isolation.
For exemple if you try to use stax in unit test, you could be disturbed because maven already use it.

Maven 3.x should fix this kind of problems but it doesn’t look like changes effective at compile time yet.
You still can get this issue using velocity 1.7 with an annotation processor and run this processor through unit test compiling.

The output is :

Caused by: org.apache.velocity.exception.VelocityException: The specified logger class org.apache.velocity.runtime.log.CommonsLogLogChute does not implement the org.apache.velocity.runtime.log.LogChute interface.
	at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:181)
	... 46 more

Got from maven 3.0.3 compiling :

┌─[defrancea@~/eXo/wikbook-annotations/template]
└─>mvn --version
Listening for transport dt_socket at address: 5005
Apache Maven 3.0.3 (r1075438; 2011-03-01 00:31:09+0700)
Maven home: /usr/share/maven
Java version: 1.6.0_26, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.8", arch: "x86_64", family: "mac"

Actually maven 3.0.3 use velocity 1.5 and some refactoring was done since this version on the API.
You can either use velocity 1.5 or use another template engine. My choice was to use freemarker (sorry velocity guys).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s