groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schalk W. Cronjé <ysb...@gmail.com>
Subject Re: Integrating Groovy with a Java EE application and Maven
Date Sat, 18 Jun 2016 17:34:15 GMT

    
I dob't know about Ant, but in Gradle it us eady to get joint-compilation of Groovy &
Java if eerything is under the src/main/groovy folder.


Sent from my Samsung device

-------- Original message --------
From: Mr Andersson <mr.andersson.002@gmail.com> 
Date: 18/06/2016  18:39  (GMT+01:00) 
To: users@groovy.apache.org 
Subject: Re: Integrating Groovy with a Java EE application and Maven 


    I have gotten a bit further in my research and came up with this
    sample project which uses ant to compile the groovy classes but I
    can't get them to compile together. 

    

    To be able to have cyclic dependencies between Java and Groovy
    files. 

    

    Here is a standalone isolated maven project that contains
    everything: 

    

    http://www.speedyshare.com/TbQyG/Isolated.zip

    

    Pom file: 

    

    
    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0                              http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>Isolated</groupId>
    <name>Isolated</name>
    <artifactId>Isolated</artifactId>
    <version>1.0</version>
    <url>http://maven.apache.org</url>

    <packaging>jar</packaging>
    
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipTests>true</skipTests>
        <maven.test.skip>true</maven.test.skip>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.6</version> 
        </dependency>
    </dependencies>
    
    <build>
    
        <plugins>
            <plugin>
                <inherited>true</inherited>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            
            <!-- http://groovy-lang.org/groovyc.html#_ant_task -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <configuration>
                            <tasks>
                                
                                <mkdir dir="${basedir}/src/main/groovy"/>
                                
                                <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
                                    <classpath refid="maven.compile.classpath"/>
                                </taskdef>
                                
                                <mkdir dir="${project.build.directory}"/>
                                <groovyc destdir="${project.build.outputDirectory}"
                                         srcdir="${basedir}/src/main/groovy/" listfiles="true">
                                    <classpath refid="maven.compile.classpath"/>
                                </groovyc>
                                
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
    

  
Mime
View raw message