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

為了賬號安全,請及時綁定郵箱和手機立即綁定

mvn jetty:run的目的是什么

訪問的時候直接在地址欄輸入訪問的網址就可以了,為什么每次都要先執行mvn jetty:run命令呢?


正在回答

2 回答

???,不啟動項目你怎么輸入網站

0 回復 有任何疑惑可以回復我~

mvn:一種代碼管理工具,也負責依賴包的管理。比如你可以加入jetty的maven插件像這樣:

<plugins>

? ? ? ? <plugin>

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

? ? ? ? ? <artifactId>jetty-maven-plugin</artifactId>

? ? ? ? ? <version>9.4.8.v20171121</version>

? ? ? ? </plugin>

? ? ? </plugins>


jetty:servlet容器。也可以認為是運行環境。Javaweb程序的根基是servlet(jsp也是特殊的servlet,框架的根基也是。),頁面的呈現啊、頁面的跳轉啊所有網頁的相關功能都是由servlet來處理。Javase部分并不負責servlet運行相關的條件,需要外部容器,這個容器可以是各種各樣的,例如jetty、tomcat。這里的容器也可以看成你工程的“服務器”了。Linux部署完成這些容器后,打包發布工程,本地點擊瀏覽器就能看見你的網頁了。


mvn jetty:run:則是要求工程運行到jetty的命令,意思是:“工程??!你在jetty里面奔跑起來吧!”,官網對它的描述是:

The plugin automatically ensures the classes are rebuilt and up-to-date before deployment. If you change the source of a class and your IDE automatically compiles it in the background, the plugin picks up the changed class.

You do not need to assemble the webapp into a WAR, saving time during the development cycle. Once invoked, you can configure the plugin to run continuously, scanning for changes in the project and automatically performing a hot redeploy when necessary. Any changes you make are immediately reflected in the running instance of Jetty, letting you quickly jump from coding to testing, rather than going through the cycle of: code, compile, reassemble, redeploy, test.

這里面提到了只要運行起來,每次修改完成代碼后,其實也不需要重新啟動了。

以上是我的理解。


2 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Spring MVC起步
  • 參與學習       195952    人
  • 解答問題       609    個

Java中Spring MVC框架入門教程,快來看最易用的MVC框架

進入課程

mvn jetty:run的目的是什么

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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