You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bhavesh K Shah <Bh...@bitwiseglobal.com> on 2015/11/03 23:15:31 UTC

What is the best way to get the single jar and pom.xml from multiple maven modules?

Hi,

I have 4 maven modules A, B, C, D which are interdependent. The project D is dependent on C and C in turn is dependent on A & B. I have written pom.xml for all projects accordingly.

My end goal is to generate single jar out of this 4 modules and corresponding single pom.xml. The jar should contain java classes from only my module and not the classes from all their dependencies.

I was able to create the single jar using maven-shade plugin in project D's pom.xml. I used shadedGroupFilter tag to include the classes from just my modules. However, I was not able to create the correct pom.xml.

For generating single pom.xml I have tried using createDependencyReducedPom tag to generate a simplified POM for the shaded artifact but it contains the dependencies of just project D and not all the other projects viz. C, B, A.

What is the best way to get the correct single pom.xml?

I have posted this same question on stackoverflow<http://stackoverflow.com/questions/33509980/what-is-the-best-way-to-get-the-single-jar-and-pom-xml-from-multiple-maven-modul>.



-Bhavesh

**************************************Disclaimer****************************************** This e-mail message and any attachments may contain confidential information and is for the sole use of the intended recipient(s) only. Any views or opinions presented or implied are solely those of the author and do not necessarily represent the views of BitWise. If you are not the intended recipient(s), you are hereby notified that disclosure, printing, copying, forwarding, distribution, or the taking of any action whatsoever in reliance on the contents of this electronic information is strictly prohibited. If you have received this e-mail message in error, please immediately notify the sender and delete the electronic message and any attachments.BitWise does not accept liability for any virus introduced by this e-mail or any attachments. ********************************************************************************************

RE: What is the best way to get the single jar and pom.xml from multiple maven modules?

Posted by Robert Patrick <ro...@oracle.com>.
Add module E that generates the JAR and make module E's POM the JAR's POM.  If you want to remove some of the "development" items from the POM, see http://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html 


-----Original Message-----
From: Bhavesh K Shah [mailto:Bhavesh.Shah@bitwiseglobal.com] 
Sent: Tuesday, November 03, 2015 4:16 PM
To: users@maven.apache.org
Subject: What is the best way to get the single jar and pom.xml from multiple maven modules?

Hi,

I have 4 maven modules A, B, C, D which are interdependent. The project D is dependent on C and C in turn is dependent on A & B. I have written pom.xml for all projects accordingly.

My end goal is to generate single jar out of this 4 modules and corresponding single pom.xml. The jar should contain java classes from only my module and not the classes from all their dependencies.

I was able to create the single jar using maven-shade plugin in project D's pom.xml. I used shadedGroupFilter tag to include the classes from just my modules. However, I was not able to create the correct pom.xml.

For generating single pom.xml I have tried using createDependencyReducedPom tag to generate a simplified POM for the shaded artifact but it contains the dependencies of just project D and not all the other projects viz. C, B, A.

What is the best way to get the correct single pom.xml?

I have posted this same question on stackoverflow<http://stackoverflow.com/questions/33509980/what-is-the-best-way-to-get-the-single-jar-and-pom-xml-from-multiple-maven-modul>.



-Bhavesh

**************************************Disclaimer****************************************** This e-mail message and any attachments may contain confidential information and is for the sole use of the intended recipient(s) only. Any views or opinions presented or implied are solely those of the author and do not necessarily represent the views of BitWise. If you are not the intended recipient(s), you are hereby notified that disclosure, printing, copying, forwarding, distribution, or the taking of any action whatsoever in reliance on the contents of this electronic information is strictly prohibited. If you have received this e-mail message in error, please immediately notify the sender and delete the electronic message and any attachments.BitWise does not accept liability for any virus introduced by this e-mail or any attachments. ********************************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org