Why does :compileGroovy fail complaining of "target=1.5" not defined?


(kevin.hurley) #1

Why am I seeing this: “[ant:groovyc] target=1.5: target=1.5 (No such file or directory)” under my compileGroovy task?

Am I missing a definition for a target? Is that the Java version it is looking for? Does Gradle use Ant behind the scenes?

gradle check :compileJava UP-TO-DATE :compileGroovy [ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: [ant:groovyc] target=1.5: target=1.5 (No such file or directory) [ant:groovyc]

[ant:groovyc] 1 error [ant:groovyc]

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:compileGroovy’. Cause: Forked groovyc returned error code: 1

(Peter Niederwieser) #2

Yes, Gradle’s ‘GroovyCompile’ task uses the ‘groovyc’ Ant task underneath. (Coincidentally, this is going to change after milestone 9). Looks like you have configured the ‘GroovyCompile’ task incorrectly. What we need to help in such cases is:

  • your build script (simplified if possible) * full output of ‘gradle -v’ * exact command you were running * full output of the command

In some cases, output of running the command with ‘-S’ also helps. Please enclose code and output in HTML ‘code’ tags.


(kevin.hurley) #3

The exact command I ran was: ‘gradle war’

Here is my build.gradle file:

apply plugin: ‘war’ apply plugin: ‘groovy’ apply plugin: ‘jetty’

version = “1.0-SNAPSHOT” def springIntegrationVersion = ‘2.1.0.RELEASE’

repositories {

maven {

url “http://nssatlassian.dccusa.com/nexus/content/repositories/public/

}

mavenCentral() }

dependencies {

compile “org.springframework.integration:spring-integration-core:${springIntegrationVersion}”

compile “org.springframework.integration:spring-integration-amqp:${springIntegrationVersion}”

compile “org.springframework.integration:spring-integration-mongodb:${springIntegrationVersion}”

compile “org.springframework.integration:spring-integration-stream:${springIntegrationVersion}”

compile “org.springframework:spring-web:3.0.2.RELEASE”

compile “org.springframework:spring-core:3.0.2.RELEASE”

compile “org.springframework:spring-context:3.0.2.RELEASE”

compile “org.springframework:spring-context:3.0.2.RELEASE”

compile “com.rabbitmq:amqp-client:2.0.0”

compile “org.codehaus.jackson:jackson-jaxrs:1.9.4”

groovy group: ‘org.codehaus.groovy’, name: ‘groovy’, version: ‘1.8.5’

testCompile “junit:junit:4.10”

testCompile “org.springframework:spring-test:3.0.2.RELEASE”

}

Here is the output of -s is:

~/IntelliJ/workspace/AuditServiceProvider>gradle war --stacktrace :compileJava UP-TO-DATE :compileGroovy [ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: [ant:groovyc] target=1.5: target=1.5 (No such file or directory) [ant:groovyc]

[ant:groovyc] 1 error [ant:groovyc]

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:compileGroovy’. Cause: Forked groovyc returned error code: 1

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

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

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

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

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: : Forked groovyc returned error code: 1

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:71)

at org.gradle.api.internal.project.AntBuilderDelegate.nodeCompleted(DefaultIsolatedAntBuilder.groovy:140)

at org.gradle.api.internal.tasks.compile.AntGroovyCompiler$_execute_closure1.doCall(AntGroovyCompiler.groovy:66)

at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:136)

at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:85)

at org.gradle.util.ConfigureUtil$configure.call(Unknown Source)

at org.gradle.api.internal.project.DefaultIsolatedAntBuilder.execute(DefaultIsolatedAntBuilder.groovy:101)

at org.gradle.api.internal.project.IsolatedAntBuilder$execute.call(Unknown Source)

at org.gradle.api.internal.tasks.compile.AntGroovyCompiler.execute(AntGroovyCompiler.groovy:63)

at org.gradle.api.internal.tasks.compile.IncrementalJavaSourceCompiler.execute(IncrementalJavaSourceCompiler.java:73)

at org.gradle.api.tasks.compile.GroovyCompile.compile(GroovyCompile.java:60)

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

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

at org.gradle.api.tasks.compile.GroovyCompile_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)

… 54 more

BUILD FAILED

Total time: 4.555 secs ~/IntelliJ/workspace/AuditServiceProvider>

I have also included a snippet from the output of -debug:

30feb/commons-cli/commons-cli/1.1/jar/commons-cli-1.1.jar:/usr/local/Cellar/gradle/1.0-milestone-7/libexec/lib/plugins/commons-cli-1.2.jar’ ‘-j’ ‘-Fg’ ‘-Jsource=1.5’ ‘-Jtarget=1.5’ ‘-d’ ‘/Users/wristfracture/IntelliJ/workspace/AuditServiceProvider/build/classes/main’ ‘–encoding’ ‘UTF-8’ ‘/Users/wristfracture/IntelliJ/workspace/AuditServiceProvider/src/main/groovy/com/cassidian/ip/audit/AuditEventMessage.groovy’

The ’ characters around the executable and arguments are not part of the command. 15:37:14.966 [WARN] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 15:37:14.967 [WARN] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:groovyc] target=1.5: target=1.5 (No such file or directory) 15:37:14.968 [WARN] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:groovyc]

15:37:14.968 [WARN] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:groovyc] 1 error 15:37:14.968 [WARN] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:groovyc]

15:37:15.318 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:compileGroovy’ 15:37:15.324 [ERROR] [org.gradle.BuildExceptionReporter]

15:37:15.325 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 15:37:15.325 [ERROR] [org.gradle.BuildExceptionReporter]

15:37:15.325 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 15:37:15.326 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ‘:compileGroovy’. 15:37:15.328 [ERROR] [org.gradle.BuildExceptionReporter] Cause: Forked groovyc returned error code: 1 15:37:15.328 [ERROR] [org.gradle.BuildExceptionReporter]


(kevin.hurley) #4

whats really strange is that other projects build perfectly on my machine with no other differences in the build.gradle file.


(kevin.hurley) #5

I also saw a post about a very similar issue here: http://issues.gradle.org/browse/GRADLE-1575


(Peter Niederwieser) #6

You should always use ‘groovy-all’ instead of ‘groovy’. Does this solve the problem?


(kevin.hurley) #7

This appears to have solved the problem. I am now producing a war file.

I substituted this line: groovy group: ‘org.codehaus.groovy’, name: ‘groovy’, version: ‘1.8.5’

for this one: groovy group: ‘org.codehaus.groovy’, name: ‘groovy-all’, version: ‘1.8.5’

Thanks, Kevin