:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not resolve com.google.protobuf:protobuf-java:3.0.0-beta-3.
Required by:
project : > com.company:connection-api:1.0.0-SNAPSHOT > com.company:myCompany-protobuf-java:2.0.28-SNAPSHOT
> Could not resolve com.google.protobuf:protobuf-java:3.0.0-beta-3.
> Could not parse POM http://companyNexus.com:8081/nexus/content/groups/public/com/google/protobuf/protobuf-java/3.0.0-beta-3/protobuf-java-3.0.0-beta-3.pom
> Unable to resolve version for dependency 'junit:junit:jar'
Correct, but the parent pom does Maven Central Repository Search
Unfortunately I’m not familiar with the details on the behaviours of parent poms and Gradle. The dependencies don’t appear in Gradle’s dependencies task, but I’m not sure if that’s a bug or not.
$ ./gradlew dependencies
:dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
archives - Configuration for archive artifacts.
No dependencies
compile - Dependencies for source set 'main'.
\--- com.google.protobuf:protobuf-java:3.0.0-beta-3
compileClasspath - Compile classpath for source set 'main'.
\--- com.google.protobuf:protobuf-java:3.0.0-beta-3
compileOnly - Compile dependencies for source set 'main'.
\--- com.google.protobuf:protobuf-java:3.0.0-beta-3
default - Configuration for default artifacts.
\--- com.google.protobuf:protobuf-java:3.0.0-beta-3
runtime - Runtime dependencies for source set 'main'.
\--- com.google.protobuf:protobuf-java:3.0.0-beta-3
testCompile - Dependencies for source set 'test'.
+--- com.google.protobuf:protobuf-java:3.0.0-beta-3
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testCompileClasspath - Compile classpath for source set 'test'.
+--- com.google.protobuf:protobuf-java:3.0.0-beta-3
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testCompileOnly - Compile dependencies for source set 'test'.
+--- com.google.protobuf:protobuf-java:3.0.0-beta-3
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testRuntime - Runtime dependencies for source set 'test'.
+--- com.google.protobuf:protobuf-java:3.0.0-beta-3
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
I will check the same as you did, and see if the problem is our Nexus and try with jcentral.
Could the problem be with the nested dependency tree. Your example work for a gradle project that directly included the Google protobuf-java.
Oiur JavaFX GUI application has a dependency on our connection-api, which in turn has a dependency to our server-protobuf-java which then depends on the google protobuf-java package.
The connection-api contains the API to connect to our server. The server-protobuf-java contains the Java created class files generated from proto definition files. While protobuf-java from Google contains the Protobuf API and implementation.
All our projects are currently using maven which works fine. Though I want to move over to Gradle.
I deleted the SNAPSHOT version of my com.company.server-protobuf-java from both local maven repository and our Maven Nexus repository.
After that I had no problem running gradle. It didn’t complain about com.google.protobuf-java any more.
Not sure what the problem was, but seems like the SNAPSHOT build perhaps was corrupt or something.