This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven removes classifiers from the dependency jar while deploying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven removes classifiers from the dependency jar while deploying" Watch "Maven removes classifiers from the dependency jar while deploying" New topic
Author

Maven removes classifiers from the dependency jar while deploying

sandeeprajsingh tandon
Ranch Hand

Joined: Mar 06, 2009
Posts: 70
Hi ,
We are using a dependency inside project a called json-lib-2.4-jdk15.jar (contains version and classifer in its pom entry). While deploying the application(a.ear) in server the jar file name gets changed to json-lib-jdk15.jar(contains classifer in its name).
In the jar, a.jar->META-INF->MANIFEST.MF maven names it to
Class-Path: lib/json-lib.jar (no classifer and version)
This difference causes jar naming issue and hence the jar doesnot load in the classpath of the ear.

ANy idea how could i solve this.
We are using the following plugins
<code>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>was6-maven-plugin</artifactId>
<executions>
<execution>
<id>websphere-ejb-deploy</id>
<goals>
<goal>ejbdeploy</goal>
</goals>
</execution>
</executions>
</plugin></code>,


sandeeprajsingh tandon
Ranch Hand

Joined: Mar 06, 2009
Posts: 70
Solved it,
Configured the maven ejb plugin like this, - the dashClassifier now forces the classifer to be appended in the jar and in the ear.
<code> <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<archive>
<manifest>
<customClasspathLayout>lib/${artifact.artifactId}${dashClassifier?}.${artifact.extension}</customClasspathLayout>
<!-- customClasspathLayout>lib/${artifact.artifactId}-$artifact.classifier.${artifact.extension}</customClasspathLayout-->
</manifest>
</archive>
</configuration>
</plugin></code>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Maven removes classifiers from the dependency jar while deploying
 
Similar Threads
Strange problem - works on maven glassfish but not on Tomcat
Tomcat and Axis2
Filtering problem using maven-read-properties plugin in pom.xml file
Unable to create one single jar file in maven with dependencies included inside
java classes not found in WEB-INF in maven build