gpt4 book ai didi

java - 使用 Maven 创建基础项目时出错?

转载 作者:行者123 更新时间:2023-12-01 05:07:01 25 4
gpt4 key购买 nike

我们的机器上有 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] ------------------------------------------------------------------------

我们的服务器位于防火墙后面。可能是什么原因以及解决办法?

最佳答案

关于什么

Warning: JAVA_HOME environment variable is not set.  

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

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

关于java - 使用 Maven 创建基础项目时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12511758/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com