Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-3
-
Fix Version/s: None
-
Component/s: command line processing
-
Labels:None
-
Environment:Arch Linux 0.6 with Java 1.4.2_01
Description
I'm not an expert (or even a regular) Java programmer, so this may just be my limited experience talking. However, it seems worth raising the issue, as, at the very least, some documentation seems in order.
For the record, I'm trying to build four classes, all in the same package (org.tapestry_os.thoughtspace.util) and in an appropriately named directory hierarchy, the base of which is on my CLASSPATH:
Tokenizer (a java interface);
TestTokenizer (a java class that implements Tokenizer);
LineTokenizer (a groovy class that implements Tokenizer);
TokenManager (a groovy class that uses LineTokenizer).
1) groovyc does not appear to respect the CLASSPATH environment variable. My understanding is that java command line switch overrides the environment variable, and groovyc is setting it to classworlds-???.jar. This means that the package identifiers I use in my code are not being mapped to the same locations as they would be by javac, and my groovy code won't compile.
2) If I alter groovyc to include $CLASSPATH in the data passed to java, the groovy compiler dies from a NoClassDefFoundError (on org/apache/commons/cli/Options). If I repackage all the groovy jars into one, and add this uberjar to CLASSPATH, compilation does proceed.
3) During compilation, neither groovy nor java dependencies for the current file are built (I believe this is probably the same issue as GROOVY-138). If all necessary groovy sources are passed in together for compilation, they are built, but any java files on which they depend aren't. Passing in the java files as well fails due to the inconsistencies between groovy and java. (It might be nice if java files were passed to the java compiler automatically.)
4) When I run groovyc in the directory that contains the source files, it creates the package directory hierarchy under the current directory before writing the class file into it, regardless of CLASSPATH. javac does not do this, instead writing the class files into the current directory. This can be remedied with the -d flag to groovyc, but I think that groovyc should mimic javac's behaviour, whenever possible.
Issue Links
- is depended upon by
-
GROOVY-753
complete parser
-
all the scripts now accept the CLASSPATH variable