当不希望将SpringBoot打包成独立运行的jar,而只是当做工具jar包时,去掉启动类,打包报错:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE:repackage (repackage) on project plat-common: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE:repackage failed: Unable to find main class -> [Help 1]

原因是SpringBoot使用了自动打包插件,会在打包时找项目下的启动程序

解决办法:
    去掉SpringBoot自带的自动打包插件

    使用Apache的打包插件

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>

GitHub 加速计划 / ma / maven
36
0
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:16 天前 )
7872c6d8 Changes: * update Mimir to latest 0.8.1 version * update infusers as well * cache changes (see below) Cache strategy changes: * initial build: it is snowballing one cache when build is not about PR * full (rebuild itself + site with itself) and its build: it is snowballing cache differentiated by OS/JDK when build is not about PR Current problems: on unchanged POM (ie. new IT added), the dependencies ITs pull from Central will be cached by Mimir, but due "cache hit" the new cache will not get stored. Hence, Mimir caching was basically lost. Also, there was a mixup of caches from PRs and main branches. Finally, matrix jobs were competing for cache store. 1 天前
c999cff6 Accept ONLY documented forms of them. Fixes #10210 2 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐