maven打包需要设置main-class的插件写法

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.stono.HelloWorld</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

需要在terminal中使用mvn clean package进行打包操作;

 

相关文章:

  • 2022-12-23
  • 2021-07-12
  • 2021-11-30
  • 2021-04-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2021-08-14
相关资源
相似解决方案