jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-197

groovyc does not behave similarly to javac with respect to CLASSPATH and output locations

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major 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

Task - A task that needs to be done. GROOVY-753 complete parser

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
james strachan added a comment - 21/Feb/04 7:27 AM

all the scripts now accept the CLASSPATH variable

Show
james strachan added a comment - 21/Feb/04 7:27 AM all the scripts now accept the CLASSPATH variable
Hide
Permalink
Chris Poirier added a comment - 28/Mar/04 9:51 PM

I see the new scripts include CLASSPATH when setting CLASSWORLDS_CLASSPATH. The problem is that, as in point 1), above, if the groovy or asm jars are on the user's CLASSPATH (as they must be in order to run groovy code using java), the script fails. Perhaps CLASSPATH should be passed in to Launcher instead, with CLASSWORLDS_CLASSPATH kept pure for java.

Show
Chris Poirier added a comment - 28/Mar/04 9:51 PM I see the new scripts include CLASSPATH when setting CLASSWORLDS_CLASSPATH. The problem is that, as in point 1), above, if the groovy or asm jars are on the user's CLASSPATH (as they must be in order to run groovy code using java), the script fails. Perhaps CLASSPATH should be passed in to Launcher instead, with CLASSWORLDS_CLASSPATH kept pure for java.
Hide
Permalink
Chris Poirier added a comment - 28/Mar/04 9:52 PM

er, point 2

Show
Chris Poirier added a comment - 28/Mar/04 9:52 PM er, point 2
Hide
Permalink
Russel Winder added a comment - 16/Mar/06 10:02 AM

All the scripts have been rewritten in the time since this issue was raised. If the issue persists then it can be reopened with a new test case.

Show
Russel Winder added a comment - 16/Mar/06 10:02 AM All the scripts have been rewritten in the time since this issue was raised. If the issue persists then it can be reopened with a new test case.

People

  • Assignee:
    Unassigned
    Reporter:
    Chris Poirier
Vote (0)
Watch (1)

Dates

  • Created:
    14/Feb/04 11:40 PM
    Updated:
    16/Mar/06 10:02 AM
    Resolved:
    16/Mar/06 10:02 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.