Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-2226

Tooling API: LongRunningOperation.withArguments -P and -D are both not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-rc-2

      Description

      I tried to set system and project properties via the tooling API 'withArguments' method.
      But it looks like that isn't working.

      The arguments seem to be accepted without errors (i.e. when I later run the operation, there are no exceptions), but the properties do not get set.

      For system properties this is a relatively minor problem since setting them via setJVMArguments method works.
      But I don't know if there is an alternative for project properties.

      I tested this with RC1 (both API and Gradle version) with the following simple build script.

      task wrapper(type: Wrapper) {
          gradleVersion = '1.0-rc-1'
      }
      task showProp << {
      	println myProp
      }
      

      When I do ./gradlew -PmyProp=foo showProp

      It works as expected. However when I try to run the same task with the tooling API and use withArguments to pass the same -P argument it gets the following error:

      Caused by: org.gradle.api.LocationAwareException: Build file '/tmp/testws/test/build.gradle' line: 5
      Execution failed for task ':showProp'.
      	at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:85)
      	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
      	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:76)
      	at org.gradle.tooling.internal.provider.ExecuteBuildAction.run(ExecuteBuildAction.java:43)
      	at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:63)
      	at org.gradle.launcher.daemon.protocol.Build.run(Build.java:67)
      	at org.gradle.launcher.daemon.protocol.Build.run(Build.java:63)
      	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailureAsResult.execute(CatchAndForwardDaemonFailureAsResult.java:24)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:32)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:112)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:110)
      	at org.gradle.util.Swapper.swap(Swapper.java:38)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:110)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:47)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:48)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:37)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSendingCommand.java:21)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:22)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:49)
      	at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:113)
      	at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
      	... 3 more
      Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':showProp'.
      	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
      	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48)
      	at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
      	at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
      	at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)
      	at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)
      	at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)
      	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:111)
      	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
      	at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
      	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
      	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
      	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
      	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
      	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
      	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
      	at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:243)
      	at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
      	at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
      	at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
      	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
      	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
      	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
      	at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
      	at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
      	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
      	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
      	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)
      	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
      	at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
      	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
      	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
      	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
      	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
      	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:152)
      	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
      	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:76)
      	at org.gradle.tooling.internal.provider.ExecuteBuildAction.run(ExecuteBuildAction.java:43)
      	at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:63)
      	at org.gradle.launcher.daemon.protocol.Build.run(Build.java:67)
      	at org.gradle.launcher.daemon.protocol.Build.run(Build.java:63)
      	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailureAsResult.execute(CatchAndForwardDaemonFailureAsResult.java:24)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:32)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:112)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:110)
      	at org.gradle.util.Swapper.swap(Swapper.java:38)
      	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:110)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:47)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:48)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:37)
      	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:34)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSendingCommand.java:21)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:22)
      	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
      	at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:49)
      	at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:113)
      	at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
      Caused by: groovy.lang.MissingPropertyException: Could not find property 'myProp' on task ':showProp'.
      	at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
      	at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
      	at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:54)
      	at org.gradle.api.DefaultTask_Decorated.getProperty(Unknown Source)
      	at build_5sg1iifotv14l0nl4h83qjqna7$_run_closure2.doCall(/tmp/testws/test/build.gradle:5)
      	at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:457)
      	at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:445)
      	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)
      	... 79 more
      

        Attachments

          Activity

            People

            Assignee:
            szczepiq Szczepan Faber
            Reporter:
            kdvolder Kris De Volder
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: