How to use maven uber pom with dependencies?

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?


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!


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.


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 check sums?

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

链接地址: http://www.djcxy.com/p/29660.html

上一篇: 如何在我的本地仓库Maven下载和安装jar

下一篇: 如何使用maven uber pom与依赖关系?