We have a build using maven-publish and want to include pom.xml into published JAR (discussed for example in https://issues.gradle.org/browse/GRADLE-2916). The build works: it creates JARs and publishes them. But when we run gradle tasks
it fails. Simple version of a build to reproduce looks like this:
settings.gradle:
include 'a'
include 'b'
build.gradle:
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
jar {
dependsOn 'generatePomFileForMavenJavaPublication'
into("META-INF/maven/$project.group/$project.archivesBaseName") {
from new File(project.buildDir, 'publications/mavenJava')
rename ".*", "pom.xml"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
name 'local'
url new File(rootProject.buildDir, 'repo').toURI().toURL()
}
}
}
}
b/build.gradle:
dependencies {
compile project(':a')
}
The error looks like:
Execution failed for task ':tasks'.
> Could not determine the dependencies of task ':aggrDaoProtos:jar'.
...
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':tasks'.
Caused by: org.gradle.api.GradleException: Could not determine the dependencies of task ':aggrDaoProtos:jar'.
Caused by: org.gradle.api.UnknownTaskException: Task with path 'generatePomFileForMavenJavaPublication' not found in project ':aggrDaoProtos'.
Same with Gradle 2.5 and 2.6-rc-2. Any idea what is wrong?