春季启动运行-没有manifest.mf

时间:2019-01-11 15:35:32

标签: java maven spring-boot manifest maven-jar-plugin

我在Maven(3.6.0)中使用Spring Boot(2.1.1.RELEASE)。我的MANIFEST.MFmaven-jar-plugin生成。如果我运行mvn clean install,这将很好地工作。我需要在运行时阅读和解析清单,如果我从CLI运行构建JAR,效果很好。

但是,如果我使用mvn spring-boot:run,则找不到清单文件。 MANIFEST.MF处没有target/classes/META-INF

如果我使用spring-boot:run启动应用程序,是否可以强制Spring Boot Maven插件或Maven Jar插件生成此清单文件?

我的Maven配置:

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

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Product-Name>****</Product-Name>
                            <FinalName>${project.build.finalName}</FinalName>
                            <Build-Time>${maven.build.timestamp}</Build-Time>
                            <Build-Profile>prod</Build-Profile>
                            <Build-Os>${os.name}</Build-Os>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

0 个答案:

没有答案