How to build an executable jar for a multi module maven project
I have a parent maven project SampleProject and it has two modules Sample1 and Sample2. The SampleProject has a main method, how to create an executable jar for SampleProject so that it executes the main method
Pom.xml for SampleProject is: http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>com.test.sample</groupId>
<artifactId>SampleProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>SampleProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>sample</groupId>
<artifactId>com.sample</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:UserspchandDesktopExtentReport-0.0.1-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
<modules>
<module>Sample1</module>
<module>Sample2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.test.sample.SampleProject.Runner</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
链接地址: http://www.djcxy.com/p/37592.html
上一篇: 如何为Firefox设置插件存储图标