Per https://docs.gradle.org/current/userguide/artifact_management.html we should probably better define the karaf feature file as a publication artifact, specifically defining the task that builds it. At the moment we have:
publishing { publications { mavenJava( MavenPublication ) { artifact( project.extensions.karafFeatures.featuresXmlFile ) { classifier 'karaf' } } } }
which should be more like this instead:
publishing { publications { mavenJava( MavenPublication ) { artifact( project.extensions.karafFeatures.featuresXmlFile ) { classifier 'karaf' builtBy generateKarafFeatureFile } } } }