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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:29:34+00:00 2026-06-17T07:29:34+00:00

I am using maven assembly plugin to generate a .tar file contain several other

  • 0

I am using maven assembly plugin to generate a .tar file contain several other files, dependent jars. All the files are being copied correctly to the given folders in the config assembly.xml.

I would like to include the original project jar too in the final tar file, but not seeing it currently in it.

I do get the following message when I issue assembly:single goal:

[WARNING] Cannot include project artifact: com.my.newpkg.project1:jar:0.0.3.0; it doesn’t have an associated file or directory.

After reading over SO, it seems adding the following configs to pom.xml should add the jar, but still not getting the expected result.

config in pom.xml

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-jar-plugin</artifactId>
   <version>2.4</version>
   <configuration>
       <archive>
           <manifest>
               <mainClass>com.my.newpkg.project1.MainClass</mainClass>
               <addClasspath>true</addClasspath>
               <classpathPrefix>lib/</classpathPrefix>
           </manifest>
       </archive>
   </configuration>
</plugin>

snippet of assembly.xml

<formats>
    <format>dir</format>
    <format>tar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
    <dependencySet>
        <outputDirectory>lib</outputDirectory>
        <excludes>
            <exclude>junit:junit</exclude>
        </excludes>
        <fileMode>0755</fileMode>
    </dependencySet>
</dependencySets>

So, the configs are not yet correct? or Am I missing something here?

How can we add the current project jar into the final tar

  • 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-17T07:29:35+00:00Added an answer on June 17, 2026 at 7:29 am

    In <dependencySet> you can exclude the current project jar by saying <useProjectArtifact>false</useProjectArtifact>, but it’s true by default, so it should work.

    From the warning, it seems that you need to do mvn package first, but due to some internal maven issue, it does not work if you do mvn package and mvn assembly:single in separate commands.

    It works if you do mvn package assembly:single in one command.

    Alternatively, add maven-assembly-plugin in your pom and bind it to the ‘package’ phase so it will trigger automatically on mvn package:

       <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>tar-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>etc/assembly.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the maven-assembly-plugin to produce a zip file for some database scripts. I
I am using Maven Assembly plugin to pack a jar file. But when I
I'm trying to filter my shell scripts using maven assembly plugin. Other properties and
I am using maven-shade-plugin for a simple maven project, the plugin successfully includes all
I create my application archive with the maven assembly plugin. All the dependency present
I am creating an executable jar using the jar-with-dependencies component of the maven-assembly-plugin during
Using Maven war plugin, I generate WAR which includes following directory: META-INF -- maven
Im trying to use Maven to build a standalone application Using the assembly plugin
This is plugin configuration I am using: <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>com.mycompany.changepasswd</mainClass> </manifest>
I am using maven-assembly-plugin to construct an assembly. I want to include in 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.