Jersey 2.0 “Getting Started” guide, mainClass not found

前端 未结 1 2228
太阳男子
太阳男子 2021-02-20 18:40

Hi I am trying to follow the Getting Started guide for Jersey 2.0.

I did steps 1.1 and 1.2 as is. No problem there.

For step 1.3 I had a problem cause maven coul

相关标签:
1条回答
  • 2021-02-20 19:34

    I am able to reproduce your error. This has nothing to do with Jersey; it's an error you're making with Maven. mvn clean exec:java says: "delete all the .class files and then try to run the Main .class file". Since you deleted it, Maven can't find it. Here's a solution:

    mvn clean compile exec:java
    

    This should fix the problem in your question. This says "delete all the .class files, recompile them from source and then try to run the Main .class file"

    To get past the next error you'll see, delete the <scope>test</scope> line from the client dependency in the pom.xml:

    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <scope>test</scope>
    </dependency>
    

    To:

    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题