Steve, On Sat, 2009-07-11 at 16:29 -0400, Steve Appling wrote: [ . . . ] > I think that perhaps when you have GROOVY_HOME set, it is not getting the > groovy > jar correctly. I certainly don't have an answer for you, but I may have some > insights:
From the debug output, the resolver does mention exactly the right jar,
so I think it is finding the jar correctly in all cases.
> The GroovyCompile task uses AntGroovyC to do the compile with a different
> classloadder. It does this by writing a small anonymous groovy script and
> running it with another classloader. This is the "Script1.groovy" you are
> seeing. I'm not sure exactly why you are getting this problem, but you can
> get
> strange errors here if it can't find the ant or groovy jars in the groovy
> classpath.
OK, so the real problem here is that an element of the implementation
that should be hidden is being exposed. Script1.groovy is nothing the
user is in control of and so should never be mentioned in any message to
the user -- implementation detail such as this should never leak. It
indicates perhaps that an exception is not being caught and handled in
an appropriate manner.
My GROOVY_HOME points at a HEAD install of Groovy -- for the moment this
is always called 1.7-beta-1-SNAPSHOT. I update it every morning.
Looking at the debug output, the classpath of the compile looks
reasonable.
08:47:41.080 [main] DEBUG org.gradle.util.GradleUtil - Using groovyc
as: ClassLoader loader = Thread.currentThread().contextClassLoader
AntBuilder ant =
loader.loadClass('groovy.util.AntBuilder').newInstance()
ant.project.removeBuildListener(ant.project.getBuildListeners()[0])
ant.project.addBuildListener(loader.loadClass("org.gradle.logging.AntLoggingAdapter").newInstance())
int numFilesCompiled = 0
org.gradle.api.tasks.util.AntTaskAccess listener = new
org.gradle.api.tasks.util.AntTaskAccess() { task->
if (task != null && task instanceof
org.codehaus.groovy.ant.Groovyc) {
numFilesCompiled = task.fileList.length;
}
}
ant.project.addBuildListener(listener)
ant.taskdef(name: 'groovyc', classname:
'org.codehaus.groovy.ant.Groovyc')
ant.mkdir(dir:
'/home/users/russel/Repositories/Bazaar/Masters/Gant/Trunk_Development/build/classes')
ant.groovyc(
[includeAntRuntime: false,
srcdir:
'/home/users/russel/Repositories/Bazaar/Masters/Gant/Trunk_Development/src/main/groovy',
destdir:
'/home/users/russel/Repositories/Bazaar/Masters/Gant/Trunk_Development/build/classes',
classpath:
'/home/users/russel/.gradle/cache/org.apache.ant/ant/jars/ant-1.7.1.jar:/home/users/russel/lib/Java/groovy/embeddable/groovy-all-1.7-beta-1-SNAPSHOT.jar:/home/users/russel/.gradle/cache/commons-cli/commons-cli/jars/commons-cli-1.2.jar:/home/users/russel/lib/Java/gradle/lib/ant-1.7.0.jar:/home/users/russel/lib/Java/gradle/lib/ant-launcher-1.7.0.jar']
+
[failonerror:true, verbose:false, listfiles:false, fork:true,
includeJavaRuntime:false, stacktrace:false]) {
javac([source: '1.5', target: '1.5'] + [debug:true]) {
}
}
ant.project.removeBuildListener(listener)
return numFilesCompiled
08:47:42.695 [main] ERROR org.gradle.Main -
Build failed with an exception.
Run with -f option to get the full (very verbose) stacktrace.
Build file
'/home/users/russel/Repositories/Bazaar/Masters/Gant/Trunk_Development/build.gradle'
Execution failed for task ':compile'.
Cause: startup failed:
Script1.groovy: 6: unexpected token: task @ line 6, column 104.
1 error
Exception is:
org.gradle.api.GradleScriptException: Build file
'/home/users/russel/Repositories/Bazaar/Masters/Gant/Trunk_Development/build.gradle'
Execution failed for task ':compile'.
at
org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:218)
at
org.gradle.execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:153)
at
org.gradle.execution.DefaultTaskExecuter.doExecute(DefaultTaskExecuter.java:144)
at
org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:67)
at
org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:88)
at org.gradle.Gradle.loadAndConfigureAndRun(Gradle.java:168)
at org.gradle.Gradle.access$000(Gradle.java:57)
at org.gradle.Gradle$1.run(Gradle.java:92)
at org.gradle.Gradle.doBuild(Gradle.java:146)
at org.gradle.Gradle.run(Gradle.java:90)
at org.gradle.Main.execute(Main.java:83)
at org.gradle.Main.main(Main.java:42)
at org.gradle.BootstrapMain.main(BootstrapMain.java:53)
Caused by:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 6: unexpected token: task @ line 6, column 104.
1 error
at
org.gradle.util.GradleUtil.executeIsolatedAntScript(GradleUtil.groovy:95)
at
org.gradle.util.GradleUtil$executeIsolatedAntScript.call(Unknown Source)
at
org.gradle.api.tasks.compile.AntGroovyc.execute(AntGroovyc.groovy:76)
at
org.gradle.api.tasks.compile.GroovyCompile.compile(GroovyCompile.java:86)
at
org.gradle.api.tasks.compile.GroovyCompile$1.execute(GroovyCompile.java:57)
at
org.gradle.api.tasks.compile.GroovyCompile$1.execute(GroovyCompile.java:55)
at
org.gradle.api.internal.AbstractTask.doExecute(AbstractTask.java:257)
at
org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:209)
... 12 common frames omitted
08:47:42.696 [main] ERROR org.gradle.Main -
BUILD FAILED
08:47:42.697 [main] INFO org.gradle.Main - Total time: 9.639 secs
The real problem here is knowing the content of Script1.groovy so as to
know what is actually being written by Gradle and hence why it is
creating this error.
> Are you running with the version of gradle from the trunk? If so, there may
> be
> some issue with some changes I made to track whether any files compiled or
> not.
> It did introduce a parameter called "task" to the script used to do the
> compile.
> If you run it with -d you should see a log message like: "Using groovyc as:"
> -
> this will contain the content of the script that is executed. It would be
> helpful to see that.
Yes I am at the bleeding edge and am running Gradle updated from HEAD
every morning.
I don't run the tests when installing, I rely on HEAD being in a state
that all tests pass. Perhaps I ought to change my downloader/installer
script to actually run the tests.
[ . . . ]
>
> This is a very annoying bug in Ivy that Hans has already reported (but they
> haven't fixed yet). If you resolve something using one resolver, Ivy caches
> the
> name of that resolver and gives the annoying error message if you ever try to
> resolve that same jar with another resolver. I am running into this all the
> time. Please vote for it at http://issues.apache.org/jira/browse/IVY-758.
OK duly voted for.
--
Russel.
=============================================================================
Dr Russel Winder Partner
xmpp: [email protected]
Concertant LLP t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road, f: +44 8700 516 084 voip: sip:[email protected]
London SW11 1EN, UK m: +44 7770 465 077 skype: russel_winder
signature.asc
Description: This is a digitally signed message part
