Now let's do it with Maven !
First you use your jar, in Maven, you can to configure it this way:
project/build/plugins/plugin
artifactId maven-jar-plugin
version 2.2
configuration
archive
manifestEntries
Main-Class com.comp.proj.main
Now you would like your jar to contain all the dependencies, then you use the maven-assembly-plugin. But it won't take the configuration set in the jar plugin. You have to reconfigure the exact same main-class again. It is redundant OK, but why should it have a different syntax !?!
project/build/plugins/plugin
artifactId maven-assembly-plugin
configuration
archive
manifest
mainClass com.corial.cosma.apptest.apptest
OK, the point is that there are at least two way to configure the Manifest. Either with a free key/value syntax, with Manifest Entries. Or with the class Manifest which has a mainClass element. So it is up to you to be consistent in your POM and not copy everything found on the net ...
Notes:
- Even if the assembly plugin doesn't explicitly mention it, both plugins depend on the Maven Archiver shared component.
- You could also specify your own manifest file META-INF/MANIFEST.MF.
- There is a Maven Guide to Working with Manifests with few information and no links to the relevant information which is a shae for a "Guide".
No comments:
Post a Comment