亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

包 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條經驗 獲得超13個贊

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 關注
  • 625 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號