java - How to create a release package with maven? -
I am creating a desktop application using Maven2.
Time I want to release from time to time (just copy all the projects and third party jars and generate a run.bat file) in a single project.
How to do it?
You need to make runs. For example, you can put yourself in src / main / assembly / scripts. You then need to create an assembly.xml file in src / main / assembly.
Here is an example of an assembly.xml file that you want to use. It makes a tar.gz with all your dependency jar and your run.bat.
& lt; Assembly & gt; & Lt; ID & gt; 1.0 & lt; / Id & gt; & Lt; Formats & gt; & Lt; Format & gt; Tar.gz & lt; / Format & gt; & Lt; / Formats & gt; & Lt; IncludeBaseDirectory & gt; False & lt; / IncludeBaseDirectory & gt; & Lt; DependencySets & gt; & Lt; DependencySet & gt; & Lt; OutputDirectory & gt; / Lib & lt; / OutputDirectory & gt; & Lt; / DependencySet & gt; & Lt; / DependencySets & gt; & Lt; Fileset & gt; & Lt; Fileset & gt; & Lt; Directory & gt; Goal & lt; / Directory & gt; & Lt; OutputDirectory & gt; / Lib & lt; / OutputDirectory & gt; & Lt; Included & gt; & Lt; Included & gt; * Jar & lt; / Include & gt; & Lt; / Include & gt; & Lt; / Fileset & gt; & Lt; Fileset & gt; & Lt; Directory & gt; Src / home / assembly / scripts & lt; / Directory & gt; & Lt; OutputDirectory & gt; / Scripts & lt; / OutputDirectory & gt; & Lt; Included & gt; & Lt; Included & gt; * Bat & lt; / Include & gt; & Lt; / Include & gt; & Lt; / Fileset & gt; & Lt; / Fileset & gt; & Lt; / Assembly & gt; Finally, add assembly plugin to your pom.xml file:
& lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-assembly-plug-in & lt; / ArtifactId> & Lt; Configuration & gt; & Lt; Descriptor & gt; & Lt; Descriptor & gt; Src / home / assembly / assembly.xml & lt; / Narrator & gt; & Lt; / Narrator & gt; & Lt; / Configuration & gt; & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; Step & gt; Package & lt; / Step & gt; & Lt; Goals & gt; & Lt; Goal & gt; Attached & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; / Plugin & gt; Now, when you run "mvn install" you should be creating your tar.gz.
To run:
mvn release: prepare
mnn release: display
Comments
Post a Comment