Skip to content

Commit

Permalink
WIP 314 Fix Maven dependency on other modules
Browse files Browse the repository at this point in the history
We must ensure that other modules from the Gradle tree are
not only built but also published to some internal repository.
The Maven based Plugin descriptor (and the helper descriptor)
needs to include all (transitive) dependencies of the Mojo.
  • Loading branch information
ascheman committed Dec 14, 2024
1 parent 8bc470c commit 35abf15
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions htmlSanityCheck-maven-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,18 @@ class CrossPlatformExec extends Exec {

// This ensures that other HSC modules are published to ../build/maven-repo already (in particular core)
generateMavenPlugin.configure {
List<Task> thisProjectsPublishTasks = getTasks().withType(PublishToMavenLocal).stream().collect(Collectors.toList())
mustRunAfter(rootProject.getAllTasks(true).values().stream()
.flatMap(Set::stream)
.filter(task -> task instanceof PublishToMavenLocal)
.filter(task -> !thisProjectsPublishTasks.contains(task))
.collect(Collectors.toList())
dependsOn(
project.configurations.implementation.dependencies.withType(ProjectDependency).collect { dep ->
project.rootProject.findProject(dep.dependencyProject.path).tasks
}.flatten().stream()
.filter(task -> {
logger.debug("Checking '${task.name}' of '${task.project}' with class '${task.class}'")
task.name == 'publishMavenJavaPublicationToMyLocalRepositoryForFullIntegrationTestsRepository'
})
.collect(Collectors.toList())
)
onlyIf {
logger.debug("TaskGraph at generateMavenPlugin: " + gradle.taskGraph.getAllTasks().stream().map(Task::getName).collect(Collectors.toList()))
gradle.taskGraph.getAllTasks().stream().anyMatch(thisProjectsPublishTasks::contains)
gradle.taskGraph.getAllTasks().stream().anyMatch { task -> task.name == 'jar' }
}
}

Expand Down

0 comments on commit 35abf15

Please sign in to comment.