His
His

Reputation: 6053

Packaging a maven project into a zip file via maven

With maven, is it possible to create a zip file of my maven project? The zip file should also contain the pom.xml file and all others. The zip file is the archive of the maven project. Basically, I just want my user to easily import the project into Eclipse after unpacking the zip file.

How do I achieve this with maven?

Thanks!

Upvotes: 0

Views: 6129

Answers (2)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136152

You can use antrun plugin

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <configuration>
                <target>
                    <zip destfile="d:/projectname.zip" basedir="${project.basedir}" excludes="target/**" />
                </target>
            </configuration>
        </plugin>

run it from Eclipse Run As -> Maven build... -> Goals: antrun:run

Upvotes: 1

Govil
Govil

Reputation: 2054

You can accomplish this using maven-assembly-plugin that Pradeep suggested.

And also using maven-antrun-plugin. See the pom and zip task. Include the files that you want in fileset.

Upvotes: 4

Related Questions