No main manifest attribute in jar Maven and Spring Boot




Asked on June 08, 2018
In my Spring Boot Application I am creating JAR using 

mvn clean package

And when I run JAR using command

java -jar target/my-app.0.0.1-SNAPSHOT.jar

I am getting following error.

no main manifest attribute, in target/my-app.0.0.1-SNAPSHOT.jar

How to fix it?



Replied on June 08, 2018
Look for spring-boot-maven-plugin in build section in your pom.xml. If not available, include it.

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

in your pom.xml



Replied on June 08, 2018
Thanks. It works.

Write Answer










©2024 concretepage.com | Privacy Policy | Contact Us