第一次通过命令行创建maven项目。结果,果不其然啊,还是出问题了,不过出问题比没有出问题强,知道哪里有问题并学会解决也是一种收获。
遇到的第一个问题,在从仓库下载东西的时候会卡住,我开始以为是网速问题,等了好一会儿发现还是没动静。突然想起来视频里说从默认的中央仓库中下载失败率会很高。于是乎采用了视频里提到的英国的一个仓库。果然速度上来了,但还是有点慢,而且遇到了第二个问题。
第二问题是,在从仓库下载构件的最后出现了如下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate failed: Plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.1 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.archetype:archetype-descriptor:jar:3.0.1, org.apache.maven.archetype:archetype-common:jar:3.0.1, org.codehaus.plexus:plexus-component-annotations:jar:1.6, xml-apis:xml-apis:jar:1.0.b2, jdom:jdom:jar:1.0, org.apache.maven:maven-artifact:jar:3.0, org.apache.maven:maven-settings-builder:jar:3.0, commons-io:commons-io:jar:2.2, org.codehaus.plexus:plexus-velocity:jar:1.1.8, org.apache.velocity:velocity:jar:1.7, commons-lang:commons-lang:jar:2.4, org.apache.maven.wagon:wagon-provider-api:jar:2.8, org.codehaus.groovy:groovy:jar:1.8.3, antlr:antlr:jar:2.7.7, asm:asm:jar:3.2, asm:asm-commons:jar:3.2, asm:asm-util:jar:3.2, asm:asm-analysis:jar:3.2, asm:asm-tree:jar:3.2, org.codehaus.plexus:plexus-utils:jar:3.0.21, org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-6, org.apache.maven:maven-plugin-api:jar:3.0, org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2, org.sonatype.sisu:sisu-inject-bean:jar:1.4.2, org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7, org.apache.maven:maven-core:jar:3.0, org.apache.maven:maven-repository-metadata:jar:3.0, org.apache.maven:maven-model-builder:jar:3.0, org.apache.maven:maven-aether-provider:jar:3.0, org.sonatype.aether:aether-impl:jar:1.7, org.sonatype.aether:aether-spi:jar:1.7, org.sonatype.aether:aether-api:jar:1.7, org.sonatype.aether:aether-util:jar:1.7, org.codehaus.plexus:plexus-interpolation:jar:1.14, org.codehaus.plexus:plexus-classworlds:jar:2.2.3, org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3, org.sonatype.plexus:plexus-cipher:jar:1.4, org.apache.maven:maven-model:jar:3.0, org.apache.maven:maven-settings:jar:3.0, org.apache.maven.shared:maven-invoker:jar:2.2, org.apache.maven.shared:maven-artifact-transfer:jar:0.9.0, org.apache.maven.shared:maven-common-artifact-filters:jar:3.0.0, org.apache.maven.shared:maven-shared-utils:jar:3.0.0, com.google.code.findbugs:jsr305:jar:2.0.1, commons-codec:commons-codec:jar:1.6, org.slf4j:slf4j-api:jar:1.7.5, commons-collections:commons-collections:jar:3.2.1, org.apache.maven.shared:maven-script-interpreter:jar:1.0, org.beanshell:bsh:jar:2.0b4, org.apache.ant:ant:jar:1.8.1: Could not transfer artifact org.apache.maven.archetype:archetype-descriptor:jar:3.0.1 from/to UK (http://uk.maven.org/maven2): uk.maven.org: Unknown host uk.maven.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
有人的解决办法是用阿里云的仓库,于是接着换仓库。。。。。
换了之后,我去,,,速度飞起啊,顺利创建项目。真的要感谢我的马爸爸搞了这么个好东西。
配置如下:
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>