Cause: tried to access method org.gradle.api.tasks.Exec.exec()V from class XXXXXXX works in milestone-3, fails in 5 & 6


(Scott Palmer) #1

My gradle script calls visual studio to build. Visual studio after compilig calls back into the gradle script to complete part of the build (done this way so people can just use VS normally and get that second gradle step automatically)

but I get this error in later milestones…

Cause: tried to access method org.gradle.api.tasks.Exec.exec()V from class XXXXXXX

works in milestone-3, fails in 5 & 6


(Luke Daley) #2

We’ll need more information to help. Particularly the configuration of your exec task and the relevant part of the stack trace.


(Scott Palmer) #3

Let’s start with this… these tasks run in milestone 3, but not 5 or 6. milestone-4 also fails, but for a different reason (to do with the Visual Studio project calling back in to the same Gradle script that kicked it off… That one is apparently already a known issue.)

This chunk of Gradle is imported by a project-specific script that sets up the build in other ways and may explicitly define project.vsSolutionFile (but that isn’t necessary)

// ------------ Visual Studio ------------
  project.devenv = null;
project.vsSolutionFile=null;
  if( VS90COMNTOOLS )
    devenv = "$VS90COMNTOOLS/../ide/devenv.com"
      task visualStudioCleanDebug(type:VisualStudioExec) {
    mode = "Debug"
 clean = true;
}
task visualStudioCleanRelease(type:VisualStudioExec) {
    mode = "Release"
 clean = true;
}
task visualStudioClean( dependsOn: [visualStudioCleanDebug, visualStudioCleanRelease] )
  task visualStudioDebug(type:VisualStudioExec, dependsOn: 'buildGeneratedSource') {
    mode = "Debug"
}
task visualStudioRelease(type:VisualStudioExec, dependsOn: 'buildGeneratedSource') {
    mode = "Release"
}
  class VisualStudioExec extends Exec {
    public String vsSolutionFile
    public String mode = "Release";
    public boolean clean = false;
                public VisualStudioExec() {
        executable = project.devenv;
    }
    private updateArgs() {
  if( !vsSolutionFile && project.vsSolutionFile)
   vsSolutionFile = project.vsSolutionFile;
  if( !vsSolutionFile ) {
   list = []
   project.projectDir.eachFileMatch(~/.+\.sln/){ list<< it.name }
   if( list.size == 1 )
    vsSolutionFile = list[0]
   else if( list.size > 1 )
             throw new IllegalArgumentException( "Multiple 'sln' files found, set project.vsSolutionFile in your build.gradle: "+list)
  }
        if( !vsSolutionFile )
            throw new IllegalArgumentException( "Set project.vsSolutionFile in your build.gradle")
        if( clean )
            setArgs( [vsSolutionFile, "/Clean", mode ]);
        else
            setArgs( [vsSolutionFile, "/Build", mode ]);
    }
    void exec() {
        println( "************ In exec *************")
        updateArgs();
        super.exec();
    }
}

(Adam Murdoch) #4

Do you have a stacktrace for the error? You can run Gradle with -s to get the stack trace.


(Scott Palmer) #5
  • What went wrong: Execution failed for task ‘:antJar’. Cause: tried to access method org.gradle.api.tasks.Exec.exec()V from class AntExec

  • Try: Run with --info or --debug option to get more log output.

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:antJar’.

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.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:70)

at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.initialization.DefaultGradleLauncher$run.call(Unknown Source)

at KayakPluginConvention$_setupRecursion_closure1_closure2.doCall(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle:663)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:448)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:436)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)

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.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:70)

at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.initialization.DefaultGradleLauncher$run.call(Unknown Source)

at KayakPluginConvention$_setupRecursion_closure1_closure2.doCall(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle:663)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:448)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:436)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)

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.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:70)

at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)

at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)

at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)

at org.gradle.launcher.exec.Execution.execute(Execution.java:28)

at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)

at org.gradle.launcher.Main.main(Main.java:39)

at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)

at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)

at org.gradle.launcher.GradleMain.main(GradleMain.java:24) Caused by: java.lang.IllegalAccessError: tried to access method org.gradle.api.tasks.Exec.exec()V from class AntExec

at AntExec.super$5$exec(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle)

at AntExec.exec(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle:450)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)

at AntExec_Decorated.invokeMethod(Unknown Source)

at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)

… 91 more

BUILD FAILED


(Scott Palmer) #6
  • What went wrong: Execution failed for task ‘:visualStudioRelease’. Cause: tried to access method org.gradle.api.tasks.Exec.exec()V from class VisualStudioExec

  • Try: Run with --info or --debug option to get more log output.

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:visualStudioRelease’.

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.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:70)

at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.initialization.DefaultGradleLauncher$run.call(Unknown Source)

at KayakPluginConvention$_setupRecursion_closure1_closure2.doCall(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle:663)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:448)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:436)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)

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.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:70)

at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.initialization.DefaultGradleLauncher$run.call(Unknown Source)

at KayakPluginConvention$_setupRecursion_closure1_closure2.doCall(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle:663)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:448)

at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:436)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)

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.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:70)

at org.gradle.execution.DefaultBuildExecuter.access$300(DefaultBuildExecuter.java:23)

at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:80)

at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:70)

at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:63)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:157)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)

at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)

at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)

at org.gradle.launcher.exec.Execution.execute(Execution.java:28)

at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)

at org.gradle.launcher.Main.main(Main.java:39)

at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)

at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)

at org.gradle.launcher.GradleMain.main(GradleMain.java:24) Caused by: java.lang.IllegalAccessError: tried to access method org.gradle.api.tasks.Exec.exec()V from class VisualStudioExec

at VisualStudioExec.super$5$exec(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle)

at VisualStudioExec.exec(C:\Users\scott.palmer\dev\KayakSDK\BuildScripts\Defaults.gradle:545)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)

at VisualStudioExec_Decorated.invokeMethod(Unknown Source)

at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127)

at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)

… 91 more

BUILD FAILED


(Scott Palmer) #7

Both of the above are from milestone-6


(Luke Daley) #8

The stacktrace refers to a class called AntExec, but that’s not in your code sample.

What is AntExec?


(Scott Palmer) #9

The first one is AntExec, I realized it wasn’t correct and posted the other one which is the VisualStudioExec. Both have the same error.

class AntExec extends Exec {
     /* Need to use "cmd.bat /c call ant.bat" on Windows for proper exit value
 * to be returned.
 */
    public AntExec() {
        if (MyConvention.isBuildOSWindows()) {
            executable = System.getenv("COMSPEC")
            setIgnoreExitValue(false)
        } else {
            executable = project.antExecutable
        }
 }
 public void exec() {
  if ( MyConvention.isBuildOSWindows()
                 && !args[0].equals('/c') )
   setArgs(['/c','call','ant.bat'] + args)
  super.exec()
 }
}

(Scott Palmer) #10

For the record this is still an issue with the milestone-7 snapshot. I just tested the nightly build from Gradle 1.0-milestone-7-20111228012857+0100 It has the same problem:

  • What went wrong: Execution failed for task ‘:visualStudioCleanDebug’. Cause: tried to access method org.gradle.api.tasks.Exec.exec()V from class VisualStudioExec

We haven’t been able to use a version of Gradle since milestone-3… every build after has been broken in some way. Recursive builds have been the main issue, since we call out to visual studio to build native code and it calls back in to the same Gradle script when it is finished. It looked like that issue was supposed to be solved with milestone-7, but this “tried to access method” issue seems to be to main problem now (since milestone-6 at least).

If there is something wrong with our Gradle code (as posted above) please clue me in.


(Peter Niederwieser) #11

In general you should favor composition over inheritance. For example you could use a vanilla task that uses project.exec(). Or you could add an action in the constructor (with doFirst()) instead of overriding the exec() method.

Coming back to the original problem, where is class AntExec located? In buildSrc or a plugin project? Could it be that the class is still being compiled against Groovy 1.7?


(Scott Palmer) #12

AntExec is defined in the same file that defines VisualStudioExec. They both are overriding the exec method.

In both cases we are generating the up-to-date argument list for the exec call prior to it executing, I believe we needed to do that based on things that may not be initialized until after the task is constructed.


(Peter Niederwieser) #13

AntExec is defined in the same file that defines VisualStudioExec. They both are overriding the exec method.

This doesn’t answer my question. Is this file located in buildSrc or another project? Do you explicitly set a Groovy version? Note that starting with m6, tasks/plugins written in Groovy have to be compiled against Groovy 1.8.


(Scott Palmer) #14

It isn’t in a plugin. It’s in a .gradle file that we are using with a set of tasks and classes for this kind of project (it could become a plugin some day, I suppose). This common file is referenced at the start of our project files.

Our typical build.gradle file contains only a couple lines like this:

apply from: "${System.getenv()['MY_SDK']}/BuildScripts/Defaults.gradle"
  applyDefaultsForVisualStudioBasedProject()

(Peter Niederwieser) #15

To narrow this down further, could you check if one of the following works:

  • Write a similar task in Java * Use doFirst() in the constructor instead of overriding the exec method

(Scott Palmer) #16

I don’t think using doFirst() in the constructor can’t work because the arguments to exec are not known at that time. The task is constructed and default parameters are overridden after that.

I managed something that keeps the args updated without needing to override exec() for AntExec… but I don’t know how to do it for VisualStudioExec… I need to make sure that the solution file has been specified and I tried something like:

class VisualStudioExec extends Exec {
   public String vsSolutionFile;
   public String mode = "Release";
   public boolean clean = false;
     public VisualStudioExec() {
        executable = project.devenv;
        doFirst { updateArgs(); }
    }
...
}

but the exec() method runs before the arguments are set, then an exception is thrown saying there is no updateArgs() method. So I don’t understand how I can convert this to using doFirst.


(Scott Palmer) #17

Okay… I made the updateArgs() method public (not sure why I needed to) and it doesn’t throw the exception about a missing method anymore, but it still runs the exec() task without having the args set. doFirst is not running that code before the exec() method is called.


(Scott Palmer) #18

A simple test confirms that the @TaskAction is called before stuff added via doFirst {} in the constructor.

running a task of this type:

class OrderTest extends DefaultTask {
 public OrderTest() {
  doFirst {
   println("do first");
  }
  doLast {
   println("do last");
  }
 }
    @TaskAction
 def theTask() {
  println("the task");
 }
}

prints:

the task do first do last


(Peter Niederwieser) #19

Have you tried to write a similar task in Java? This may be a Groovy-related problem.


(Peter Niederwieser) #20

I wasn’t aware of that.