Spring Boot META-INF / build-info.properties不在工件中

时间:2018-10-01 16:49:12

标签: java spring-boot

我想在/ info中访问我的提交信息。事实是,它可以在IDE中工作,但是在打包工件时似乎出现了问题,文件META-INF/build-info.properties没有打包到jar中!有什么提示吗?

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>build-info</goal>
                </goals>
                <phase>package</phase>
            </execution>
        </executions>
        <configuration>
            <additionalProperties>
                <number>${buildNumber}</number>
                <job>${buildJob}</job>
            </additionalProperties>
        </configuration>
    </plugin>

2 个答案:

答案 0 :(得分:0)

从执行中删除<phase>package</phase>,现在执行mvn clean install。它应该生成META-INF/build-info.properties文件

答案 1 :(得分:0)

     <build>
        <plugins>
           <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
              <version>${spring-boot.version}</version>
              <configuration>
                 <mainClass>${start-class}</mainClass>
                 <executable>true</executable>
              </configuration>
              <executions>
                 <execution>
                    <goals>
                        <goal>build-info</goal>
                        <goal>repackage</goal>
                    </goals>
                 </execution>
              </executions>
           </plugin>