gradle-msbuild-plugin icon indicating copy to clipboard operation
gradle-msbuild-plugin copied to clipboard

task 'msbuild' fails when gradle-properties-plugin is used

Open sergey-selivanov opened this issue 8 years ago • 5 comments

If to add gradle-properties-plugin to the build, msbuild task fails without clear reason:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':msbuild'.
> Trying to evaluate a GString containing a Closure taking 2 parameters

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':msbuild'.
   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
...
   at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: groovy.lang.GroovyRuntimeException: Trying to evaluate a GString containing a Closure taking 2 parameters
   at org.gradle.process.internal.ExecHandleBuilder.getArgs(ExecHandleBuilder.java:90)
...
   at org.gradle.api.Project$exec$6.call(Unknown Source)
   at com.ullink.Msbuild.build(Msbuild.groovy:129)
   at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)

Gradle-properties-plugin is here: https://github.com/stevesaliman/gradle-properties-plugin Full build log and build.gradle:

log.txt

build.gradle.txt

sergey-selivanov avatar Dec 03 '15 14:12 sergey-selivanov

Hi,

do you mean the build works fine without Gradle-properties-plugin applied ? It'd help if you were to provide a minimal build which fails, right now I can't see which GString/closure is failing.

Maybe check the properties you're injecting ? could be that one of them is conflicting with msbuild.

gluck avatar Dec 03 '15 14:12 gluck

Hi gluck,

  1. yes, build perfectly works without gradle-properties-plugin. It is sufficient to simply add "apply plugin: 'net.saliman.properties'" line to get failure in msbuild.

  2. I will try to prepare minimal build but can't promise how soon. I'll use Visual Studio Community 2013, please tell if that matters.

  3. As I can judge, 5 my properties are injected by that plugin: artifactory_password, artifactory_contextUrl, artifactory_user, jna.nosys, rest.apiBaseUri, - seems not suspicious.

sergey-selivanov avatar Dec 03 '15 15:12 sergey-selivanov

Here is the minimal build to reproduce the issue - rename attached file to .zip Run 'gradle clean msbuild': runs OK Uncomment line 12 in build.gradle, run 'gradle clean msbuild': exception. Reproduces with gradle 2.9, 2.5.

test-gradle-plugins.zip.txt

sergey-selivanov avatar Dec 03 '15 17:12 sergey-selivanov

Hi, did anyone work out what the issue was. I've just encountered this and I'm using saliman plugin for picking env property file and then trying to kick off msbuild.

bluegod359 avatar Apr 21 '16 12:04 bluegod359

Hi, saliman plugin seems to inject methods in each task ExtensionAware properties (task.ext["foo"] = closure), this messes up this plugin which assumes these properties are to be passed down to msbuild (cf README).

Not sure if this (a bit intrusive) behavior is intended. Maybe it can be workaround on this plugin side, but the logic to decide which properties are to be passed down to msbuild would be cranky (exclude closures ? include only strings, gstrings, numbers ?).

gluck avatar Apr 26 '16 13:04 gluck