[GRADLE-1733] Internal error Created: 08/Aug/11  Updated: 04/Jan/13  Resolved: 12/Aug/11

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-4
Fix Version/s: None

Type: Bug
Reporter: Konrad Hinsen Assignee: Peter Niederwieser
Resolution: Not A Bug Votes: 0

Attachments: File build.gradle    

 Description   

When running "gradle build" with the attached build.gradle, I get an "internal error".

The project that is being built is available for download at https://bitbucket.org/khinsen/active_papers/overview. Just replace the build.gradle from that project by the one attached.

Here's the complete error message:

FAILURE: Build aborted because of an internal error.

  • What went wrong:
    Build aborted because of an unexpected internal error. Please file an issue at: http://www.gradle.org.
  • Exception is:
    java.util.ConcurrentModificationException
    at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
    at java.util.AbstractList$Itr.next(AbstractList.java:343)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:59)
    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.execute(AbstractTask.java:237)
    at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:167)
    at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:160)
    at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:78)
    at org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:113)
    at org.gradle.execution.DelegatingBuildExecuter.execute(DelegatingBuildExecuter.java:54)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:109)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:77)
    at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:41)
    at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:27)
    at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
    at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
    at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:219)
    at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:203)
    at org.gradle.launcher.Main.execute(Main.java:55)
    at org.gradle.launcher.Main.main(Main.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:49)
    at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:31)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:24)


 Comments   
Comment by Peter Niederwieser [ 12/Aug/11 ]

Your custom task class has a few problems:

1. You don't have to do doLast inside a @TaskAction because you already are in an action. You can't even do it because actions have to be added at configuration time, not at execution time. This causes the exception.

2. Likewise, inputs and outputs have to be declared at configuration time. For task classes this is usually done with annotations.

Here is a slightly improved version of your class that hopefully solves these problems (disclaimer: I haven't tested it):

class MakeLibraryTask extends DefaultTask {
    @InputFile
    File someFile = project.jar.archivePath // intended as replacement for "inputs.file project.jar.archivePath"; not sure what it's needed for
    
    @OutputDirectory
    File destDir = new File(project.buildDir, 'active_papers')
    
    String paper = 'active_paper.h5'
    def libs = []
    
    @TaskAction
    def makeLibrary() {
        libFile = new File(destDir, paper)
        destDir.mkdirs()
        project.javaexec {
            classpath = project.project(':active_paper_cltool').sourceSets.main.runtimeClasspath
            main = 'active_papers.cltool'
            args = ['make_library', libFile.absolutePath] + filemap(libs)
        }
    }
}
Comment by Konrad Hinsen [ 16/Aug/11 ]

Thanks for your suggestions, they helped me to get my custom task class working!

I had suspected that my custom task class was the cause of the error message, but since Gradle told me explicitly to file a bug report, I did.

Generated at Wed Jun 30 12:02:59 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.