You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Martin Mucha <al...@gmail.com> on 2018/01/11 14:19:12 UTC

setting up maven environment

Hi,

can anyone help how to setup maven project, which build groovy scripts?

I have working maven project, which builds java sources. I would like to
build groovy scripts as well, into class files.

Internet is filled with not-working solutions, I cannot see any mention in
documentation anywhere. Can anyone advise?

Martin.

Re: setting up maven environment

Posted by Martin Mucha <al...@gmail.com>.
Thanks for link,

sadly this seems to be one the links on web, which does not work/contain
complete information. Build fails with: An Ant BuildException has occured:
taskdef class org.codehaus.groovy.ant.Groovyc cannot be found

Ok nevermind, let me restate the question. I got furthest with following
pom.xml below. The problem is, that when I build single groovy class:

package cz.???.processors.fdp


class ImpossibleToCompile {
}

I'm getting error:

1. ERROR in
/home/mmucha/projects/FDP/fdp-nifi-processors/nifi-fdp-processors/src/main/groovy/cz/???/processors/fdp/ImpossibleToCompile.groovy
(at line 1)
[ERROR] package cz.???.processors.fdp
[ERROR] ^
[ERROR] The type groovy.lang.GroovyObject cannot be resolved. It is
indirectly referenced from required .class files


What can be wrong here? Or what maven configuration could I use to compile
this triviality without any error?


pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements. See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <properties>
        <version.groovy.all>2.4.3</version.groovy.all>

<version.groovy-eclipse-batch>${version.groovy.all}-01</version.groovy-eclipse-batch>

<plugin.version.groovy-eclipse-compiler>2.9.2-01</plugin.version.groovy-eclipse-compiler>
    </properties>

    <parent>
        <groupId>???</groupId>
        <artifactId>???</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>???</artifactId>
    <packaging>jar</packaging>

    <dependencies>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${version.groovy.all}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-utils</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-standard-processors</artifactId>
            <version>${nifi.version}</version>
            <!--<scope>provided</scope>-->
        </dependency>

        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record-serialization-service-api</artifactId>
            <!--<version>${nifi.version}</version>-->
            <!--<scope>provided</scope>-->
        </dependency>

        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-schema-registry-service-api</artifactId>
            <!--<version>${nifi.version}</version>-->
            <!--<scope>provided</scope>-->
        </dependency>

        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-mock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <pluginRepositories>
        <pluginRepository>
            <id>bintray</id>
            <name>Groovy Bintray</name>
            <url>https://dl.bintray.com/groovy/maven</url>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>

    </pluginRepositories>

    <build>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version><!-- 3.1 is the minimum -->
                <configuration>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                    <!--<compilerArguments>-->
                        <!--<indy/>&lt;!&ndash; optional; supported by
batch 2.4.12-04+ &ndash;&gt;-->

<!--<configScript>config.groovy</configScript>&lt;!&ndash; optional;
supported by batch 2.4.13-02+ &ndash;&gt;-->
                    <!--</compilerArguments>-->
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>

<version>${plugin.version.groovy-eclipse-compiler}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>${version.groovy-eclipse-batch}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>




    </build>
</project>


2018-01-11 15:44 GMT+01:00 Daniel Sun <re...@hotmail.com>:

> FYI,
> http://docs.groovy-lang.org/latest/html/documentation/
> tools-groovyc.html#_maven_integration
>
> Cheers,
> Daniel.Sun
>
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>

Re: setting up maven environment

Posted by Martin Mucha <al...@gmail.com>.
Thanks for link!

But ... I'm sorry, my module have java and groovy files in it, and as
documentation explains, this compiler has issues to build such modules...
And, I'm not trying to be sarcastic/whatever here, if other modules, which
don't have issues with that, are surprisingly hard to configure to be
actually working, I as a groovy beginner should probably lead with
something simpler. Can you look at my previous reply, if you can see
anything wrong with my pom.xml?

thanks!

2018-01-11 15:45 GMT+01:00 Guillaume Laforge <gl...@gmail.com>:

> And a link to GMavenPlus:
> https://github.com/groovy/GMavenPlus/wiki
>
> Guillaume
>
>
> On Thu, Jan 11, 2018 at 3:44 PM, Daniel Sun <re...@hotmail.com>
> wrote:
>
>> FYI,
>> http://docs.groovy-lang.org/latest/html/documentation/tools-
>> groovyc.html#_maven_integration
>>
>> Cheers,
>> Daniel.Sun
>>
>>
>>
>>
>> --
>> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>>
>
>
>
> --
> Guillaume Laforge
> Apache Groovy committer & PMC Vice-President
> Developer Advocate @ Google Cloud Platform
>
> Blog: http://glaforge.appspot.com/
> Social: @glaforge <http://twitter.com/glaforge> / Google+
> <https://plus.google.com/u/0/114130972232398734985/posts>
>

Re: setting up maven environment

Posted by Guillaume Laforge <gl...@gmail.com>.
And a link to GMavenPlus:
https://github.com/groovy/GMavenPlus/wiki

Guillaume


On Thu, Jan 11, 2018 at 3:44 PM, Daniel Sun <re...@hotmail.com> wrote:

> FYI,
> http://docs.groovy-lang.org/latest/html/documentation/
> tools-groovyc.html#_maven_integration
>
> Cheers,
> Daniel.Sun
>
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>



-- 
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>

Re: setting up maven environment

Posted by Daniel Sun <re...@hotmail.com>.
FYI,
http://docs.groovy-lang.org/latest/html/documentation/tools-groovyc.html#_maven_integration

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html