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

  • Home
  • SEARCH
  • 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 518449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:56:18+00:00 2026-05-13T07:56:18+00:00

I have a maven2 project with several jar modules, build the project will get

  • 0

I have a maven2 project with several jar modules, build the project will get .jar archives for each module in the directory modules/XYZ/target/XYZ-x.x.x.jar

Now, if my project P is of version P-p.q.r, and I want to generate a single jar P-p.q.r-all.jar with all sub-modules included in, how should I do?

  • 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-13T07:56:19+00:00Added an answer on May 13, 2026 at 7:56 am

    What you want to achive is called uber jar. This module has to have dependecies of all others submodules you want to package into one jar. If you create another submodule that will produce a desired artifact it can be built in reactor with all its dependencies but if it will be a separate project that you have to install all uber jar dependecies.

    | parent
    | -- submodule1
    ...
    | -- submoduleN
    | -- uberjarSubmodule
    

    Uber jar can be done by using:

    1. maven-shade-plugin – in your case you have to remember to exclude transitive dependecies from your modules

      <project>
      ...
      <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>1.2.2</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
                <artifactSet>
                  <excludes>
                    <exclude>classworlds:classworlds</exclude>
                    <exclude>junit:junit</exclude>
                    <exclude>jmock:jmock</exclude>
                    <exclude>xml-apis:xml-apis</exclude>
                  </excludes>
                </artifactSet>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
      </build>
      ...
      </project>
      
    2. maven-assembly-plugin – in this question you’ll find a detailed answer

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

Sidebar

Related Questions

We have a mother-ship project with several modules: foo + foo-core + foo-resource +
I have a Maven project that consists of several modules. I have a single
I have a hierarchical maven project, from which I am trying to build a
I have a maven project which uses the shade plugin to create a jar
This is the directory structure of the project (maven2 is used): pom.xml /src /main
I have Java project built with Maven2. There is used JUnit framework for testing
I'm trying to create a distributable zip of my project that contains several configuration
I am converting a project to use Ant/maven-ant-tasks. I have a local repository in
I'm using Maven 2 and Hibernate for a Java web app. I have a
I am considering converting an Ant/Ivy project to Ant/Maven-Ant-Tasks. I do not want to

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.