# BUG: gradle-plugin-publish fails with dependency constraints

**URL:** https://discuss.gradle.org/t/bug-gradle-plugin-publish-fails-with-dependency-constraints/32741
**Category:** Plugin Portal
**Created:** [August 8, 2019, 2:31pm UTC](https://discuss.gradle.org/t/bug-gradle-plugin-publish-fails-with-dependency-constraints/32741 "2019-08-08T14:31:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Appu\_Goundan](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/appu_goundan/32/774_2.png) [@Appu\_Goundan](https://discuss.gradle.org/u/Appu_Goundan)
#### Post date: [August 8, 2019, 2:31pm UTC](https://discuss.gradle.org/t/bug-gradle-plugin-publish-fails-with-dependency-constraints/32741/1 "2019-08-08T14:31:07Z")

</div>

If I have a parent build file that defined dependency constraints and a plugin project that defines its dependencies without version.

However if you use the maven-publish plugin also things seem to work OK except for this other weird bug:

parent build.gradle:

```gradle
dependencies {
  constraints {
    implementation 'com.google.guava:guava:27.0.1-jre'
    ...
  }
}

```

subproject build.gradle (this is the gradle plugin project)

```gradle
dependencies {
  implementation 'com.google.guava:guava'
  ..
}

```

the task `publishPlugins` fails because the plugin-publish plugin doesn’t seem to resolve the versions when trying to write the pom.

full stacktrace:

```gradle
Caused by: com.gradle.publish.MissingDependencyVersionException: No version found for com.google.guava:guava on pom generation.
        at com.gradle.publish.PomWriter.addDependency(PomWriter.java:58)
        at com.gradle.publish.PomWriter.createPomDocument(PomWriter.java:44)
        at com.gradle.publish.PomWriter.writePom(PomWriter.java:30)
        at com.gradle.publish.PublishTask.generatePom(PublishTask.java:168)
        at com.gradle.publish.PublishTask.ensurePomIsAvailable(PublishTask.java:154)
        at com.gradle.publish.PublishTask.publish(PublishTask.java:70)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)

```

What’s curious is that if using the `maven-publish` plugin WITH the `plugin-publish` the resolution happens fine, but then you run into this weird bug: [Debug an issue in publish-plugin? gradle.plugin not being prepended to groupid](https://discuss.gradle.org/t/debug-an-issue-in-publish-plugin-gradle-plugin-not-being-prepended-to-groupid/32720)

Debugging the code, it appears the code path specifically for PomWriter (however its getting there is broken). Using `maven-publish` in conjunction with `plugins-publish` avoids this code path completely (presumably because it’s delegating pom generation to the maven-publish code?).
