WSO2:找不到org.apache.maven.plugins:maven-compiler-plugin.jar:3.2.3

时间:2014-12-18 12:50:38

标签: maven wso2 wso2-emm

我正在尝试运行mvn clean install(在Windows上),我收到以下错误:

    [ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:3.2.3 or one of its dependencies could not be resolved: Failure to find 
org.apache.maven.plugins:maven-compiler-plugin:jar:3.2.3 in http://dist.wso2.org
/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of wso2-maven2-repository-1 has elapsed or updates are forced -> [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/PluginResolutionException

由于这是我与maven合作的第一个项目,我不知道如何解决这个问题......

谢谢!

1 个答案:

答案 0 :(得分:3)

检查目录.m2 / repository / org / apache / maven / plugins / maven-compiler-plugin / 3.2.3中的存储库中是否没有_maven.repositories或* .lastUpdated文件。 如果找到则删除它们 接下来,您应该删除对pom.xml文件中的http://dist.wso2.org/maven2和您的settings.xml(在/home/.m2)文件中的引用,因为maven编译器插件版本3.2.3不在此存储库中。
(Maven中央存储库是http://repo1.maven.org/maven2/)。在那里我找到了编译器插件版本3.2。它似乎是最新版本http://maven.apache.org/plugins/index.html
因此,如果使用此存储库,请将pom.xml中的版本更改为3.2 完成后再次构建。

在pom.xml中,您可以在<pluginManagement>部分设置插件版本:

  <project>
    ...
    <build>
      ...
      <pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
          </plugin>
        </plugins>
       </pluginManagement>
     </build>
   </project>

下面是一个最小的settings.xml,用于开始使用maven中央存储库(使用您自己的更改$ {unsername}):

<settings>
  <localRepository>C:\Users\${username}\.m2\repository</localRepository>
    <repositories>
      <repository>   
        <releases>
          <enabled>true</enabled>
        </releases>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>  
        <id>central</id>
        <name>central repository</name>
        <url>http://repo1.maven.org/maven2</url>      
      </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <id>central</id>
          <name>central repository</name>
          <url>http://repo1.maven.org/maven2</url>
        </pluginRepository>
      </pluginRepositories>
    </settings>