gpt4 book ai didi

java - 当我创建新项目时,Maven 插件未下载或解析

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

我对maven很陌生,正准备开始使用maven学习spring,但是当我在eclipse中使用maven创建我的第一个项目时,发生了这个错误,我认为maven插件没有被下载。我尝试了 stackoverflow 上的几种解决方案,但没有任何效果。

控制台窗口就像:-

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.097 s
[INFO] Finished at: 2020-06-01T21:17:39-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/NoGoalSpecifiedException

错误窗口是这样的:-

请查看此屏幕截图以获取错误的确切信息。

Screenshot attached

POM.xml 文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.anuragr07</groupId>
<artifactId>springpractice</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>

到目前为止尝试过的解决方案:-

  1. 使用帮助>安装新软件选项安装maven
  2. 尝试使用 cmd 进行 mvn install
  3. 尝试在setting.xml 文件中取消注释代理标记
  4. 尝试在 settings.xml 文件的代理标记中使用“https”而不是“http”
  5. 尝试重新安装 eclipse

也许还有更多..

mvn包之后

E:\Workspace\springpractice>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.anuragr07:springpractice >--------------------
[INFO] Building springpractice 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom

**Downloaded all the plugins**

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.831 s
[INFO] Finished at: 2020-06-01T23:52:35-07:00
[INFO] ------------------------------------------------------------------------

我真的很沮丧,并在过去 24 小时内寻找解决方案。请帮我解决这个问题。

谢谢!

最佳答案

给定的错误是默认目标的原因。

错误 尚未为此构建指定目标。您必须以 : 或 :[:]: 格式指定有效的生命周期阶段或目标。

分辨率:

在运行配置中指定 Maven 构建的任何目标,例如清除、编译、安装、打包。

安装...

您可以引用给定的步骤吗?

  • 右键单击您的项目。
  • 点击“运行方式”并选择“Maven 构建”
  • 编辑配置窗口将打开。
  • 写任何目标,但具体问题写“package”在“目标”文本框中。
  • 点击“运行”

关于java - 当我创建新项目时,Maven 插件未下载或解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62144903/

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