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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:50:27+00:00 2026-05-16T11:50:27+00:00

I have a Maven project that consists of several modules. I have a single

  • 0

I have a Maven project that consists of several modules. I have a single POM file that I use to invoke the build of all dependent modules. What I want to do is to copy a bunch of files to a single location and zip them up once, after the package lifecycle of all the sub-modules has completed.

I’ve looked into antrun, but can’t see how to make it run once. Currently it runs during the package phase of each module. Here’s my parent POM file (simplified)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<name>project</name>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
    <module>../module1</module>
    <module>../module2</module>
</modules>
<dependencies>
    ...
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <configuration>
                        <tasks>
                            <mkdir dir="product" />
                            <copy todir="product">
                                <fileset dir="../module1/doc/release">
                                    <include name="*.pdf" />
                                </fileset>
                                <fileset dir="../module2/doc/release">
                                    <include name="*.pdf" />
                                </fileset>
                                <fileset dir="../module1/target">
                                    <include name="*.war" />
                                </fileset>
                                <fileset dir="../module2/target">
                                    <include name="*.war" />
                                </fileset>
                            </copy>
                            <copy file="app.properties" todir="cesium" />

                            <zip basedir="product" destfile="dist.zip"></zip>

                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

<properties>
    ...
</properties>

Hopefully it’s clear what I’m trying to do. I just want the antrun task to happen after the package lifecycle, and only once, not for each module.

I understand that I might not be approaching this step the right way, but I’m unclear how best to aproach this with Maven. Any thoughts 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-16T11:50:28+00:00Added an answer on May 16, 2026 at 11:50 am

    Try the Maven Assembly Plugin.

    Here are the Maven Assembly Plugin Examples.

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

Sidebar

Related Questions

I have a project that consists of several modules (app. 10-12). I use maven
I have maven project that consists of several modules. I want to add an
I have a small maven project that build a java jar file. I added
I have a maven project that contains a certain api I need to use
Currently I have a simple maven project that is building a jar file and
I have a Grails project with pom.xml that is treated as Maven project by
I have a maven project that loads an xslt file and executes the transformation
I have a maven project Parent Project (with the following modules) (package type pom)
I have a Java multi-module Maven project that I want to build an MVN
I have a maven project that I want to build without version. Now, when

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.