Generate two jar with the same maven project

落花浮王杯 提交于 2019-12-01 07:44:06
Raghuram

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

  • Using profiles
  • By doing two executions of maven jar plugin

Here is the related stackoverflow post as well.

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

mvn -f pom-xxx.xml clean install
mvn -f pom-yyy.xml clean install

In each pom you can specify an own artifactId. That separates both artifacts a bit more than the classifier solution does.

Nevertheless the advice not to do this seems reasonable and I would follow the parent/module project layout suggestion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!