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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:15:38+00:00 2026-05-12T06:15:38+00:00

I’m just beginning to grasp the setup of maven2 while porting over a simple

  • 0

I’m just beginning to grasp the setup of maven2 while porting over a simple project of mine. I’ve ran through the package command line example on the Sonatype web site but I’m a bit confused of how I could expand and change the packaging of this project. I’ve tried to find more information on this subject but I think I’m either thinking about the problem wrong or phrasing the searches wrong.

Essentially I want to build a project that would be a zip of all the dependency jars, the main jar itself, batch scripts to start it for convenience and maybe other various files for the application (like properties files or something). However, I don’t want these all bundled into the jar. I’d like to just have a compressed archive build of the project with a lib directory of all the jars, the root containing properties files and batch scripts and maybe sub folders to hold extra non-essential files. Kind of like:

  • sample-proj.zip:
    • easy.bat
    • props.ini
    • lib
      • dependent1.jar
      • dependent2.jar
      • main.jar
    • sub_dir
      • someextrafile.txt

What’s the correct way of building a project like this using maven2? Do I need to make a parent project that builds the zip and includes the sub project as a module? This would be just a simple project that wouldn’t need to be multi-module…

  • 1 1 Answer
  • 1 View
  • 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-12T06:15:39+00:00Added an answer on May 12, 2026 at 6:15 am

    Building on matt b’s answer. Here’s some examples of how to use the referenced plugins. Note the executions are bound to the integration-test phase to ensure the jar has been created before attempting to package it.

    The appassembler-maven-plugin will generate batch/shell files, download the dependencies (in this example to the lib directory), and place all the contents in target/appassembler

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <id>assemble-standalone</id>
            <phase>integration-test</phase>
            <goals>
              <goal>assemble</goal>
              <!--if you only want to create the repo and skip script generation, 
                 use this goal instead-->
              <!--goal>create-repository</goal-->
            </goals>
            <configuration>
              <programs>
                <program>
                  <mainClass>name.seller.rich.Foo</mainClass>
                  <name>foo</name>
                </program>
              </programs>
              <platforms>
                <platform>windows</platform>
                <platform>unix</platform>
              </platforms>
              <repositoryLayout>flat</repositoryLayout>
              <repositoryName>lib</repositoryName>
            </configuration>
          </execution>
        </executions>
      </plugin>
    

    The assembly plugin can be used to package the appassembler output into a zip:

    <profiles>
      <profile>
        <id>archive</id>
        <build>
          <plugins>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <version>2.2-beta-2</version>
              <executions>
                <execution>
                  <phase>integration-test</phase>
                  <goals>
                    <goal>single</goal>
                  </goals>
                  <configuration>
                    <descriptors>
                      <descriptor>src/main/assembly/archive.xml</descriptor>
                    </descriptors>
                  </configuration>
                </execution>
              </executions>
            </plugin>    
          </plugins>
        </build>
      </profile>
    </profiles>
    

    And the assembly descriptor looks something like this:

    <assembly>
      <id>archive</id>
      <formats>
        <format>zip</format>
      </formats>
      <fileSets>
        <fileSet>
         <directory>${project.build.directory}/appassembler</directory>
         <outputDirectory>/</outputDirectory>
        </fileSet>
      </fileSets>
      <!-- add any other filesets to include docs, readmes, licences etc here -->
    </assembly>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.