美文网首页
maven带依赖打包并指定主类

maven带依赖打包并指定主类

作者: simplerandom | 来源:发表于2020-07-01 17:01 被阅读0次
<build>
        <plugins>
            <!--(start) for package jar with dependencies -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <archive>
                        <!--指定main方法所在的类-->
                        <manifest>
                            <mainClass>LoggerUtilsTest</mainClass>
                        </manifest>
                    </archive>
                    <!--不能改jar-with-dependencies-->
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--(end) for package jar with dependencies -->
        </plugins>
    </build>

打包

mvn clean package

相关文章

网友评论

      本文标题:maven带依赖打包并指定主类

      本文链接:https://www.haomeiwen.com/subject/uirhqktx.html