当不希望将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
3
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:3 个月前 )
cb7188d7 Use latest Mimir 0.11.2 + mirror feature. CI is now redirected to Google US Mirror. We identified 3 problems affected by unstable Central (fails the CI runs if any of these get 4xx/5xx): * wrapper - fixed by using alt URL * Mimir extension loading from Central (not solved by this PR) * two UTs `RequestTraceTest` and `TestApiStandalone` going directly to Central (not solved by this PR) 1 天前
1af9995f Bumps [org.apache:apache](https://github.com/apache/maven-apache-parent) from 35 to 36. - [Release notes](https://github.com/apache/maven-apache-parent/releases) - [Commits](https://github.com/apache/maven-apache-parent/commits) --- updated-dependencies: - dependency-name: org.apache:apache dependency-version: '36' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 1 天前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐