使用maven在java中创建新项目

时间:2014-10-18 16:39:01

标签: java maven

我想用maven创建一个java项目,当我在cmd中输入这个命令而不是创建一个项目它会产生一些错误,我想这是因为一些互联网问题,但我不知道如何解决它。我没有使用任何代理,即使我的电脑的防火墙已关闭,我也尝试过这个命令。 我在cmd中写的命令是:

mvn archetype:generate -DgroupId=com.companyname.bank -DartifactId=consumerBanking -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

rezult是:

[INFO] Scanning for projects...
Downloading: 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: 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
.
.
.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.167 s
[INFO] Finished at: 2012-05-18T21:09:38-07:00
[INFO] Final Memory: 3M/254M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\a\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 

1 个答案:

答案 0 :(得分:1)

你是在2014年发布的,但是日志说:

[INFO] Finished at: 2012-05-18T21:09:38-07:00

如果您的本地时钟错误,SSL将无效,因为证书似乎无效,您与https://repo.maven.apache.org/的连接将失败。

修复你的时钟。