1. 程式人生 > >【環境搭建】maven命令建立webapp專案

【環境搭建】maven命令建立webapp專案

環境:
MacBook Pro 15
jdk8
IntelliJ IDEA

建立webapp專案maven命令:
mvn archtype:create -DgroupId=org.seckill -DartifactId=seckill
-DarchetypeArtifactId=maven-archetype-webapp

問題:使用命令報錯:

No plugin found for prefix ‘archtype’ in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/foxsquirrel/.m2/repository), Kousihao Maven (

http://repo1.maven.org/maven2)] -> [Help 1]

這裡寫圖片描述

解決:

更換命令:mvn archetype:generate

TIPS:

  1. mvn archetype:generate 命令需要手動選擇archtype,預設選中的是“org.apache.maven.archetypes:maven-archetype-quickstart”,一般常用的archtype就在quickstart附近,拖拽查詢number即可。
  2. maven幾個mirror:
<mirrors>
    <mirror>
      <id>Kousihao Maven</id>
      <name>all repository mirror</name>
      <url>http://repo1.maven.org/maven2</url>
<mirrorOf>*</mirrorOf> </mirror> <mirror> <id>ibiblio.org</id> <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name> <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>jboss-public
-repository-group</id> <mirrorOf>central</mirrorOf> <name>JBoss Public Repository Group</name> <url>http://repository.jboss.org/nexus/content/groups/public</url> </mirror> </mirrors>

參考