【环境搭建】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 settings.xml 详解
  3. 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>

参考

使用maven创建项目
mvn archetype:generate does not work-no plugin found for prefix ‘archetype’

Maven之(六)setting.xml配置文件详解
maven mirror
maven settings

maven国内镜像(maven下载慢的解决方法)

猜你喜欢

转载自blog.csdn.net/guodonggang/article/details/81430128