[GRADLE-2966] Publishing is not yet able to resolve a dependency on a project with multiple different publications Created: 26/Nov/13  Updated: 23/Dec/16  Resolved: 23/Dec/16

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Duplicate Votes: 12


 Description   

Essentially trying to do what [1]https://github.com/gradle/gradle/blob... does (thanks Peter!).

This is part of a multi-project build. One project (hibernate-core) defines 2 publishing, Another project (hibernate-c3p0) defines just one publishing, and has a dependency on hibernate-core. I end up getting an error from Gradle in regards to hibernate-c3p0:

A problem occurred configuring project ':hibernate-c3p0'.
> Publishing is not yet able to resolve a dependency on a project with multiple different publications.

In terms of the docs sample, I have the reverse relationship. The doc sample has project2 depend on project1 where project1 only defines the one publishing.

How can I get this working? Or is this a limitation in publishing?
----------------------------------------------------------------------------------------
[1] https://github.com/gradle/gradle/blob/master/subprojects/docs/src/samples/maven-publish/multiple-publications/build.gradle



 Comments   
Comment by Gradle Forums [ 26/Nov/13 ]

I'm afraid you are hitting a known limitation of the incubating `maven-publish` plugin. I expect this limitation to go away before the plugin gets promoted.

Comment by Gradle Forums [ 26/Nov/13 ]

Any Jira I can watch?

Comment by Steve Ebersole [ 23/Mar/15 ]

Does this work yet in any version of Gradle?

Comment by Steve Ebersole [ 08/Apr/15 ]

Any word on this yet?

Comment by Richard Simpson [ 18/Oct/15 ]

Any news? I just ran into this same problem. Was able to work around it by moving all but one of the publications into a sub-project, but it's a pretty ugly solution. Also a bit worried that this issue was reported almost 2 years ago and there doesn't seem to have been any progress.

Comment by Nikhil Vaishnavi [ 11/Mar/16 ]

A workaround which I found for this is not to publish the artifact using the default provided ie. dont use - *components.java
The only drawback is you would need to prepare the pom file dependencies manually.

*E.g.
maven(MavenPublication)

{ groupId 'org.gradle.sample' artifactId 'project1-sample' version '1.1' from components.java }

Should be changed to

maven(MavenPublication)

{ groupId 'org.gradle.sample' artifactId 'project1-sample' version '1.1' artifact sampleJar //create the pom file entry along with it to include the dependencies. }
Comment by Timothy M. Rodriguez [ 06/Apr/16 ]

+1 on this issue. It's been open for quite some time..

Comment by Dima [ 23/Jul/16 ]

+1 from me too! This product seems unmaintained

@vnikhil@gmail.com could you elaborate on your example?
How do you create that pom entry with the dependencies?

Comment by Kenny Moens [ 25/Jul/16 ]

I've applied the following workaround which seems to work fine until now:

publishing {
    publications {
        java(MavenPublication) {
             artifact jar

             // other stuff - skipped for readability

                pom.withXml {
                    def dependenciesNode = asNode().appendNode('dependencies')

                    configurations.runtime.allDependencies.each {
                        if (it.group != null && it.name != null) {
                            def dependencyNode = dependenciesNode.appendNode('dependency')
                            dependencyNode.appendNode('groupId', it.group)
                            dependencyNode.appendNode('artifactId', it.name)
                            dependencyNode.appendNode('version', it.version)

                            if (it.excludeRules.size() > 0) {
                                def exclusionsNode = dependencyNode.appendNode('exclusions')
                                it.excludeRules.each { rule ->
                                    def exclusionNode = exclusionsNode.appendNode('exclusion')
                                    exclusionNode.appendNode('groupId', rule.group)
                                    exclusionNode.appendNode('artifactId', rule.module)
                                }
                            }
                        }
                    }
                }
        }
    }
}
Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Steve Ebersole [ 15/Nov/16 ]

I still "advocate" for this issue. Its a big hurdle in the Hibernate build.

Comment by Joel Hansell [ 15/Nov/16 ]

I am still inhibited by this bug - as in, I have to work around it.

Comment by Kenny Moens [ 19/Dec/16 ]

Is this issue already moved to GitHub?
Also from my side this bug is still important, and a fix would be more then welcome so that I can remove my "workarounds".

Comment by Timothy M. Rodriguez [ 19/Dec/16 ]

I also advocate for this issue.

Comment by Steve Ebersole [ 19/Dec/16 ]

Will we be getting any kind of notification of the new associated GitHub issue? I have a few issues that should be moved (that I replied to) that I have no idea if they have been moved.

Comment by Richard Simpson [ 23/Dec/16 ]

Can someone provide a link to the github version of this issue? I can't seem to find it on https://github.com/gradle/gradle/issues

Comment by Eric Wendelin [ 23/Dec/16 ]

@Everyone: I have cloned this issue on GitHub at https://github.com/gradle/gradle/issues/1061 — please subscribe and give your :+1:s there.

@Steve: please confirm that you got a notification for this.

Comment by Eric Wendelin [ 23/Dec/16 ]

Moved to https://github.com/gradle/gradle/issues/1061

Comment by Steve Ebersole [ 23/Dec/16 ]

Thanks Eric, I did. I'll apply my +1000 there

Generated at Wed Jun 30 12:36:14 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.