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 8917229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:26:10+00:00 2026-06-15T05:26:10+00:00

Is it possible to build a jar for every java package in a project?

  • 0

Is it possible to build a jar for every java package in a project?

e.g. my packages are com.mypackage.foo, com.mypackage.bar both packages are in one project.
Can i now start a maven build to get a foo.jar and a bar.jar?

Thanks 4 the help.

EDIT: Okay, I think you need some more informations why I am asking that.
I have a project which is divided in two parts (a library and a daemon) and both parts must be runnable independent from each other, so I want to use a own jar for each part.
I was thinking about a “parent project” that includes the two parts as modules like some of you suggested (is that a nicer way?).
The next point is that I have only one git repo in that I want to commit the whole project. Is it possiple to place the modules projects content in the parent project like src/lib/java or how I have to do that?

  • 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-06-15T05:26:11+00:00Added an answer on June 15, 2026 at 5:26 am

    In Maven the conventions is to build a jar for a module which means in other words
    to build a jar from the contents of src/main/java. If you need to build a jar from every packages that sounds a little bit weird to me.
    You can do things like this but this is not recommended cause it will result in trouble later. This is a kind of fight you start with Maven which you will loose in the end.

    You need to configure the maven-jar-plugin:

    <project>
      ...
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            ...
            <configuration>
              <excludes>
                <exclude>...</exclude>
              </excludes>
              <includes>
                <include>com/mypackage/foo/**</include>
              </includes>
            </configuration>
            ...
          </plugin>
        </plugins>
      </build>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: With Maven, how can I build a distributable that has my project's
I have maven configured for my java project to build single jar with all
is it possible to build a jar file made up of all jar files
Just wondering is it possible to build CLI app that can be run from
If I have 6 modules in my project is it possible to build only
Possible Duplicate: NetBeans - deploying all in one jar I am using netbeans to
When I build jar for Android library project in Intellij Idea it puts inside
We can configure a library's (jar) javadoc in a Project in Eclipse by: -
I'm trying to build non-java project, it basically has some folders and subfolders I
I would like to build a Jar whose main class package is not at

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.