views:

967

answers:

1

hi,

I'm trying to add a classpath to the jar generated by the maven-assembly-plugin. The assembly bulids, except the manifest has no classpath. Below is my configuration. Any help would be appreciated. Thanks!

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <executions>
    <execution>
      <id>make-assembly</id>
      <phase>package</phase>
      <goals>
        <goal>assembly</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <descriptors>
      <descriptor>assembly/package.xml</descriptor>
    </descriptors>
    <archive>
      <manifest>
        <mainClass>mymain.Main</mainClass>
        <addClasspath>true</addClasspath>
      </manifest>
    </archive>
  </configuration>
</plugin>
+5  A: 

I see you are using a custom assembly descriptor. But the plugin's documentation page has this to say about the <archive> element:

At this point, only the jar assembly format supports the <archive> configuration element. By definition, directory-based assembly mojos - assembly:directory, assembly:directory-inline, and assembly:directory-single - do not produce a jar-format archive, and therefore do not support the <archive> element.

lindelof
that makes sense. i must have overlooked that. thanks so much.is there a way to generate a manifest in the jar that gets generated by the package phase?
Jeff Storey
Absolutely: http://maven.apache.org/shared/maven-archiver/examples/manifestFile.html
lindelof
nice, thanks. someone else had mentioned using that, but I didn't realize how the two fit together. works great!
Jeff Storey