swagger-api / swagger-api/swagger-codegen

Spring MVC - mvn package leads to "no main manifest attribute"

Open
#2,345 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted Issue: Bug Server: Spring
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a Spring MVC server generated using Swagger.. And normally, to start it we use mvn jetty:run.. But I'd like to create a JAR file that I can launch afterwards.. So, to do that, I use the command mvn package and it creates correctly the JAR file in the target folder.

But when I try to start it using the command java -jar swagger-spring-mvc-server-1.0.0.jar, I get this error: no main manifest attribute, in swagger-spring-mvc-server-1.0.0.jar.

If I'm right, this problem happens because the Main.class is missing.. But I didn't find any main classes in the generated code.

Does anyone knows if I'm doing something wrong?? Or if there's another way to get the JAR file?
Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by examining the generated Spring MVC server's Maven packaging configuration and how mvn package produces the JAR, then compare it with the mvn jetty:run entry point; done means the supported way to launch the generated server is clear and the reported JAR behavior is resolved or documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.