@@ -89,6 +89,12 @@ abstract class MuzzleTask @Inject constructor(
8989 }
9090
9191 private fun assertMuzzle (muzzleDirective : MuzzleDirective ? = null) {
92+ if (muzzleClassPath.get().isEmpty) {
93+ val label = muzzleDirective?.name ? : name
94+ project.logger.warn(" Muzzle: skipping $label — classpath could not be resolved" )
95+ result.get().asFile.also { it.parentFile.mkdirs() }.writeText(" SKIPPED" )
96+ return
97+ }
9298 val workQueue = if (muzzleDirective?.javaVersion != null ) {
9399 val javaLauncher = javaToolchainService.launcherFor {
94100 languageVersion.set(JavaLanguageVersion .of(muzzleDirective.javaVersion!! ))
@@ -139,16 +145,20 @@ abstract class MuzzleTask @Inject constructor(
139145
140146 private fun createMuzzleClassPath (project : Project , muzzleTaskName : String ): FileCollection {
141147 project.logger.info(" Creating muzzle classpath for $muzzleTaskName " )
142- val cp = project.files()
143148 val config = if (muzzleTaskName == " muzzle" ) {
144149 project.configurations.named(" compileClasspath" ).get()
145150 } else {
146151 project.configurations.named(muzzleTaskName).get()
147152 }
148- cp.from(config)
149- if (project.logger.isInfoEnabled) {
150- cp.forEach { project.logger.info(" -- $it " ) }
153+ return try {
154+ val files = config.resolvedConfiguration.files
155+ if (project.logger.isInfoEnabled) {
156+ files.forEach { project.logger.info(" -- $it " ) }
157+ }
158+ project.files(files)
159+ } catch (e: Exception ) {
160+ project.logger.warn(" Muzzle: could not resolve classpath for $muzzleTaskName , will skip: ${e.message} " )
161+ project.files()
151162 }
152- return cp
153163 }
154164}
0 commit comments