当前位置: 首页 > 知识库问答 >
问题:

使用Maven创建基本项目时出错?

黄君博
2023-03-14

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

mvn原型:创建-e-Darch etypeGroupId=com.jivesoftware.maven-Darch etypeartifactId=maven-jive-plugin-ArchetypeVersion=5.0.2-SNAPSHOT-Dgroup pId=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] ------------------------------------------------------------------------

我们的服务器在防火墙后面。它的原因和解决方案是什么?

共有1个答案

袁阿苏
2023-03-14

什么是关于

Warning: JAVA_HOME environment variable is not set.  

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

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

 类似资料:
  • 我在Eclipse中创建maven项目时遇到了一个问题。发生以下错误: 无法计算生成计划:Plugin org.apache.maven。plugins:maven-resources-plugin:2.6或其一个依赖项无法解析:读取org.apache.maven的工件描述符失败。plugins:maven-resources-plugin:jar:2.6 pluginorg.apache.ma

  • 用了这里提到的步骤 使用的命令行: 执行目标org.apache.maven.plugins失败:maven-arch etype-plugin:3.1.2:在项目练习中生成(default-cli)一:执行目标org.apache.maven.pluginsdefault-cli:maven-arch etype-plugin:3.1.2:生成失败:执行org.apache.maven.plug

  • 我正在使用eclipse、m2eclipse插件和maven创建一个新的maven项目,遵循以下步骤,http://o7planning.org/en/10101/install-maven-into-eclipse 但是,当创建一个新的maven项目时,没有JRE系统库,也没有maven库。只有如下所示的src、target和pom.xml。这正常吗?如果没有,我该如何避免呢?谢谢! 单击以获取

  • 问题内容: 当我尝试创建一个新的Maven项目(具有多个原型,不仅是下面的一个)时,我遇到此错误: 有谁知道为什么会这样,如何解决? 问题答案: 您的目录似乎不为空。此命令行对我有用:(在空目录中) 结果是: 我可以通过在新创建的目录中执行以下命令行来重现您的错误:

  • mvn-版本 Apache Maven 3.6.1(d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555;2019-04-04T21:00:29 02:00)Maven主页:C:\Apps\Apache-Maven-3.6.1\bin。。Java版本:11.0.13,供应商:Oracle Corporation,运行时:C:\Apps\jdk-11.0.13_windo

  • 无法计算生成计划:Plugin org.apache.maven。plugins:maven-resources-plugin:2.5或其一个依赖项无法解析:读取org.apache.maven的项目描述符失败。plugins:maven-resources-plugin:jar:2.5 pluginorg.apache.maven。plugins:maven-resources-plugin:2