0

I have a simple maven plugin which in turn depends on parent pom file. The parent pom file has ten (10 number of) 3rd party jar dependencies which have been installed in my local repo using the following command.

mvn install:install-file -Dfile=foo.jar -DgroupId=com.foo.bar -DartifactId=foo1.jar -Dversion=1.1.0.0 -Dpackaging=jar

Similarly I have installed all the other 9 jars to my local repo. This is the uber pom.xml file.

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.foo.bar</groupId>
  <artifactId>maven-uber-pom</artifactId>
  <packaging>pom</packaging>
  <version>1.1.0.0</version>
  <name>maven-uber-pom</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>com.foo.bar</groupId>
      <artifactId>foo1.jar</artifactId>
      <version>1.0.0.0</version>
    </dependency>
    <dependency>
      <groupId>com.foo.bar</groupId>
      <artifactId>foo2.jar</artifactId>
      <version>1.0.0.0</version>
    </dependency>
    <dependency>
      <groupId>com.foo.bar</groupId>
      <artifactId>foo3.jar</artifactId>
      <version>1.0.0.0</version>
    </dependency>
    <dependency>
      <groupId>com.foo.bar</groupId>
      <artifactId>foo4.jar</artifactId>
      <version>1.0.0.0</version>
    </dependency>
   :
   :
  </dependencies>

I am trying to reference this uber pom in my plugin's pom.xml file by the following:

<project>
  <parent>
    <groupId>com.foo.bar</groupId>
    <artifactId>maven-uber-pom</artifactId>
    <version>1.1.0.0</version>
  </parent> 
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.foo.bar</groupId>
  <artifactId>foo-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>1.1.0.0</version>
  <name>foo bar plugin</name>
  <url>http://maven.apache.org</url>
</project>

After this I try installing my plugin using the pom.xml file by

mvn install                  <command>

Maven tries to download the 3rd party artifact dependencies from central repo http://repo1.maven.org/maven2 and subsequently fails. As there is no artifact which such co-ordinates which can be found in the central repo.

I have also tried using the uber-pom as a plugin dependency since I was desperate. Any ideas?

Dhawan Gayash
  • 463
  • 1
  • 4
  • 17
  • If i look correctly you have installed a foo.jar but do not reference that artifact in your parent pom only foo1.jar, foo2.jar etc. Furthermore have you installed the mavenn-uber-pom via mvn install in your local repository ? I recommend to use a repository manager in particular if you have 3rd party jar's which might not be available in maven central. – khmarbaise May 03 '12 at 10:13
  • Thank you for pointing me this out. That was a typo have edited this. I have actually installed all the jars with the maven install:install-file into my local repo. – Dhawan Gayash May 04 '12 at 01:16
  • Has 'mvn install' been run on the parent POM project? If not, then it won't be found. – John Haager May 04 '12 at 22:29
  • I finally figured this solution for this. I added the uber pom as a maven dependency in my plugin. This is much simpler when compared inheritance of the parent pom. – Dhawan Gayash May 17 '12 at 19:45
  • I finally figured this solution for this. I added the uber pom as a maven dependency in my plugin. This is much simpler when compared inheritance of the parent pom. `code` com.foo.bar maven-uber-pom 1.1.0.0 pom – Dhawan Gayash May 17 '12 at 19:52

3 Answers3

0

By default Maven will search for dependencies in your local repositories first. If it doesn't find, it will then search on your global/custom repositories (by default only the central repository is set). Did you run mvn install on uberpom? And if so, check if it's path is correct in your local repo.

I'm not sure if you just forgot to adapt this to your example, but "uberpom" definition has com.foo.bar as groupId and the usage on your plugin has com.oracle.weblogic.test. It's probably a typo though. I also suppose that all your 3rd party dependencies were installed correctly (check their pom).

And just for the sake of it, check if <localRepository> is set in your settings.xml. Usually you don't have to set this, but give it a shot.

I'm not any expert but I hope it helps!

vitorrrr
  • 70
  • 7
  • I have set my localrepository to a customized location. I have edited the groupIds to match. This was a typo :-( my bad – Dhawan Gayash May 04 '12 at 01:20
0

The groupId in your parent POM and the groupId in the reference to the parent POM don't match. The groupId, artifactId, and version must match exactly in order for Maven to find the parent.

John Haager
  • 2,107
  • 1
  • 17
  • 22
0

Try mvn install -o to force offline mode. Out might point out the problem.

When you ran the install-file command, did you specify generate pom and generate checksums?

Manually check your maven repo for the jars to see if they installed properly.

Ihor Patsian
  • 1,288
  • 2
  • 15
  • 25
les2
  • 14,093
  • 16
  • 59
  • 76