Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load Main-Class manifest attribute while running java -jar

I have successfully built my Spring MVC project with mvn clean package by following this tutorial.

Now I am trying to run the service with:

mvn clean package && java -jar target/gs-serving-web-content-0.1.0.jar

But I get this error:

Failed to load Main-Class manifest attribute from target/gs-serving-web-content-0.1.0.jar

Am I missing something?

like image 701
Simone Avatar asked Oct 27 '13 16:10

Simone


2 Answers

If you are working with Spring Boot this will solve your problem:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.2.5.RELEASE</version>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

Reference Guide | Spring Boot Maven Plugin

like image 96
Mradul Pandey Avatar answered Nov 04 '22 13:11

Mradul Pandey


You might be missing Spring Boot Maven Plugin.

<plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
like image 38
Atish Narlawar Avatar answered Nov 04 '22 12:11

Atish Narlawar