Add the following plugins to pom.xml. Check the value in the tags mainClass, classpathPrefix, addClasspath.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <mainClass>org.apache.camel.spring.Main</mainClass> <classpathPrefix>lib/</classpathPrefix> <addClasspath>true</addClasspath> </manifest> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <descriptors> <descriptor>src/assembly/some-assembly.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
Create some-assembly.xml in the src / assembly section as shown below.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id>distribution</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> <fileSets> <fileSet> <directory>${project.build.directory}</directory> <outputDirectory>/</outputDirectory> <includes> <include>*.jar</include> </includes> </fileSet> </fileSets> <dependencySets> <dependencySet> <scope>runtime</scope> <outputDirectory>/lib</outputDirectory> <useProjectArtifact>false</useProjectArtifact> <unpack>false</unpack> </dependencySet> </dependencySets>
Note that the useProjectArtifact flag is false, the unpack flag is false. If the root folder inside the zip file is not required, then you can include includeBaseDirectory in false.
This will create the name-version-distribution.zip file. Inside the zip file there will be a folder with the version name. Inside this folder there will be an executable jar and lib folder containing all banks with dependencies. Check the manifest.MF file of the executable jar. It contains information about the main class and class.
PShetty Mar 12 '13 at 11:36 2013-03-12 11:36
source share