4

在我的 Eclipse 中,我创建了一个新项目,即 New -> Other-> Spring -> Spring Template Project -> Spring MVC Project。

在 pom 我得到以下错误:

在这一行找到多个注释:-生命周期配置未涵盖插件执行:org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile(执行:默认-编译,阶段:编译)-CoreException:可以不计算构建计划:插件 org.apache.maven.plugins:maven-compiler-plugin:2.5.1 或其依赖项之一无法解析:无法读取 org.apache.maven.plugins:maven-compiler 的工件描述符-plugin:jar:2.5.1: ArtifactResolutionException: 传输 org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 失败
repo.maven.apache.org/maven2 缓存在本地存储库中,直到中央的更新间隔过去或强制更新后才会重新尝试解析。原始错误:无法将工件 org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 从/到中央 repo.maven.apache.org/maven2): null 到 repo.maven.apache.org /maven2/org/apache/maven/plugins/maven-compiler-plugin/2.5.1/maven-compiler-plugin-2.5.1.pom - 生命周期配置未涵盖插件执行:org.apache.maven.plugins:maven -compiler-plugin:2.5.1:testCompile(执行:default-testCompile,阶段:test-compile) -CoreException:无法计算构建计划:插件 org.apache.maven.plugins:maven-compiler-plugin:2.5.1或其依赖项之一无法解析:

我确实删除了存储库文件夹和 Maven -> 更新项目。但没有任何效果。

错误来自以下标签:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
</plugin>
4

4 回答 4

11

如果其他人也有这个问题,在我的情况下通过选择 Maven -> Update Project 解决了这个问题

于 2014-04-02T02:50:16.143 回答
1

我遇到了同样的问题。我有一堆公司项目,我们有自己的内部 maven repo 和 settings.xml。

但是当我想创建一个通用项目时,它向我抛出了这些错误。我在 Mac 上工作,所以在 eclipse > 首选项 > maven > 用户设置中,我将路径更改为指向 /usr/local/apache-maven/apache-maven-3.2.1/conf/settings.xml 这是全局路径指向 ~/.m2/settings.xml 这是我们本地公司的基础。

更改设置,然后右键单击项目并执行“Maven -> 更新项目”

希望这可以帮助

于 2014-10-23T20:01:59.780 回答
0

我发现问题出在 settings.xml 的配置中

当我连接到我公司的网络并更新我公司存储库的 settings.xml 时,它似乎可以工作。我可以问一下标签的默认配置是什么,在这种情况下我可以让我的示例应用程序(不是特定于公司,而是)运行。在我的 settings.xml 中,我更新了以下标签:

<server>
    <id>myID</id>
    <username>myuser</username>
    <password>myPassword</password>
</server>
<mirrors>
    <mirror>
        <id>mirrorId</id>
        <mirrorOf>repositoryId</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://my.repository.com/repo/path</url>
    </mirror>
</mirrors>
<profile>
    <id>nexus</id>
    <repositories>
        <repository>
            <id>central</id>
            <url>http://central</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>http://central</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</profile>
</profiles>

上述用于运行/创建 Web 应用程序的标签的默认配置是什么?

于 2013-03-12T10:26:46.253 回答
0

它通过进行项目更新来工作:右键单击项目-->Maven-->

于 2015-02-01T20:26:23.907 回答