Forum Discussion

JustinM89's avatar
JustinM89
Contributor
7 years ago

Set global imports for external JARs

My team has moved a lot of code out into Java projects which we import into Groovy scripts. It's getting a little tedious to have to specify these imports 5-10 times in a test case. Is there any way we can set these imports up once at a global level and have all Groovy scripts inherit them?

 

1 Reply

  • bilgvvn's avatar
    bilgvvn
    Occasional Contributor

    Try this.

     

    myfile = new java.io.File(path + "/jars/*.jar")
    mystring = "file://" + path + "/jars/*.6.jar"

    classpathHacker.addFile( myfile )
    classpathHacker.addURL( new URL(mystring))