activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Share <jsh...@opera.com>
Subject Re: Maven assembly with spring
Date Mon, 10 Dec 2007 10:40:00 GMT
Nguyen Kien Trung wrote:
>>
>> Unfortunately when maven creates the jar file including all 
>> dependencies it extracts all of the jar files and then re-packages 
>> them into one. When it does this the 
>> spring.jar:META-INF/spring-schemas gets overwritten by the 
>> activemq-core.jar:META-INF/spring-schemas this causes spring to fail 
>> to locate it's own schema and the spring context fails to initialise 
>> with an xml parsing error.
>>
> 
> AFAIK, default maven assembly doesn't extract dependencies and repackage 
> them with your classes. So you may want to try that instead of 
> jar-with-dependencies
> 
> What i usually do is to configure maven-dependency-plugin to save all 
> dependencies to an outputDirctory, let's say "lib". And then configure 
> assembly.xml to include the "lib" into the output archive. In your case, 
> I would need to configure the manifest to have classpathPrefix "lib/".

Thanks for this, it looks like this has got me most of the way, but it 
seems that using the jar assembly format I cannot see which element I 
can specify the manifest properties in (the jar plugin has the 
<configuration><archive><manifest> nodes).

Have I missed something obvious or do I just need to specify a static 
manifest rather than generating one?

Pasted below relevant pom and assembly.xml

Thanks,

Jon

=== pom.xml ===
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-dependency-plugin</artifactId>
   <executions>
     <execution>
       <id>copy-dependencies</id>
       <phase>package</phase>
       <goals>
         <goal>copy-dependencies</goal>
       </goals>
       <configuration>
         <outputDirectory>
           ${project.build.directory}/lib
         </outputDirectory>
         <overWriteReleases>false</overWriteReleases>
         <overWriteSnapshots>false</overWriteSnapshots>
         <overWriteIfNewer>true</overWriteIfNewer>
       </configuration>
     </execution>
   </executions>
</plugin>
<plugin>
   <artifactId>maven-assembly-plugin</artifactId>
   <configuration>
     <descriptors>
       <descriptor>
         src/main/assembly/server-package.xml
       </descriptor>
     </descriptors>
   </configuration>
   <executions>
     <execution>
       <id>make-assembly</id>
       <phase>package</phase>
       <goals>
         <goal>attached</goal>
       </goals>
     </execution>
   </executions>
</plugin>

=== assembly.xml ===

<assembly>
   <id>dist</id>
   <formats>
     <format>jar</format>
   </formats>
   <includeBaseDirectory>false</includeBaseDirectory>
   <fileSets>
     <fileSet>
       <directory>target/classes</directory>
       <outputDirectory></outputDirectory>
     </fileSet>
     <fileSet>
       <directory>target/lib</directory>
       <outputDirectory>lib</outputDirectory>
     </fileSet>
   </fileSets>
</assembly>

Mime
View raw message