Search code examples
javaeclipsemavenm2eclipsests-springsourcetoolsuite

How to configure Eclipse m2 plugin to find my enterprise repository?


I'm having trouble figuring out how to configure SpringSource Tool Suite's m2 plugin. In order to get maven to work from the command line, I had to point to our enterprise repository in the settings.xml file.

If I try to build inside STS, I get the following:

[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/mycompany/maven/adp/adp-base-pom/1.0.14/adp-base-pom-1.0.14.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.mycompany.edelivery:edelivery-build:current 
(C:\code\workspace\edelivery-build\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not transfer artifact 
com.mycompany.maven.adp:adp-base-pom:pom:1.0.14 from/to central 
(http://repo1.maven.org/maven2): ConnectException and 'parent.relativePath' 
points at wrong local POM @ line 4, 
column 11: UnresolvedAddressException -> [Help 2]
[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.

I presume that I need to tell STS where the enterprise repository is, how do I do that? The only thing I find under File -> Properties is a field for Active Maven Profiles and that didn't help.

Here is a snippet from the settings.xml file, what do I do with this information?

<profile>
  <id>internal-profile</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>
  <pluginRepositories>
    <pluginRepository>
      <releases>
        <updatePolicy>always</updatePolicy>
      </releases>
      <name>Enterprise Plugin Repository</name>
      <url>http://svn01g.gdc.nwie.net/maven2/enterprise</url>
    </pluginRepository>
  </pluginRepositories>
  <repositories>
    <repository>
      <id>internal-release</id> 
      <name>MyCompany Enterprise Repository</name>
      <url>http://svn01g.gdc.nwie.net/maven2/enterprise</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
</profile>  

Solution

  • Assuming you're using release 0.12.1 or earlier of the m2eclipse plugin, all you should have to do is point m2eclipse to your local maven installation. Choose Window -> Preferences -> Maven -> Installations, click Add... and browse to the root of your Maven installation. Remember you need to do this again whenever you switch to a new workspace.