无法访问 Java 库
Cannot access Java library
注意:我asking/answering这个问题是因为我没有在其他地方找到我的解决方案。
当我尝试 运行 我的 maven 项目时,我的 ServerMain.java 文件中收到以下错误消息:
cannot access org.eclipse.jetty.util.thread.ThreadPool
我有 jar 文件,我在 pom.xml 文件中添加了 org.eclipse.jett:jetty-util
,但无论我如何添加库,我仍然无法访问它。这是它如何包含在我的 pom.xml
中
<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.1.5.v20140505</version>
<scope>test</scope>
</dependency>
我明白是怎么回事了。我需要从 xml 中删除 <scope>
标签。我不确定它最初是如何出现的,因为 Maven 站点不限制 jetty-util 的范围。需要像这样包含依赖项
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.1.5.v20140505</version>
</dependency>
注意:我asking/answering这个问题是因为我没有在其他地方找到我的解决方案。
当我尝试 运行 我的 maven 项目时,我的 ServerMain.java 文件中收到以下错误消息:
cannot access org.eclipse.jetty.util.thread.ThreadPool
我有 jar 文件,我在 pom.xml 文件中添加了 org.eclipse.jett:jetty-util
,但无论我如何添加库,我仍然无法访问它。这是它如何包含在我的 pom.xml
<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.1.5.v20140505</version>
<scope>test</scope>
</dependency>
我明白是怎么回事了。我需要从 xml 中删除 <scope>
标签。我不确定它最初是如何出现的,因为 Maven 站点不限制 jetty-util 的范围。需要像这样包含依赖项
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.1.5.v20140505</version>
</dependency>