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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:45:31+00:00 2026-05-26T11:45:31+00:00

I am building a simple Jar project with maven(latest) When running maven package ,

  • 0

I am building a simple Jar project with maven(latest)

When running maven package, I get the jar file at the target directory correctly,

I would like to customize the output so maven will copy some files and dependencies to the target alongside the jar.

The current folder structure is:

/  
-- resources  
-- src/main/java/com..(project sources)
-- src/main/assembly  (location of the assebmly.xml)

The desired target directory structure is:

target
     |
      -- myJar1.0.jar         (the artiface)   
      -- resources            (from the root build folder)
      -- lib                  (all the dependancies)
            |
            -- anotherJar-1.0.jar
            -- anotherJar2-1.0.jar
            -- anotherJar3-1.0.jar



I read custom assembly on apache web site,
I added the configuration to maven-assembly-plugin and configured the assembly.xml
but I must do something wrong, I dont get the correct output,

Here is the assembly.xml

<assembly>
<id/>
<formats>
    <format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
    <dependencySet>
        <outputDirectory>/lib</outputDirectory>
    </dependencySet>
</dependencySets>
<fileSets>
    <fileSet>
        <directory>target</directory>
        <outputDirectory>/lib</outputDirectory>
        <includes>
            <include>*.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>resources</directory>
        <outputDirectory>/resources</outputDirectory>
        <includes>
            <include>*.*</include>
        </includes>
    </fileSet>
</fileSets>

The target directory contain the lib with dependencies but it is located in folder with the artifact name,
The resources directory is not being copy at all.

Please advise
Thank you

  • 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-26T11:45:32+00:00Added an answer on May 26, 2026 at 11:45 am

    By design, maven assembly plugin creates output in a subfolder of target. This is to avoid confusion with other artifacts which get created therein (classes, test-classes, etc.).

    As for resources not getting copied, you can omit the <includes> section if you want the entire contents of the folder to be copied. Also the first <fileSet> section is redundant.

    Updated assembly.xml to place project artifact in root, dependant libraries in lib and resources in resources folder of the assembly folder…

    <assembly>
    <id/>
    <formats>
        <format>dir</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/lib</outputDirectory>
            <excludes>
                <exclude>${project.groupId}:${project.artifactId}</exclude>
            </excludes>
        </dependencySet>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>${project.groupId}:${project.artifactId}</include>
            </includes>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>resources</directory>
            <outputDirectory>/resources</outputDirectory>>
        </fileSet>
    </fileSets>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a jar using maven with simple maven install. If I add
I building a simple, 7 page, database driven, website, and I would like to
I'm building a project with ant and during the build I'd like to bundle
It seems like building a jar or zip from the exact same source files
I have a simple application using netbeans for developing and maven for building et
building a simple calculator here to get my feet wet with iOS dev. I
I would like to make a very simple ant script that does 1 thing,
I am building a simple Android project in eclipse that uses the google-api-java-client .
I'm just building a simple ajax site but running into a problem in safari
I'm building a simple Todo List application where I want to be able 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.