Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding properties to manifest file with spring boot

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

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?

like image 765
M.P. Korstanje Avatar asked Nov 11 '14 13:11

M.P. Korstanje


People also ask

How do I edit a JAR file manifest?

To modify the manifest, you must first prepare a text file containing the information you wish to add to the manifest. You then use the Jar tool's m option to add the information in your file to the manifest. Warning: The text file from which you are creating the manifest must end with a new line or carriage return.


1 Answers

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>
like image 114
M.P. Korstanje Avatar answered Sep 21 '22 14:09

M.P. Korstanje