Missing Jar in Maven local ignored from build

(Sidharth) #1

Hi I read that the resolution to GRADLE-2034 was to make gradle not fail when there is a pom artifact but not jar, if the repository in question was mavenLocal. Now say I have a repositories section like:

repositories {
       if(!ciBuild) {
       maven { url ....}

My understanding is that if gradle(2.12) will not find a jar artifact but only a pom in mavenLocal(), it won’t fail, It will silently build the jar and not include those classes, if it is not present in one of the subsequent repo listing. I though the idea was to treat all repos like “maven repos”(i.e. the .m2 is not some special place) and fail fast if the artifact is subsequently not resolved against a repo. Am I describing this correctly? Where is this documented in the user guide?

For my usecase (I reproduced this https://github.com/itissid/gradle_shadow_jar_issue) I found the above assumption to not hold. i.e. gradle does not package some classes in the shadow jar and moves on. Because repos are self contained in gradle, a dependency on a jar should be resolved against one of the repo and downloaded for that repo and if the dependency is not anywhere, fail. This does not seem to happen. Also, I believe this is different from GRADLE 2304 issue, I think that was silencing gradle from complaining about builds failing for maven local having poms but not jars.

Not sure, if this is could be due to the shadow jar plugin I am using?

I am fairly new to using gradle and honestly not had to deal with this aspect for maven becasue maven uses m2 like a cache(I think). Also we have mixed gradle and maven projects and often folks are using publishToMavenLocal tasks or sometimes just mvn install for using builds locally.

(John Engelman) #2

The Shadow plugin uses Gradle’s built in dependency resolver for grabbing the depenency Jars. If Gradle is not resolving the dependencies correctly, then the output of Shadow will be wrong. This is an issue with the plugin but with Gradle.