package - Maven plugin to create Java executable -
i trying create executable jar includes classes , dependent jars. tried multiple maven plugins, not successful. 1 of options "jar-with-dependencies" adds dependencies, dependent jars exploded.
what want is
<mymain> <meta-inf> manifest.mf //containing main class , classpath dependencies. <com> <lib> spring-core-3.0.jar spring-beans-3.0.jar // , dependent jars underneath
i tried following, no avail. creates proper manifest doesn't copy jars.
<pluginmanagement> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <executions> <execution> <id>copy-dependencies</id> <phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputdirectory>${project.build.directory}/classes/lib</outputdirectory> <overwritereleases>false</overwritereleases> <overwritesnapshots>false</overwritesnapshots> <overwriteifnewer>true</overwriteifnewer> </configuration> </execution> </executions> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <configuration> <archive> <manifest> <addclasspath>true</addclasspath> <classpathprefix>lib/</classpathprefix> <mainclass>mymainclass</mainclass> </manifest> </archive> </configuration> </plugin> </plugins> </pluginmanagement>
i use spring tool suite , run->maven install
you can use assembly plugin:
<plugin> <artifactid>maven-assembly-plugin</artifactid> <configuration> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> </configuration> </plugin>
Comments
Post a Comment