NikosDim
NikosDim

Reputation: 1508

Maven not downloading any dependencies of type pom

I am in the process of upgrading form Apache CXF 2.7.5 to 3.0.2 but I am having the problem below.

When I am including the dependency

<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf</artifactId>
  <version>3.0.2</version>
  <type>pom</type>
  <scope>import</scope>
</dependency>

to my pom.xml I don't see any .jar files downloaded to my project. There are no errors on the project.

I am using Maven 3.2.3 with Eclipse Juno Release2 and m2e 1.3.1

Why the <type>pom</type> is not getting resolved to the respective jar files of the framework?

Isn't the <type>pom</type> dependencies suppose to give the respective libs automatically? And if not what is the benefit of using them?

UPDATE

This is how my pom.xml look like

<?xml version="1.0" encoding="UTF-8"?>
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.test.sysman</groupId>
    <artifactId>serviceWrapper</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>serviceWrapper Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf</artifactId>
                <version>3.0.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf</artifactId>
        </dependency>
    </dependencies>
    <build>
        <finalName>serviceWrapper</finalName>
        <pluginManagement>
            <plugins></plugins>
        </pluginManagement>
        <plugins></plugins>
    </build>
</project>

Thanks

Upvotes: 1

Views: 2293

Answers (2)

Alexander Pogrebnyak
Alexander Pogrebnyak

Reputation: 45576

Where do you include this statement?

<scope>import</scope> is only effective inside the <dependencyManagement> section, i.e.

<dependencyManagement>
  <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf</artifactId>
    <version>3.0.2</version>
    <type>pom</type>
    <scope>import</scope>
  </dependency>
</dependencyManagement>

Also, it does not download dependency per se, but instead expands referenced pom in place.

If you just need the pom, exclude <scope>import</scope>.

Upvotes: 1

gregdim
gregdim

Reputation: 2071

Your dependency scope is import. This means it must be part of a dependency management declaration. With dependency management you are not directly download dependencies. It is a way to ensure that specific versions of dependencies are required. So further down your pom in the dependencies part if you declare

  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf</artifactId>

without specifying the version, maven knows which artifacts to download. Also controls versions in transitive dependencies.

Your pom probably refers to a bill of materials (BOM)

For more details see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

Upvotes: 2

Related Questions