From e2692356d381813afec1f8c693b0a9eb82a25b40 Mon Sep 17 00:00:00 2001 From: Martin Chalupa Date: Wed, 14 Feb 2018 16:55:31 -0800 Subject: [PATCH] Apply maven publish plugin only when project actually builds something --- .../plugin/responsible/NebulaResponsiblePlugin.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/groovy/nebula/plugin/responsible/NebulaResponsiblePlugin.groovy b/src/main/groovy/nebula/plugin/responsible/NebulaResponsiblePlugin.groovy index 621c4a0..8420b3e 100644 --- a/src/main/groovy/nebula/plugin/responsible/NebulaResponsiblePlugin.groovy +++ b/src/main/groovy/nebula/plugin/responsible/NebulaResponsiblePlugin.groovy @@ -22,7 +22,9 @@ class NebulaResponsiblePlugin implements Plugin { this.project = project // Publishing - project.plugins.apply(MavenPublishPlugin) + if (isBuildingSomething(project)) { + project.plugins.apply(MavenPublishPlugin) + } project.plugins.apply(JavadocJarPlugin) project.plugins.apply(SourceJarPlugin) @@ -43,4 +45,9 @@ class NebulaResponsiblePlugin implements Plugin { testTask.testLogging.exceptionFormat = 'full' } } + + private boolean isBuildingSomething(Project project) { + def isParentProject = project.rootProject.subprojects.any { it.parent == project } + return !isParentProject + } } \ No newline at end of file