build - building a jar and including it in a zip with maven-assembly-plugin -
i have mavenized java project (maven2) want build jar, easy enough supplying jar-with-dependencies descriptorref in pom.xml.
however need deploy project in zip .exe , .bat files, among others, bin folder call jar. (i using tanuki not matter use case think)
in other words, need build in first sources (and dependencies) packaged jar , jar put zip additional files bin folder.
what should put in pom.xml , 'assembly'.xml?
maven-assembly-plugin right tool that.
you have declare plugin in "build" section of pom, , create configuration file "assembly.xml" @ root of project. in file, define content of zip file.
the configuration options described on official site: http://maven.apache.org/plugins/maven-assembly-plugin/
here basic configuration example of plugin should suit needs.
pom config :
<plugin> <artifactid>maven-assembly-plugin</artifactid> <configuration> <finalname>zipfile</finalname> <descriptors> <descriptor>${basedir}/assembly.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
assembly config :
<assembly> <formats> <format>zip</format> </formats> <filesets> <fileset> <directory>to_complete</directory> <outputdirectory /> <includes> <include>**/*.jar</include> <include>**/*.bat</include> <include>**/*.exe</include> </includes> </fileset> </filesets> </assembly>
Comments
Post a Comment