首页 > 解决方案 > intellij maven 使用 localRepository 配置为插件“org.apache.maven.plugins:maven-compiler-plugin”提供错误解析版本

问题描述

我想使用 localRepository 而不是使用默认的 .m2 和默认值settings.xml ,所以我设置了 settings.xml 调用它my_settings.xml,在 intellij 中我这样调用它:

clean -s my_settings.xml install -f pom.xml

my_settings.xml 安装如下所示:

<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<localRepository>c:/Dev/my/java/dispatcherApp/local</localRepository>
<activeProfiles>
    <activeProfile>defaultMainProfile</activeProfile>
</activeProfiles>
<profiles>
    <profile>
        <id>defaultMainProfile</id>

        <pluginRepositories>

            <pluginRepository>
                <id>maven-central</id>
                <name>maven-central</name>
                <url>http://repo1.maven.org/maven2/</url>
            </pluginRepository>
            <pluginRepository>
                <id>sonatype</id>
                <name>sonatype</name>
                <url>http://oss.sonatype.org/content/repositories/releases/</url>
            </pluginRepository>

        </pluginRepositories>
    </profile>
</profiles>
</settings>

但是在执行它时我得到:

[ERROR] Error resolving version for plugin 'org.apache.maven.plugins:maven-compiler-plugin' from the repositories [local (c:\Dev\my\java\dispatcherApp\local), maven-central (http://repo1.maven.org/maven2/), sonatype (http://oss.sonatype.org/content/repositories/releases/), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]

我需要下载 AWS SDK,在 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">
    <parent>
        <artifactId>dispatcherApp</artifactId>
        <groupId>com.dispatcherApp</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>aws-manager</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
        </dependency>
    </dependencies>
</project>

标签: javamavenintellij-idea

解决方案


推荐阅读