You must Sign In to post a response.
  • Category: Programming

    Maven software query on parent-child modules


    Have a problem with Maven software? Get quick suggestions from the Ask Expert answers provided to your modules' query.

    Do we have anyone here who is an expert in Maven? I need their suggestions. I will try to explain the problem here.

    I tried many Google-search-based solutions, but it has not helped. So someone who has worked with Maven would be appreciatable.

    Is there any way to call the jars which are generated by the parent module in child module to create the package?

    Parent A
    child1 The jar which is generated by this child I need to pack in child 2 jar.
    child2

    I hope my question is clear, if required I'll try to explain more.
  • Answers

    1 Answers found.
  • I got the solution, I thought I'll share just in case someone faces this in future.

    1. Generate the jar of child 1 jar in the resource of child 2.
    2. Using maven copy resource plugin copy the resources of child 1 into child 2
    3. run mvn compile, it will pack the jars as expected in child 2.

    Cons would be since the jar is not generated in target area while running mvn clean it won't clean the old jar, for that, you will have to set the overwrite tag as true. The above workaround worked for me.


  • Sign In to post your comments