16:20:44.679 [ERROR] [org.gradle.BuildExceptionReporter]
Searched in the following locations:
16:20:44.679 [ERROR] [org.gradle.BuildExceptionReporter]
http://host/ivy/myorg/myorg.campaign/schema/development/3.0dev2/schema.jar
It looks like it used the [module] name instead of the [artifact] name in the pattern. it should have looked for
I’m thinking that perhaps you’re seeing the behaviour where Gradle will look for a Jar file in a default location if no ‘ivy.xml’ file is found. It’s possible that we don’t honour the artifact name in this case.
Then again, it could be a more general bug that you’ve exposed.
Yes, I am sure it finds the ivy.xml since it grabs the dependencies (as of 2.3), but while I was verifying this, I found another interesting tidbit.
It seems to work if I don’t specify the ‘configuration’ on this line… in this particular case, since default extends runtime, it works as expected.
compile ('myorg.campaign:schema:3.0+:runtime')
I was trying to get the gradle code to run in eclipse so I could debug it, but got busy with work items. If time allows, I’ll try to get a small reproducible case laid out.
The (very) simple build.gradle has a comment in it, showing how to reproduce the situation (just swap the dependency line).
Everything “self contained” in the repo. The keep things simple, the jar is minuscule and invalid, so compilation will throw an warning, but that’s fine.
When it works, you’ll get this:
mrawji@NA-1309-036:~/artifactVsModules$ gradle compileJava
:compileJava
error: error reading /home/mrawji/artifactVsModules/ivyrepo/myorg/schema/development/3.0dev2/campaign-schema.jar; error in opening zip file
warning: [options] bootstrap class path not set in conjunction with -source 1.6
error: error reading /home/mrawji/artifactVsModules/ivyrepo/myorg/schema/development/3.0dev2/campaign-schema.jar; error in opening zip file
1 warning
BUILD SUCCESSFUL
Total time: 2.817 secs
mrawji@NA-1309-036:~/artifactVsModules$
and, in the error case
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find schema-runtime.jar (myorg:schema:3.0dev2).
Searched in the following locations:
file:/home/mrawji/artifactVsModules/ivyrepo/myorg/schema/development/3.0dev2/schema-runtime.jar
Thanks for the report, it took me a while to work out what was going on.
The problem is that the ‘:runtime’ part of
compile ('myorg.campaign:schema:3.0+:runtime')
is actually specifying the classifier for the dependency, not the configuration.
By definition, if you’re telling Gradle the classifier (or extension) for a dependency, you’re overriding the artifacts that would be retrieved by default. So instead of looking for the artifact that is defined in the ivy.xml file, Gradle is looking for an artifact called ‘{module-name}-runtime.jar’.