Maven 常用命令

來源:互聯網
上載者:User

Maven 安裝,請見我先前的部落格:Linux 搭建 maven

Maven 常用命令:

  • 建立一個簡單的Java工程:mvn archetype:create -DgroupId=com.mycompany.example -DartifactId=Example
  • 創 建一個java的web工程:mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.mycompany.app -DartifactId=my-webapp
  • 打包:mvn package
  • 編譯:mvn compile
  • 編譯測試程式:mvn test-compile
  • 清空:mvn clean
  • 運行測試:mvn test
  • 產生網站目錄: mvn site
  • 產生網站目錄並發布:mvn site-deploy
  • 安裝當前工程的輸出檔案到本地倉庫: mvn install
  • 安 裝指定檔案到本地倉庫:mvn install:install-file -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=1.0.0 -Dpackaging=jar -Dfile=<myfile.jar>
  • 查看實際pom資訊: mvn help:effective-pom
  • 分析項目的依賴資訊:mvn dependency:analyze 或 mvn dependency:tree
  • 跳過測試回合maven任務:    mvn -Dmaven.test.skip=true XXX
  • 產生eclipse專案檔: mvn eclipse:eclipse
  • 查看協助資訊:mvn help:help 或 mvn help:help -Ddetail=true
  • 查看外掛程式的協助資訊:mvn <plug-in>:help,比如:mvn dependency:help 或 mvn ant:help 等等。

Maven 協助命令:

協助格式: mvn cmd:help

eclipse協助: mvn eclipse:help

install協助: mvn install:help

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.