This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 134203 - Cannot execute script which contains import
Summary: Cannot execute script which contains import
Status: VERIFIED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: martin_adamek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-29 23:50 UTC by Lukas Jungmann
Modified: 2008-10-30 14:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Jungmann 2008-04-29 23:50:44 UTC
-have java app with following groovy class:

package test

class Book {

    def title
    String author

    public Book(title) {
        this.title = title
    }
    
    boolean order(int qty, Resseller) {
        true
    }
    
    def title() {
        "book title"
    }
}

-build project
-have following script:

import test.Book
def book = new Book()
println ("groovy ${book?.title()}")

Issue 1) - editor does not know about test.Book groovy class - there's an error annotation

-run script from the IDE

Issue 2) :
/space/java/groovy-1.5.6/bin/groovy /home/lukas/NetBeansProjects/JavaApplication2/src/NewGroovyScript.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed,
/home/lukas/NetBeansProjects/JavaApplication2/src/NewGroovyScript.groovy: 7: unable to resolve class test.Book
 @ line 7, column 1.
   import test.Book
   ^

1 error


It works on the command line:
lukas@ubuntu-m9:~/NetBeansProjects/JavaApplication2/src$ groovy NewGroovyScript.groovy 
groovy book title
Comment 1 martin_adamek 2008-04-30 09:28:08 UTC
Fixed.
Editor problem is fixed in http://hg.netbeans.org/main/contrib/rev/2e04f61cbc2c
Execution problem is fixed in http://hg.netbeans.org/main/contrib/rev/72d4415d9c58  but this kind of execution will be removed soon as it is completely 
ignoring Ant project setup and you have to build project before you call Execute script. I'll remove this action once regular project Run File action will be 
available for Groovy.

Comment 2 Lukas Jungmann 2008-04-30 11:43:41 UTC
v.
Comment 3 Quality Engineering 2008-05-20 05:14:46 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #206 build
Changeset: http://hg.netbeans.org/main/rev/cc5a4f778439
User: Martin Adamek <martin_adamek@netbeans.org>
Log: Editor part of #134203: Cannot execute script which contains import