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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:27:22+00:00 2026-05-14T18:27:22+00:00

when I package my project with the Maven goal package, the resources are included

  • 0

when I package my project with the Maven goal “package”, the resources are included as well. They are originally located in the directory “src/main/resources”.
Because I want to create an executable jar and add the classpath to the manifest, I’m using maven-jar-plugin.

I’ve configured it as the following likes:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <mainClass>at.program.Main</mainClass>
            </manifest>
        </archive>
    </configuration>
</plugin>

Why won’t the jar file created with “jar:jar” include my resources as well. As far as I’m concerned it should use the same directories as the “package” goal (which are in my case inherited from the Maven Super POM).

  • 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-14T18:27:22+00:00Added an answer on May 14, 2026 at 6:27 pm

    The jar:jar goal of the Maven JAR plugin is used to “build a JAR from the current project” and does only one thing: it packages the content of target/classes into a JAR in the target directory, and that’s all. So, when you run mvn jar:jar, the plugin configuration in your pom is used, but jar:jar won’t do more things than what I mentioned. If target/classes is empty or doesn’t exist, no classes or resources will be packaged in the resulting JAR.

    The package phase is a build lifecycle phase and when you invoke mvn package, all phases before package will be executed (process-resources, compile, process-test-resources, etc) and will trigger the plugin goals bound to these phases. So, for a project with a <packaging> of type jar, jar:jar is bound to package and will be run during the package phase but prior to that, the goals bound to phases preceding package will be triggered, including the one that copies the resources into target/classes.

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

Sidebar

Related Questions

I have a Maven based Spring-WS client project that I want to package as
I have a Maven project in Eclipse that successfully reaches the package goal. In
i try to build my Project with maven (goal: package clean) but i get
I'm trying to run mvn clean package on my Maven project and it fails
I have a Jenkins build which builds a maven project with -PmyProfile clean package
I've got a Maven project and we want to build two separate jars, one
To Maven gurus out there: I'm trying to package non-java project artifacts (.NET) into
I have set up basic maven project in java SE, with a resource: main
I want to create a gwt maven project with multiple gwt modules. some of
I have a .NET 3.5 Setup Package Project which installs my application successfully. The

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.