# Dependencies of type pom do not work consistently

**URL:** <https://discuss.gradle.org/t/dependencies-of-type-pom-do-not-work-consistently/1592>\
**Category:** Old Forum Archive\
**Created:** [February 1, 2015, 9:33pm UTC](https://discuss.gradle.org/t/dependencies-of-type-pom-do-not-work-consistently/1592 "2015-02-01T21:33:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tobias\_Schulte](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tobias_schulte/32/184_2.png) [@Tobias\_Schulte](https://discuss.gradle.org/u/Tobias_Schulte)\
**Post date:** [February 1, 2015, 9:33pm UTC](https://discuss.gradle.org/t/dependencies-of-type-pom-do-not-work-consistently/1592/1 "2015-02-01T21:33:00Z")

</div>

In a project at our company one team uses a maven project of type pom to group a couple of other dependencies. When using maven, one can use this dependency with

```gradle
<dependency>
        <groupId>group</groupId>
        <artifactId>artifact</artifactId>
        <version>version</version>
        <type>pom</type>
    </dependency>

```

but in gradle, using

```gradle
compile "group:artifact:version@pom"

```

does not work. I have to use

```gradle
compile "group:artifact:version"

```

But when I define a dependency to another maven project, which does also have a dependency on the pom-type project, things go strange. Configurations.compile does not only contain jars, but also the pom

Example:

pom.xml:

```gradle
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>gradlepomdependency</groupId>
    <artifactId>gradlepomdependency</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <dependencies>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>all</artifactId>
            <version>1.5.0</version>
            <type>pom</type>
        </dependency>
    </dependencies>
</project>

```

build.gradle:

```gradle
apply plugin: 'java'
apply plugin: 'maven-publish'
repositories {
    jcenter()
    mavenLocal()
}
dependencies {
    compile 'gradlepomdependency:gradlepomdependency:0.0.1-SNAPSHOT' // @pom does not work
}
  task listDependencies << {
    configurations.runtime.each System.out.&println
}
publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}

```

=\> gradle listDependencies does list one pom and one jar, it should only contain the jar.

=\> The generated maven pom file in generatePomFileForMavenJavaPublication does not define pom. The dependency will most probably not work when used from maven.

---

<div class="post-metadata">

**Author:** ![cmcginty](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/cmcginty/32/2209_2.png) [@cmcginty](https://discuss.gradle.org/u/cmcginty)\
**Post date:** [February 2, 2015, 11:16pm UTC](https://discuss.gradle.org/t/dependencies-of-type-pom-do-not-work-consistently/1592/2 "2015-02-02T23:16:00Z")

</div>

I think the issue is with the pom.xml. Does it work correctly if you remove pom from the definition? The point of using "@pom"is to override the default type of “@jar”.

---

<div class="post-metadata">

**Author:** ![Tobias\_Schulte](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tobias_schulte/32/184_2.png) [@Tobias\_Schulte](https://discuss.gradle.org/u/Tobias_Schulte)\
**Post date:** [February 3, 2015, 8:14pm UTC](https://discuss.gradle.org/t/dependencies-of-type-pom-do-not-work-consistently/1592/3 "2015-02-03T20:14:00Z")

</div>

If you remove

```gradle
<type>pom</type>

```

from the dependency in the pom.xml, maven projects depending on it will not work anymore. The only way would be to also set

```gradle
<packaging>jar</packaging>

```

in the pom.xml (or remove that line, as that is the default). But that would result in an empty jar, which might not be desired.
