Skip to content

Instantly share code, notes, and snippets.

@glaforge
Created June 24, 2009 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glaforge/135197 to your computer and use it in GitHub Desktop.
Save glaforge/135197 to your computer and use it in GitHub Desktop.
Index: src/test/groovy/lang/GroovyClassLoaderTest.groovy
===================================================================
--- src/test/groovy/lang/GroovyClassLoaderTest.groovy (revision 16526)
+++ src/test/groovy/lang/GroovyClassLoaderTest.groovy Wed Jun 24 12:49:00 CEST 2009
@@ -87,9 +87,14 @@
paths += getPaths(System.getProperty("java.class.path"))
paths = paths.unique()
- def file
+ def file, tempFolder
try {
- file = File.createTempFile("Foo", ".groovy")
+ // On the latest update of the Mac JDK (as of 2009/06/24), the default placement of temp files seems problematic
+ // specifying explicitely a custom target directory seems to solve the build issue.
+ tempFolder = new File('./target/generated')
+ tempFolder.mkdir()
+ file = File.createTempFile("Foo", ".groovy", tempFolder)
+
def name = file.name - ".groovy"
def script = """
class $name extends GroovyTestCase{}
@@ -107,7 +112,12 @@
}
} finally {
try {
- if (file != null) { file.delete() }
+ if (file != null) {
+ file.delete()
+ if (tempFolder != null) {
+ tempFolder.delete()
+ }
+ }
} catch (Throwable t) { /*drop it*/ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment