使用Spring Boot向清单文件添加属性 [英] Adding properties to manifest file with spring boot

查看:106
本文介绍了使用Spring Boot向清单文件添加属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在清单文件中添加SplashScreen-Image: <image name>.

I want to add SplashScreen-Image: <image name> to the manifest file.

如何使用Spring Boot的Maven插件做到这一点?如果这不可能,那么如何使用具有附加属性的maven创建单个可执行jar?

How do I do this with Spring Boot's Maven Plugin? If this is not possible, how do I create a single executable jar using maven with additional properties?

推荐答案

在事后看来,答案是显而易见的. Spring-Boot的maven插件重写了原始清单文件,因此使用maven jar插件,清单可以正常编写.像这样:

The answer was kinda obvious in hindsight. Spring-Boot's maven plugin rewrites the original manifest file so using the maven jar plugin the manifest can be written as normal. Like this:

<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>
                    <manifestEntries>
                        <splashscreen-image>${image.name}</splashscreen-image>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>

    </plugins>
</build>

这篇关于使用Spring Boot向清单文件添加属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆