Groovy Dependency management

672 views Asked by At

I am quite new to groovy and need to clarify on the Groovy Dependency management.

Here is the summary according to my "Homework":

  • Groovy Dependency management is as simple as adding an annotation to the script. E.g.
    @Grab('org.springframework:spring-orm:3.2.5.RELEASE')
  • Grape will then quickly add the dependencies from maven repository to your classpath

So, is adding to my groovy script the dependency annotation is all that I need, and Groovy/Grape will take care of the rest, when I run my Groovy script, right? (or there are some prerequisites, like I can't put my groovy script randomly anywhere, but has to be at a specific place like within a Groovy project, etc)

Second question, how to translate Maven dependency to Groovy/Grape dependency annotation?

For e..g., this is the Maven dependency for Opencsv:

<dependencies>
    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>5.2</version>
    </dependency>
</dependencies>

Does that translate to @Grab('com.opencsv:opencsv:5.2')?

Third question,

suppose I need to import org.apache.commons.collections.primitives.ArrayIntList, how can I come up with a Groovy/Grape dependency annotation as

@Grab(group='commons-primitives', module='commons-primitives', version='1.0')

I.e., where can I found the connection between org.apache.commons.collections.primitives.ArrayIntList and commons-primitives?

And finally,

where would Groovy/Grape store the downloaded .jar files?

0

There are 0 answers