Gradle doesn't rebuild submodules on resolving configurations

Thanks, well spotted. In that case it looks like the problem is with the Shadow Jar plugin - here is another test case (using the same settings.gradle)

build.gradle

// project setup
allprojects  { apply plugin: 'java'           }
dependencies { runtime project(':subproject') }

buildscript {
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
        gradleApi()
    }
}
apply plugin: 'com.github.johnrengelman.shadow'

allprojects { tasks.withType(Jar) {
    if (it!=rootProject.shadowJar) rootProject.shadowJar.dependsOn it
}}

task repro(type: ReproTask) {
    fileset = shadowJar
}


// setting up the java files
writeClass file('src/main/java'), 'Main'
writeClass project(':subproject').file('src/main/java'), 'Subproject'


// task classes and helper methods
import org.gradle.api.internal.file.FileResolver
import java.util.zip.ZipFile
import javax.inject.Inject

buildscript { dependencies { gradleApi() } }
class ReproTask extends DefaultTask {
    @InputFiles def fileset
    @TaskAction void listContnents() {
        for (file in fileResolver.resolveFilesAsTree(fileset)) {
            for (zipped in new ZipFile(file).entries()) {
                if (zipped.directory) continue
                logger.lifecycle('- {}!{}', file, zipped.name)
            }
        }
    }
    protected @Inject FileResolver getFileResolver() { throw new UnsupportedOperationException() }
}

def writeClass(File root, String name) {
    assert root.directory || root.mkdirs()
    new File(root, "${name}.java").text = """public class $name {
        public static void main(String[] args) { System.out.println("Hello $name!"); }
    }"""
}