有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Springbootmavenplugin生成有缺陷的清单

我正在经历这样一种行为,即spring boot maven插件的这种配置:

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

结果显示以下(缩短的)清单。jar内生成的mf文件:

Manifest-Version: 1.0
Implementation-Vendor: Pivotal Software, Inc.
Implementation-Title: submit-enrollment
Implementation-Version: 0.0.1-SNAPSHOT
Implementation-Vendor-Id: c.z.services
Built-By: sl
Build-Jdk: 1.7.0_76
Created-By: Apache Maven 3.2.5
Archiver-Version: Plexus Archiver

这导致一个有缺陷的罐子无法运行

只要我从pom中移除插件管理标记。xml,生成的清单将更改为以下更完整的版本,并且在jar执行期间一切正常:

Manifest-Version: 1.0
Implementation-Vendor: Pivotal Software, Inc.
Implementation-Title: submit-enrollment
Implementation-Version: 0.0.1-SNAPSHOT
Implementation-Vendor-Id: c.z.services
Built-By: sl
Build-Jdk: 1.7.0_76
Start-Class: c.z.submit.enrollment.SubmitEnrollmentApplication
Created-By: Apache Maven 3.2.5
Spring-Boot-Version: 1.2.5.RELEASE
Main-Class: org.springframework.boot.loader.JarLauncher
Archiver-Version: Plexus Archiver

根据插件的docs,pluginManagement标签应该是:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>1.2.5.RELEASE</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>

那么,pom中这个插件的正确使用模式是什么呢。生成正确的可部署工件的xml文件

谢谢


共 (0) 个答案