Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6876241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:27:10+00:00 2026-05-27T04:27:10+00:00

I have a maven project with quite a few submodules. What I am looking

  • 0

I have a maven project with quite a few submodules. What I am looking for is a way to get all the .jar files produced by the sub-modules included in the aggregating POM’s /target/ directory, so they can be conveniently used afterwards.

  • They don’t need to be merged. Preferably not, but if they must be then that is ok.
  • Don’t care about dependancies
  • This is primarily for convenience, at this point

A basic version of what I am looking at doing:

Prj1/pom.xml  =>  prj1/target/proj1.jar  (and classes/generated-sources/etc)
Prj2/pom.xml  =>  prj2/target/proj2.jar
Main/pom.xml  =>
                  main/target/proj1.jar
                  main/target/proj2.jar
                  ... classes/generated-sources not needed at all,
                  ... but they could be combined here.  I assume they will be

I’ve been reading, and using some suggestions from SO as well. So far I haven’t found a way to do this, but I’m sure it is there.

edit:

I’ve given up on getting this to work in a simple way, for all included subprojets. The best answer I have so far is using the dependancy plugin to manually specify (again), each and every sub-module to be included. The idea was to be able to configure the POMs easily for the dozens of clients, simply including the modules necessary and then having it magically stick all the sub-modules’s jars in one location. Maven is pretty nice, when you don’t do much with it, but the angle bracket tax is incredible when you try.

I still find it odd that such standard-seeming tasks (judging from the questions asked on SO, and what any normal project would do) are so difficult. Is maven3 better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:27:11+00:00Added an answer on May 27, 2026 at 4:27 am

    You could try the maven-dependency-plugin:copy plugin:goal.

    You will have to add this to the pom of all submodules that you want to copy.
    EDIT: Or just in the parent pom (see comments).

        <build>
            <plugins>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <executions>
                    <execution>             
                      <id>copy-artifact</id>
                      <phase>package</phase>
                      <goals>
                        <goal>copy</goal>
                      </goals>
                      <configuration>
                        <artifactItems>
                            <artifactItem>
                              <groupId>${project.groupId}</groupId>
                              <artifactId>${project.artifactId}</artifactId>
                              <version>${project.version}</version>
                              <type>${project.packaging}</type>
                            </artifactItem>
                        </artifactItems>
                        <outputDirectory>../Main/target/dependencies</outputDirectory>
                      </configuration>
                    </execution>
                  </executions>
                </plugin>
            </plugins>
        </build>
    

    If you do put this in the parent pom, keep in mind that it will work nicely only if your whole project is one module deep. Meaning that if the the modules under the parent module have their own submodules, they will not end up in the desired folder. Your folder structure will look like this:

    - Parent
      - Module 1
        - Sub module 1
        **Main**
      - Module 2
      **Main**
    

    To prevent this, create a dedicated module with above configuration, and specify manually each module that you want to copy. This way all modules, no matter how deep they are will end up in one folder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a maven project, which has quite different settings in the properties files
I have maven project with several modules. Need to deploy all modules( jars and
I have a maven project A which uses jar files of another project B
I have a multi-module maven project with an installer sub-project. The installer will be
I have a Maven project which generates a 413.06 KB jar file. I have
I have a Maven project that was built a few years back, and now
So I have a Maven project with two submodules. The first is the compiler
I have a maven project in which I would like to unpack all the
Consider a Maven project with multiple interdependent modules: let's say, three jar modules A,
I have maven project with modules. I want on run mvn install that install

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.