2

I use Spring Boot (2.1.1.RELEASE) with Maven (3.6.0). My MANIFEST.MF is generated by maven-jar-plugin. This works fine if I run mvn clean install. I need to read and parse the manifest at runtime and that works fine if I run the the build JAR from CLI.

But if I use mvn spring-boot:run the manifest file cannot be found. There is no MANIFEST.MF at target/classes/META-INF.

Is it possible to force the Spring Boot Maven plugin or the Maven Jar Plugin to generate this manifest file if I start my application with spring-boot:run?

My Maven config:

    <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>

Henok
  • 413
  • 2
  • 7
  • 20

0 Answers0