maven 将依赖jar包打包

来源:互联网 发布:数据库用来做什么 编辑:程序博客网 时间:2024/05/01 05:53



down vote

meet the same problem, I solved it by build the jar with dependencies.

add the code below to pom.xml

<build>    <sourceDirectory>src/main/java</sourceDirectory>    <testSourceDirectory>src/test/java</testSourceDirectory>    <plugins>      <!--                   Bind the maven-assembly-plugin to the package phase        this will create a jar file without the storm dependencies        suitable for deployment to a cluster.       -->      <plugin>        <artifactId>maven-assembly-plugin</artifactId>        <configuration>          <descriptorRefs>            <descriptorRef>jar-with-dependencies</descriptorRef>          </descriptorRefs>          <archive>            <manifest>              <mainClass></mainClass>            </manifest>          </archive>        </configuration>        <executions>          <execution>            <id>make-assembly</id>            <phase>package</phase>            <goals>              <goal>single</goal>            </goals>          </execution>        </executions>      </plugin>    </plugins></build>    

mvn package submit the "example-jar-with-dependencies.jar"


0 0