Hi,
I am setting up a new project with Maven.
The build task is as follows:
For each top level folder (package) under the
${project.build.directory}, zip up all the files under the folder.
Please note there is NO compilation or build required, just zip up
folders...
Directory looks like below:
${project.build.directory}/pkg1
/class
/discoveryjobs
/discoveryModules
/discoveryPatterns
/discoveryScripts
${project.build.directory}/pkg2
* Structure same as above example *
${project.build.directory}/pkg3
* Structure same as above example *
I would like to end up with:
${project.build.directory}/target
pkg1.zip (zip of all files in
pkg1 folder, incl sub directories)
pkg2.zip
pkg3.zip
Nice to have:
1) Re-build the zip file ONLY if any sub directory or files have
changed.
2) Create one top level zip file (that contains all pkg*.zip files).
uCMDB-PatternDev-0.0.1-SNAPSHOT-distribution.zip
I played with "maven-assembly-plugin" but I have NOT figured out how to iterate
over each folder (pkg1, pkg2, pkg3).
I have attached my pom.xml and distribution.xml here.
Is there a way to customize assembly plugin to do what I want?
If NOT are there other plugins? (I experimented with truezip-maven-plugin a
little).
Thank you,
Robert
Robert Zanzerkia
Fidelity Investments
FTG-OPS
Two Contra Way
Merrimack, NH 03054
Work: 603-791-3477
Blackberry: 603-320-9682
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>distribution</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.zip</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fmr.itamdiscovery</groupId>
<artifactId>uCMDB-PatternDev</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>uCMDBPatternDEV</name>
<description>Build of uCMDB Packages. (ZIP files of folders).</description>
<build>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.zip</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>distribution.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.0-beta-5</version>
<executions>
<execution>
<id>copy-into</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
<fileset>
<directory>${project.build.directory}</directory>
<includes>
<include>*</include>
</includes>
<excludes>
<exclude>**/*.zip</exclude>
</excludes>
<outputDirectory>.</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>zipFolders</id>
<phase>prepare-package</phase>
<configuration>
<target>
<ant target="zip-all-packages" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<archive>${project.build.directory}/ucmdbpkg.zip</archive>
</properties>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]