无法执行 jar- 文件:“没有主清单属性”

在maven文件的pom.xml中添加如下内容,其中<mainClass>标签内容为程序的执行入口

<build>
        <plugins>
            <plugin>
                <!-- Build an executable JAR -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.shrewd.model.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
赞(0) 打赏
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《无法执行 jar- 文件:“没有主清单属性”
文章链接:https://blog.78cat.cn/1958.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

觉得文章有用就打赏一下文章作者

感谢您的支持,我将持续输出干货满满的内容

支付宝扫一扫

微信扫一扫