[GRADLE-1348] Transitive dependency not being pulled in Created: 25/Jan/11  Updated: 04/Jan/13  Resolved: 25/Jan/11

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.2
Fix Version/s: 1.0-milestone-1

Type: Bug
Reporter: Ben McCann Assignee: Unassigned
Resolution: Not A Bug Votes: 0

Attachments: File build.gradle    
Issue Links:
Related to GRADLE-1349 Improved behavior for chained Maven r... Resolved


I was getting tons of errors saying "package javax.persistence does not exist", so I had to add the following dependency to my gradle build file:
compile group:'org.hibernate.javax.persistence', name:'hibernate-jpa-2.0-api', version:'1.0.0.Final'

I should already be pulling it in from hibernate-core. I've attached m build.gradle so that you can see what I am specifying. I do not need that dependency specified to build in Maven. Here's the hibernate core pom:

Comment by Peter Niederwieser [ 25/Jan/11 ]

The repositories section of your build script is wrong. mavenCentral(someOtherRepo) means "get dependencies from Maven Central, but look for artifacts (not POMs!) also in someOtherRepo" (see 35.2 Repositories in the user guide). Because Maven Central doesn't have POMs for Hibernate 3.6, Gradle/Ivy has no metadata for the Hibernate artifacts, and can't do transitive dependency management. Maybe we could make this case easier to diagnose.
To fix the problem, delete Hibernate from Gradle's Ivy cache (~/.gradle/cache), then change the repositories section to:

repositories {
  mavenRepo name:'projectlombok.org', urls:"http://projectlombok.org/mavenrepo/"
  mavenRepo name:'jboss', urls:"http://repository.jboss.org/nexus/content/groups/public-jboss/"

Now you can remove hibernate-jpa-2.0-api from the dependencies section.

Comment by Ben McCann [ 25/Jan/11 ]

Thanks for clarifying the proper usage. That did fix my problem.

Generated at Wed Jun 30 11:53:16 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.