1

The components arrangement:

Component_A - a 3rd party library/API (a set of jars) - Maven source

Component_B1 - my own created API - 1 - depending on Component_A
Component_B2 - my own created API - 2 - depending on Component_A

App_C1 - app - executable jar - depending on Component_B1 App_C2 - app - executable jar - depending on Component_B2

Deployment arrangement requirement (simplified paths for clarity):

Component_A  - deploy to:                                             ...\java\.m2\repository\lib\Component_A\*
Component_B1 - make jar with dependency on Component_A and deploy to: ...\java\.m2\repository\lib\Component_B1\*
Component_B2 - make jar with dependency on Component_A and deploy to: ...\java\.m2\repository\lib\Component_B2\*
App_C1 - make executable jar with dependency on Component_B1 and deploy to: ...\java\apps\Component_C1\*
App_C2 - make executable jar with dependency on Component_B2 and deploy to: ...\java\apps\Component_C1\*

What will be the POM.XML files look like for each of these components so we can at the end execute on command line:

java -jar App_C1.jar

and

java -jar App_C2.jar
JimHawkins
  • 4,843
  • 8
  • 35
  • 55
Felix
  • 213
  • 2
  • 9
  • 1
    Possible duplicate of [What is the maven-shade-plugin used for, and why would you want to relocate java packages?](http://stackoverflow.com/questions/13620281/what-is-the-maven-shade-plugin-used-for-and-why-would-you-want-to-relocate-java) – Alessandro Da Rugna Nov 17 '16 at 09:43
  • 1
    I marked the question as duplicate. If you would like to run your apps with only `java -jar Component_C1.jar` without adding anything to the classpath, you must include all your dependencies in the jar (called Uberjar or Shaded jar). – Alessandro Da Rugna Nov 17 '16 at 09:44
  • Does it mean I have to include in App_C1 dependencies of Component_B1 and Component_A or is there a transient / cascade relationship from Component_A to Component_B1 to App_1 using the maven-shade-plugin? – Felix Nov 17 '16 at 10:01
  • Dependency on * Component_B1* should be sufficient. Transitive dependencies will be automatically added. – Alessandro Da Rugna Nov 17 '16 at 10:05

0 Answers0