为了账号安全,请及时绑定邮箱和手机立即绑定

包 org.mortbay.http 不存在。如何在 pom.xml 中为此添加依赖项

包 org.mortbay.http 不存在。如何在 pom.xml 中为此添加依赖项

江户川乱折腾 2021-07-22 18:04:06
我正在尝试使用 maven 构建我的 java 项目。编译时出现以下错误 -package org.mortbay.http does not exist package org.mortbay.jetty does not exist package org.mortbay.jetty.servlet does not exist我在pom.xml文件的最后添加了这些依赖项-<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server --><dependency>    <groupId>org.eclipse.jetty</groupId>    <artifactId>jetty-server</artifactId>    <version>9.3.15.v20161220</version></dependency><!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-http --><dependency>    <groupId>org.eclipse.jetty</groupId>    <artifactId>jetty-http</artifactId>    <version>9.4.11.v20180605</version></dependency><!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty-util --><dependency>    <groupId>org.mortbay.jetty</groupId>    <artifactId>jetty-util</artifactId>    <version>6.1.25</version></dependency>我正在使用SocketListener listener = new SocketListener();和ServletHttpContext类。我需要在我的 java 类中进行哪些更改?
查看完整描述

2 回答

?
红颜莎娜

TA贡献1842条经验 获得超12个赞

org.mortbay.jetty已被替换org.eclipse.jetty(参见maven jetty - org.mortbay.jetty vs org.eclipse.jetty)。


您应该使用以下依赖项:


<dependency>

    <groupId>org.eclipse.jetty</groupId>

    <artifactId>jetty-server</artifactId>

    <version>9.4.11.v20180605</version>

</dependency>

<dependency>

    <groupId>org.eclipse.jetty</groupId>

    <artifactId>jetty-http</artifactId>

    <version>9.4.11.v20180605</version>

</dependency>

<dependency>

    <groupId>org.eclipse.jetty</groupId>

    <artifactId>jetty-util</artifactId>

    <version>9.4.11.v20180605</version>

</dependency>

<dependency>

    <groupId>org.eclipse.jetty</groupId>

    <artifactId>jetty-servlets</artifactId>

    <version>9.4.11.v20180605</version>

</dependency>

和包:


org.eclipse.jetty.server

org.eclipse.jetty.http

org.eclipse.jetty.servlets

此外,尽量避免混合不同版本的 Jetty 工件。


查看完整回答
反对 回复 2021-07-29
?
catspeake

TA贡献1111条经验 获得超0个赞

我找到了正确的依赖版本,涵盖了我遇到的所有错误。


<dependency>

    <groupId>org.mortbay.jetty</groupId>

    <artifactId>jetty</artifactId>

    <version>4.2.9</version>

</dependency>

有了这个依赖,我就能够构建我的项目并从中导出一个 jar。


查看完整回答
反对 回复 2021-07-29
  • 2 回答
  • 0 关注
  • 580 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信