Maven Assemblies
Due to requests I received for source code for my open source file parser project (http://www.javaforge.com/project/2066), I had to quickly figure out a way to package a zip file that would contain
- source code
- binary jar file
- javadocs
- license and release-changes text files.
Since I am using Maven, I found that assemblies can come to my help. Thought I'd jot down a few things here so that others can google to it and find the same.
I created a file src/main/assemply/src.xml. This contained a list of artifacts I wanted to package as a zip. The XML should be self-explanatory.
In my pom.xml I have the following under the build section.
Once this is done, running command "mvn assembly:assembly" will trigger the build and the creation of my distributable file as target\flatfilereader-0.6-dist.zip
- source code
- binary jar file
- javadocs
- license and release-changes text files.
Since I am using Maven, I found that assemblies can come to my help. Thought I'd jot down a few things here so that others can google to it and find the same.
I created a file src/main/assemply/src.xml. This contained a list of artifacts I wanted to package as a zip. The XML should be self-explanatory.
<assembly> |
In my pom.xml I have the following under the build section.
| <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <configuration> <outputDirectory>target</outputDirectory> <finalName></finalName> <attach>false</attach> </configuration> <executions> <execution> <id>make-source-jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <outputDirectory>target</outputDirectory> </configuration> <executions> <execution> <id>make-javadoc</id> <phase>package</phase> <goals> <goal>javadoc</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> <descriptor> src/main/assembly/src.xml </descriptor> </descriptors> </configuration> </plugin> </plugins> </build> |
Once this is done, running command "mvn assembly:assembly" will trigger the build and the creation of my distributable file as target\flatfilereader-0.6-dist.zip






Comments