且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

泽西岛2.0“入门”指南,找不到mainClass

更新时间:2023-11-15 13:05:40

我能够重现你的错误。这跟泽西没什么关系;这是你用Maven制作的一个错误。 mvn clean exec:java 说:删除所有.class文件,然后尝试运行 Main .class文件。由于你删除了它,Maven找不到它。这是一个解决方案:

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

这应该可以解决您问题中的问题。这说删除所有.class文件,从源代码重新编译它们然后尝试运行 Main .class文件

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"

要了解您将看到的下一个错误,请从pom.xml中的客户端依赖项中删除< scope> test< / scope> 行: / p>

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>

收件人:

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