gpt4 book ai didi

eclipse - 无法理解使用 Eclipse 的 Maven pom 文件

转载 作者:行者123 更新时间:2023-12-02 21:19:26 25 4
gpt4 key购买 nike

我对 Maven 非常陌生,我正在创建我的第一个 Maven 项目 maven-archetype-quickstart enter image description here

enter image description here

然后它生成错误消息::

enter image description here

但是在我的项目资源管理器中:

enter image description here

我无法理解为什么它每次在我的项目和 pom.xml 文件中显示红色警告标记时都会创建一个正确的 Maven 项目。

> pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.akash</groupId>
<artifactId>feind</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>feind</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

设置.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<!-- Change username in below line -->
<localRepository>/Users/COACH/.m2/repository</localRepository>

<interactiveMode>true</interactiveMode>

<offline>false</offline>

<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>

<proxies>
<!--
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>

<servers>
<!--
<server>
<id>deploymentRepo</id>
<username>crunchify</username>
<password>crunchify</password>
</server>
-->
</servers>

<mirrors>
<!--
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>mirror description</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
</mirrors>

<profiles>
</profiles>

</settings>

我无法理解为什么每次都会发生这种情况,而且我的 .m2\repository 文件夹也是空的。请建议我一些修复它并正确运行 Maven 项目的步骤。

最佳答案

由于我不在任何代理后面,所以我不需要担心 settings.xml 文件,我刚刚删除了 .m2 文件夹,只是尝试再次创建一个 Maven 项目并且maven本身会自动下载所需的依赖。

至此问题就解决了。

关于eclipse - 无法理解使用 Eclipse 的 Maven pom 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58589259/

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