generate a executed jar file with dependencies

How to generate a executed jar file with dependencies using maven:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptorRefs><descriptRef>jar-with-dependencies</descriptRef></descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>moviespiders.Spider</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>assembly</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>

then you can using command in your project’s workspace:

mvn clean package

you will get what you want.

猜你喜欢

转载自blog.csdn.net/qq_36336003/article/details/80198170
今日推荐