初学MAVEN之mvn archetype:generate失败

跟着网上的教程学习maven。
第一步当然是安装和环境变量配置,相信大家都没有什么问题。值得一提的是,官方所提到的配置文件settings.xml的两个目录中,${maven.home}/conf/settings.xml的maven.home是你自己定义的环境变量目录,而${user.home}/.m2/settings.xml的user.home则是你请求命令时自动生成的目录,位置是C:\Users\用户名\.m2。这个小问题我倒是还纠结了一会,索性写出来。
安装成功后需要测试是否安装成功,在cmd操作台上面输入:mvn -v。有如下界面的表示maven安装成功。
初学MAVEN之mvn archetype:generate失败_第1张图片
第二步是,选择一个目录,建立项目原型。这一步需要获得与maven中央仓库的连接,从中央仓库下载jar依赖到本地仓库。在这里我没有修改settings.xml中关于本地仓库的配置,所以默认地址是${user.home}/.m2。我选择f盘下的一个目录操作。如下
在这里插入图片描述
到这里,基本上各种教程都会要求大家在cmd中输入:mvn archetype:generate。可是问题也出现在这里,无论我怎么尝试,命令操作都是失败的。

F:\demo>mvn archetype:generate
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.4: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.4
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins

你可能感兴趣的:(初学MAVEN,maven,java)