Archive

Posts Tagged ‘groovypp’

Groovy++ goes APL 2.0!

April 19, 2010 Leave a comment

Groovy++ goes APL 2.0!

This is obviously great news to Groovy/Groovy++ community.

Categories: Groovy Tags: ,

Using Groovy++ with Maven – an update

March 22, 2010 2 comments

In his comment to “Using Groovy++ with Maven” Joern Schimmelpfeng has correctly pointed out about transitive dependencies that may be added to groovypp POM, eliminating the need to specify them explicitly.

He’s right! That’s what we have Maven dependencies mechanism for.

It is now fixed so you can use

<dependency>
    <groupid>org.mbte.groovypp</groupid>
    <artifactid>groovypp-all</artifactid>
    <version>0.2.0</version>
</dependency>

or

<dependency>
    <groupid>org.mbte.groovypp</groupid>
    <artifactid>groovypp</artifactid>
    <version>0.2.0</version>
</dependency>

Full examples:

Now it looks practically the same – what’s the difference then?

As previously, groovypp-all.jar contains all required libraries, repackaged in one jar:

In addition to groovy ("groovy", "org.codehaus.groovy" packages) and groovypp ("org.mbte.groovypp" package) it also contains antlr, asm, commons-cli and junit libraries, some of which are stored under modified package names to avoid collisions with libraries that may be available already in your project.

groovypp.jar is bound to all above libraries in separate jars, as declared by its <dependencies>.

Which one to choose then?

  • If your application has already declared <dependency> on either antlr or asm and you
       don’t like them packaged twice (note, even in this case – there are no collisions due to
       packages modified), then you can choose the groovypp version.
     
       It usually works better in IDEA project as it doesn’t recognize "groovypp-all" jar as
       Groovy and tries to search for it elsewhere.
     
       Note: sometimes you may need to add an explicit junit:4.7 dependency, otherwise
       Maven brings old 3.8.2 JUnit version lacking classes required for Groovy++ compilation.
       It can be seen in groovypp example above, see the diff of switching from "groovypp-all"
       to "groovypp".
     
  • If you just want to just use Groovy++ without dealing with JUnit versions and you
       experience no Groovy-related IDEA problems – you can use groovypp-all.
Categories: Groovy, Maven Tags: , , ,

Using Groovy++ with Maven

March 18, 2010 11 comments

Note, an update is available.

Groovy++ artifacts are now deployed in Maven repository at:

http://groovypp.artifactoryonline.com/groovypp/libs-releases-local/
and
http://groovypp.artifactoryonline.com/groovypp/libs-snapshots-local/

 

So you can compile your Groovy++ sources with Maven.
As in Groovy, where you pick up either groovy.jar or groovy-all.jar – you can do the same here:

  • Use groovy + groovypp + asm + antlr + commons-cli:
     
    <dependency>
        <groupid>org.codehaus.groovy</groupid>
        <artifactid>groovy</artifactid>
        <version>1.8.0-beta-1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupid>org.codehaus.groovy</groupid>
        <artifactid>groovypp</artifactid>
        <version>0.1.18</version>
    </dependency>
    <dependency>
        <groupid>asm</groupid>
        <artifactid>asm-all</artifactid>
        <version>3.2</version>
    </dependency>
    <dependency>
        <groupid>antlr</groupid>
        <artifactid>antlr</artifactid>
        <version>2.7.7</version>
    </dependency>
    <dependency>
        <groupid>commons-cli</groupid>
        <artifactid>commons-cli</artifactid>
        <version>1.2</version>
    </dependency>
    

  • Use groovypp-all:
     
    <dependency>
        <groupid>org.codehaus.groovy</groupid>
        <artifactid>groovypp-all</artifactid>
        <version>0.1.18</version>
    </dependency>
    

As you see, the second way is much simpler so I suggest you stick to “groovypp-all”. It’s the same as a longer version but with all required libraries packaged nicely in one bigger jar. 

Of course, you’ll need to instruct Maven about repository:

 
    <properties>
        <repo>http://groovypp.artifactoryonline.com/groovypp</repo>
    </properties>


    <repositories>
        <repository>
            <id>libs-releases</id>
            <url>${repo}/libs-releases</url>
        </repository>
        <repository>
            <id>libs-snapshots</id>
            <url>${repo}/libs-snapshots</url>
        </repository>
    </repositories>


    <pluginrepositories>
        <pluginrepository>
            <id>plugins-releases</id>
            <url>${repo}/plugins-releases</url>
        </pluginrepository>
        <pluginrepository>
            <id>plugins-snapshots</id>
            <url>${repo}/plugins-snapshots</url>
        </pluginrepository>
    </pluginrepositories>

.. and configure GMaven plugin:

 
            <plugin>
                <groupid>org.codehaus.gmaven</groupid>
                <artifactid>gmaven-plugin</artifactid>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>compile-groovy</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <providerselection>1.7</providerselection>
                            <verbose>true</verbose>
                            <debug>true</debug>
                            <stacktrace>true</stacktrace>
                            <sources>
                                <fileset>
                                    <directory>${project.basedir}/src</directory>
                                    <includes>
                                        <include>**/*.groovy</include>
                                    </includes>
                                </fileset>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupid>org.codehaus.gmaven.runtime</groupid>
                        <artifactid>gmaven-runtime-1.7</artifactid>
                        <version>1.2</version>
                        <exclusions>
                            <exclusion>
                                <groupid>org.codehaus.groovy</groupid>
                                <artifactid>groovy-all</artifactid>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupid>org.codehaus.groovy</groupid>
                        <artifactid>groovypp-all</artifactid>
                        <version>0.1.18</version>
                    </dependency>
                </dependencies>
            </plugin>

Full examples:

If you didn’t do so yet – you’re welcome to join a community to take part in Groovy++ discussions and be notified about new releases (@groovypp is available as well).

Also, you can follow Alex Tkachman who is Groovy++ inventor at @alextkachman and DZone.