I would like to generate two jars from the same maven project when executing a mvn clean install. The only difference between the two jars, will be the content of the META-INF folder.
For the moment, I've my-app.jar, I would like to have now my-jar-xxx.jar and my-jar-yyy.jar. How can I achieve this ?
Regards.
First of all +1 for Raghuram recommendation. In his linked sonatype blog you get hints about doing what you want using the
classifier
to distinguish between your two jars. The jars belong to the same artifact in this case.You can also use two different poms for two different builds and call
In each pom you can specify an own
artifactId
. That separates both artifacts a bit more than theclassifier
solution does.Nevertheless the advice not to do this seems reasonable and I would follow the parent/module project layout suggestion.
You should not be creating two maven jars from the same maven project. Why? This sonatype blog post should explain.
The same article also explains two ways in which you can still do it, if you want to
Here is the related stackoverflow post as well.