SpringBoot no main manifest attribute (maven)

We Are Going To Discuss About SpringBoot no main manifest attribute (maven). So lets Start this Java Article.

SpringBoot no main manifest attribute (maven)

Advertisements
  1. SpringBoot no main manifest attribute (maven)

    Try adding repackage goal to execution goals.
    Otherwise you would need to call the plugin explicitly as mvn package spring-boot:repackage.
    With the goal added, you have to call only mvn package.

  2. SpringBoot no main manifest attribute (maven)

    Try adding repackage goal to execution goals.
    Otherwise you would need to call the plugin explicitly as mvn package spring-boot:repackage.
    With the goal added, you have to call only mvn package.

Solution 1

Advertisements

Try adding repackage goal to execution goals.

Otherwise you would need to call the plugin explicitly as mvn package spring-boot:repackage.

With the goal added, you have to call only mvn package.

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <mainClass>com.places.Main</mainClass>
    </configuration>

    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Original Author Matej Of This Content

Solution 2

Advertisements

During the Maven package lifecycle phase, the jar archive is enhanced by Spring Boot Maven Plugin and the original jar file (that should have been built using the standard maven-jar-plugin) is replaced with an enhanced executable jar.

Hence you have either to issue the spring-boot:repackage goal yourself when building your module:

mvn package spring-boot:repackage

Or add the goal explicitly within the plugin configuration:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <mainClass>com.places.Main</mainClass>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

You can find more details about the Spring Boot Maven Plugin repackage goal within the official documentation.

Original Author tmarwen Of This Content

Solution 3

Advertisements

3 things:
– You have the parent entry in your pom.
– Verify that your plugin is in the build portion of the pom.
– You have a class with the @SpringBootApplicaion annotation.

pom.xml:

...  
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
  </parent>

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

And a class that looks something like this:

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

Original Author MattC Of This Content

Solution 4

Advertisements

You can specify a parent POM e.g. :

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.1.4.RELEASE</version>
</parent>

During the package goal, the repackage goal will be executed and you’ll then get an executable jar.

Original Author laurentJ Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment