Jersey 2.0 “Getting Started” guide, mainClass not found

浪尽此生 提交于 2019-12-04 02:18:36
Daniel Kaplan

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!