0

I'm trying to run mvn clean install (on windows) and I'm getting the following error:

    [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

Since this is the first project I'm working with maven, I have no idea how can I fix that...

Thanks!

Community
  • 1
  • 1
Sharas
  • 1,985
  • 3
  • 20
  • 43

1 Answers1

3

Check if you have no _maven.repositories or *.lastUpdated files in your repository in the directory .m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.2.3. If found then delete them.
Next you should remove reference to http://dist.wso2.org/maven2 in your pom.xml file and your settings.xml (in /home/.m2) file since the maven compiler plugin release 3.2.3 in not in this repository.
(Maven central repository is http://repo1.maven.org/maven2/). There I found the compiler plugin release 3.2. and it seems to be the latest release http://maven.apache.org/plugins/index.html.
Therefore if you use this repository change the version in your pom.xml to 3.2.
When done run you build again.

In the pom.xml you ca set the plugin release in the <pluginManagement> section:

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

And here below a minimal settings.xml to start working with maven central repository (change ${unsername} with your own):

<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>
Olivier Meurice
  • 554
  • 8
  • 17
  • Hi, Thanks a lot for your help! I can't find any settings.xml file and I can't find where should i change the reference from 3.2.3 to 3.2, can you please direct me to the file? – Sharas Dec 21 '14 at 06:48
  • @Sharas, I edit the answer. The location of settings.xml is already in the answer. – Olivier Meurice Dec 21 '14 at 09:26
  • @OliverMeurice Thanks, but i don't have settings.xml under this location... and no matter what i'm trying to do, it still tries to download version 3.2.3. BTW, I'm running on Windows (of course i checked under /users/.../.m2 directory) – Sharas Dec 21 '14 at 09:29
  • If you don't find one you have to create one and place the file in that location. Under Windows: c:\Users\${username}\.m2\settings.xml. I gonna put a minimal example in the answer too. – Olivier Meurice Dec 21 '14 at 09:35
  • Hi @OliverMeurice, thanks for the detailed answer. I don't see my pom.xml has a section and neither section. this is the original pom.xml https://github.com/wso2/product-cdm/blob/master/pom.xml, should i add this section? Thanks again! – Sharas Dec 21 '14 at 10:12
  • Yes, please. Add a section for the . The parent pom is the right place to include it. – Olivier Meurice Dec 21 '14 at 12:30
  • Hi @OliverMeurice, eventually, i download the source again, removed http://dist.wso2.org/maven2 repository from pom.xml as you suggested and started to build (mvn clean install), then i started to get different errors on different plugins, so i updated their version in my pom.xml according to the link you gave me and finally, completion finished successfully. THANK YOU VERY MUCH! – Sharas Dec 21 '14 at 12:43