NateH06
NateH06

Reputation: 3594

Can't run .jar because "no main manifest attribute"

I've never built an executable .jar before, and I'm trying to do so with a Maven project with IntelliJ, and I can't seem to run the program. I've done it through the Project Structure -> artifacts route, and I've set the main class and locations properly or so I thought, in the configuration:

in my pom.xml

        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>repackage</goal>
                </goals>
                <configuration>
                    <classifier>spring-boot</classifier>
                    <mainClass>
                        app.ContactRunner
                    </mainClass>
                </configuration>
            </execution>
        </executions>
    </plugin>

And here's a screenshot of the project structure along with the MANIFEST.MF

Screenshot

What's missing that I need to add in order to execute this jar? Thanks for the help!

EDIT-=-=-=

I have removed the packaging structure, and it is now just app.ContactRunner with nothing extra in the MANIFEST file.

Upvotes: 3

Views: 21705

Answers (1)

NateH06
NateH06

Reputation: 3594

I had to move where the MANIFEST folder was. It was putting it under

/src/main/java/

and it needed to be under

/src/main/resources

As taken from this answer: https://stackoverflow.com/a/21074091/7082628

Upvotes: 3

Related Questions