1

我们的机器上有 Maven。我们正在使用Maven 2.2.1CentOS 6.0。当我们使用以下命令创建基础项目时

mvn archetype:create -e -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-plugin-archetype -DarchetypeVersion=5.0.2-SNAPSHOT -DgroupId=com.demo -DartifactId=jiveDemo

我们收到以下错误消息:-

Warning: JAVA_HOME environment variable is not set.

+ Error stacktraces are turned on.

[INFO] Scanning for projects...

[INFO] Searching repository for plugin with prefix: 'archetype'.

[INFO] org.apache.maven.plugins: checking for updates from central

[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: repo1.maven.org

[INFO] Repository 'central' will be blacklisted

[INFO] ------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO] ------------------------------------------------------------------------

[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found

[INFO] ------------------------------------------------------------------------

[INFO] Trace

org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)

at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)

at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)

at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)

at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:616)

at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)

at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)

at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found

at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229)

at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91)

at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179)

at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)

... 15 more

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 28 seconds

[INFO] Finished at: Tue Sep 18 13:39:38 IST 2012

[INFO] Final Memory: 2M/29M

[INFO] ------------------------------------------------------------------------

我们的服务器位于防火墙后面。可能是什么原因和解决方案?

4

1 回答 1

0

关于什么

Warning: JAVA_HOME environment variable is not set.  

这么复杂?这意味着只需将其定义为您的 Java 安装。此外,我建议从 Maven 3.0.4 开始,而不是从 2.2.1 开始。

除此之外,您还没有配置使用代理配置来访问 Maven 中心。最好的解决方案是使用存储库管理器。

于 2012-09-20T12:04:17.520 回答