美文网首页
springboot项目打包的坑

springboot项目打包的坑

作者: Yluozi | 来源:发表于2021-07-23 14:53 被阅读0次

新建的spingboot项目打包运行提示jar中没有主清单属性,再在pom文件中配置:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

之后打包正常,但是本地启动项目报错:

Could not transfer artifact org.springframework.boot:spring-boot-loader-tools:pom:2.1.5.RELEASE from/to nexus-releases (http://10.1.20.6:8081/nexus/content/repositories/public/): transfer failed for http://10.1.20.6:8081/nexus/content/repositories/public/org/springframework/boot/spring-boot-loader-tools/2.1.5.RELEASE/spring-boot-loader-tools-2.1.5.RELEASE.pom

后验证,在plugin配置中添加 <configuration>配置解决问题。解决如下:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!--值为true是指打包时包含scope为system的第三方Jar包-->
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
        </plugins>
    </build>

相关文章

网友评论

      本文标题:springboot项目打包的坑

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