maven项目打成jar包执行报没有主清单属性

maven项目,在本机开发工具也可以直接运行方法,但是打成jar包执行报没有主清单属性, 实际原因就是maven的pom.xml没有配置main方法入口,代码如下:

只要改下mainClass即可~~

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.3/version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                        <goal>shade</goal>
                </goals>
                    <configuration>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.shigw.test.StartApp.</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
            </execution>
        </executions>
     </plugin>

猜你喜欢

转载自www.cnblogs.com/shigwcc/p/11091280.html
今日推荐