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

java, maven, spring, spring-mvc

Solution

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

Problem

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?

Original source

Related problems