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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:44:16+00:00 2026-05-17T00:44:16+00:00

I’m trying to write a maven assembly and I’m not sure how to continue.

  • 0

I’m trying to write a maven assembly and I’m not sure how to continue. It’s fairly complicated, so the examples I google don’t really help. This is what I’m trying to do:

  • Create an installation file using launch4j. This part works, assuming the jar file is correctly assembled (hence the need for a maven assembly.)
  • The installation program contains some dependencies. These are assembled (currently) using the jar-with-dependencies descriptorRef. This works as well.
  • I need to include a war file (from another project) into the big jar. This is my confusion.

How do I create an assembly.xml that will do both the jar with dependencies (unpacking all of those jar files) and include a war file from another project (which is not unpacked).

Any help would be appreciated.

  • 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-17T00:44:16+00:00Added an answer on May 17, 2026 at 12:44 am

    How do I create an assembly.xml that will do both the jar with dependencies (unpacking all of those jar files) and include a war file from another project (which is not unpacked).

    Assuming you have a project structure similar to the one below (I’m assuming a simple structure since you didn’t mention anything particular about it):

    .
    ├── pom.xml
    └── src
        ├── main
        │   ├── assembly
        │   │   └── uberjar.xml
        │   └── java
        │       └── com
        │           └── stackoverflow
        │               └── App.java
        └── test
            └── java
                └── com
                    └── stackoverflow
                        └── AppTest.java
    

    With the following pom.xml:

    <project>
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.stackoverflow</groupId>
      <artifactId>Q3762049</artifactId>
      <version>1.0-SNAPSHOT</version>
      <dependencies>
        <!-- this is the war we want to include in the assembly -->
        <dependency>
          <groupId>com.mycompany</groupId>
          <artifactId>my-webapp</artifactId>
          <version>1.0-SNAPSHOT</version>
          <type>war</type>
          <scope>runtime</scope>
        </dependency>
        <!-- and below, the other dependencies -->
        <dependency>
          <groupId>commons-lang</groupId>
          <artifactId>commons-lang</artifactId>
          <version>2.4</version>
        </dependency>
        ...
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2-beta-5</version>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/uberjar.xml</descriptor>
              </descriptors>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </project>
    

    As you can see,

    1. We are not going to use the predefined jar-with-dependencies descriptor here, we are going to reuse it in our own custom assembly descriptor.
    2. We have a dependency declared on the war with a runtime scope so that we’ll be able to include it in the assembly.

    And now, the custom uberjar.xml:

    <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
      <id>uberjar</id>
      <formats>
        <format>jar</format>
      </formats>
      <includeBaseDirectory>false</includeBaseDirectory>
      <dependencySets>
        <dependencySet>
          <unpack>true</unpack>
          <scope>runtime</scope>
          <useProjectArtifact>false</useProjectArtifact>
          <excludes>
            <exclude>*:war</exclude>
          </excludes>
        </dependencySet>
        <dependencySet>
          <unpack>false</unpack>
          <scope>runtime</scope>
          <useProjectArtifact>false</useProjectArtifact>
          <includes>
            <include>*:war</include>
          </includes>
        </dependencySet>
      </dependencySets>
      <fileSets>
        <fileSet>
          <directory>${project.build.outputDirectory}</directory>
          <outputDirectory>/</outputDirectory>
        </fileSet>
      </fileSets>
    </assembly>
    

    This is a little variation of the jar-with-dependencies descriptor that will create a jar:

    • the dependencies except the war, unpacked
    • the war of the webapp, not unpacked
    • the classes from the project itself

    As shown below:

    $ mvn clean package
    [INFO] Scanning for projects...
    ...
    $ cd target; jar xvf Q3762049-1.0-SNAPSHOT-uberjar.jar
      created: META-INF/
     inflated: META-INF/MANIFEST.MF
      created: org/
      created: org/apache/
      created: org/apache/commons/
      created: org/apache/commons/lang/
      created: org/apache/commons/lang/builder/
      created: org/apache/commons/lang/enum/
      created: org/apache/commons/lang/enums/
      created: org/apache/commons/lang/exception/
      created: org/apache/commons/lang/math/
      created: org/apache/commons/lang/mutable/
      created: org/apache/commons/lang/text/
      created: org/apache/commons/lang/time/
     inflated: META-INF/LICENSE.txt
     inflated: META-INF/NOTICE.txt
     inflated: org/apache/commons/lang/ArrayUtils.class
    ...
      created: META-INF/maven/
      created: META-INF/maven/commons-lang/
      created: META-INF/maven/commons-lang/commons-lang/
     inflated: META-INF/maven/commons-lang/commons-lang/pom.xml
     inflated: META-INF/maven/commons-lang/commons-lang/pom.properties
     inflated: my-webapp-1.0-SNAPSHOT.war
      created: com/
      created: com/stackoverflow/
     inflated: com/stackoverflow/App.class
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.