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>


Reply via email to