[Fiware-middleware] Links and template-project to start with gradle

Dmitri Rubinstein Dmitri.Rubinstein at dfki.de
Wed Nov 12 14:17:44 CET 2014


On 11/12/14 14:06, Marti Christof (mach) wrote:
> Hi Dimitri
>
> I will look into this tonight. I think it has to to with a missing sourceSet definition for antlr4. Normally the IDE plugins take all the sourceSets and add source locations in the IDE config files.

I tested this by adding this command at the end of file:

println idea.module.sourceDirs;

output:

[/home/rubinste/proj_de3/kiara-gradle-template/src/main/resources, 
/home/rubinste/proj_de3/kiara-gradle-template/src/main/java, 
/home/rubinste/proj_de3/kiara-gradle-template/build/generated-src]

generated-src is in the list.

>
> At the moment you will have to add the antrl4 output location "build/generated-src" manually in the IDE.

OK, I figured out that build/generated-src is really added but ignored 
since build directory is ignored by Intellij. When I remove build 
directory from exclude list it works.

Best,

Dmitri

>
> Christof
>
>> On 12.11.2014, at 13:36, Dmitri Rubinstein <Dmitri.Rubinstein at dfki.de> wrote:
>>
>> I was not able to import Gradle project to Intellij IDE. Intellij does
>> not see source code files generated by Antlr4.
>>
>> Best,
>>
>> Dmitri
>>
>> On 11/12/14 10:19, Dmitri Rubinstein wrote:
>>> Problem solved by adding this:
>>>
>>> antlr4.extraArgs=['-package', 'com.kiara']
>>>
>>> Now I finished porting my KIARA Maven project to Gradle (see
>>> attachment). Everything seems to work besides annotation problem:
>>>
>>> warning: Supported source version 'RELEASE_6' from annotation processor
>>> 'org.antlr.v4.runtime.misc.NullUsageProcessor' less than -source '1.7'
>>>
>>> Best,
>>>
>>> Dmitri
>>>
>>> On 11/12/14 09:42, Dmitri Rubinstein wrote:
>>>> I have also another problem. When I add following class:
>>>>
>>>> package com.kiara;
>>>>
>>>> public abstract class MyListener implements ExprListener {
>>>>
>>>> }
>>>>
>>>> in file: src/main/java/com/kiara/MyListener.java
>>>>
>>>> I get errors:
>>>>
>>>> /home/rubinste/proj_de3/kiara-gradle-template/src/main/java/com/kiara/MyListener.java:12:
>>>>
>>>> error: cannot find symbol
>>>> public abstract class MyListener implements ExprListener {
>>>>
>>>> But having MyListener class in the default package works.
>>>>
>>>> Any ideas ?
>>>>
>>>> Best,
>>>>
>>>> Dmitri
>>>>
>>>> On 11/12/14 09:03, Marti Christof (mach) wrote:
>>>>> Hi Dmitri
>>>>>
>>>>> This operator was introduced with Java 7 (javac 1.7), as many other
>>>>> nice enhancements.
>>>>> (Before you had to type Map<String,String> m = new
>>>>> HashMap<String,String>() )
>>>>> That is one of the reasons, I want to go to 1.7 or 1.8 asap.
>>>>>
>>>>> To fix this you must change the “sourceCompatibility" entry in
>>>>> build.gradle to 1.7 or higher.
>>>>> But then we start getting the problems with the antlr4 annotation
>>>>> processor.
>>>>> Another option would be to disable the annotation processor (?) or
>>>>> provide our own version of (4.4.1) which is on the antlr4 master tree.
>>>>>
>>>>> BR,
>>>>> Christof
>>>>>
>>>>>> On 12.11.2014, at 00:38, Dmitri Rubinstein
>>>>>> <Dmitri.Rubinstein at dfki.de> wrote:
>>>>>>
>>>>>> I created gradle project with your project file, but diamond operator
>>>>>> does not work:
>>>>>>
>>>>>> Map<String, String> m = new HashMap<>();
>>>>>>
>>>>>> Best,
>>>>>>
>>>>>> Dmitri
>>>>>>
>>>>>> On 11/11/14 20:32, Marti Christof (mach) wrote:
>>>>>>> Hi everybody
>>>>>>>
>>>>>>> I put together some starter links about gradle and created a
>>>>>>> template project for kiara, which adds some plugins and
>>>>>>> configuration to support and integrate with antlr4, maven, eclipse
>>>>>>> and IntelliJ Idea.
>>>>>>>
>>>>>>> Gradle-UserGuide & References:
>>>>>>> http://www.gradle.org/docs/current/userguide/userguide.html
>>>>>>> (you'll find almost everything there)
>>>>>>> Gradle-Plugins registry: http://plugins.gradle.org
>>>>>>> (e.g. the antlr4 plugin entry is here:
>>>>>>> http://plugins.gradle.org/plugin/me.champeau.gradle.antlr4)
>>>>>>>
>>>>>>> Good-Intro about why and how (compared to Ant/Maven) from the
>>>>>>> creator Hans Dockter (if you have time: 85’):
>>>>>>> https://www.youtube.com/watch?v=5a91dBLX8Qc
>>>>>>>
>>>>>>> Here you’ll find the kiara-gradle-template project:
>>>>>>> https://github.com/christofmarti/kiara-gradle-template
>>>>>>> (it does not contain any KIARA specific files yet; only a typical
>>>>>>> project hierarchy and configuration for the plugins)
>>>>>>>
>>>>>>> If you clone it, you can use "./gradlew” (resp. gradlew.bat) to call
>>>>>>> the correct version of gradle, without preinstalling gradle. (e.g.
>>>>>>> change to project dir and execute "./gradlew tasks" to list all
>>>>>>> available tasks)
>>>>>>> The main advantage of the wrapper is, that always the correct
>>>>>>> version of the tool is used. If not available it will be downloaded
>>>>>>> and installed locally from the path defined in
>>>>>>> ./gradle/wrapper/gradle-wrapper.properties.
>>>>>>>
>>>>>>> To create eclipse project files type "./gradlew eclipse"
>>>>>>> To create IntelliJ IDEA project files type "./gradlew idea"
>>>>>>> "./gradlew build" builds and assembles the whole project (incl.
>>>>>>> processing antlr4 files)
>>>>>>> “./gradlew clean” removes all generated files (but not eclipse or
>>>>>>> idea configs; use cleanEclipse or cleanIdea for this).
>>>>>>>
>>>>>>> I included a community plugin for antlr4. Sources have to be in
>>>>>>> src/main/antlr4/ (configureable).
>>>>>>> I had to add some Java version fixes, because the annotation
>>>>>>> processor of antlr only supports Java 7&8 from version 4.4.1 which
>>>>>>> is not yet in the repositories (see:
>>>>>>> https://github.com/antlr/antlr4/issues/487)
>>>>>>>
>>>>>>>
>>>>>>> @Dmitry:
>>>>>>> If you have a maven (pom) project, you can create an initial gradle
>>>>>>> configuration using:
>>>>>>> "gradle init --type pom”
>>>>>>> This needs a full gradle installation, not the wrapper
>>>>>>> (see
>>>>>>> http://www.gradle.org/docs/current/userguide/build_init_plugin.html#N14BBA
>>>>>>>
>>>>>>> for details)
>>>>>>>
>>>>>>>
>>>>>>> Best regards
>>>>>>> Christof
>>>>>>> ----
>>>>>>> InIT Cloud Computing Lab - ICCLab http://blog.zhaw.ch/icclab
>>>>>>> Institut of Applied Information Technology - InIT
>>>>>>> Zurich University of Applied Sciences - ZHAW
>>>>>>> School of Engineering
>>>>>>> Phone: +41 58 934 70 63
>>>>>>> Skype: christof-marti
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Fiware-middleware mailing list
>>>>>>> Fiware-middleware at lists.fi-ware.org
>>>>>>> https://lists.fi-ware.org/listinfo/fiware-middleware
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Fiware-middleware mailing list
>>>>>> Fiware-middleware at lists.fi-ware.org
>>>>>> https://lists.fi-ware.org/listinfo/fiware-middleware
>>>>>
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Fiware-middleware mailing list
>>> Fiware-middleware at lists.fi-ware.org
>>> https://lists.fi-ware.org/listinfo/fiware-middleware
>>>
>>
>> _______________________________________________
>> Fiware-middleware mailing list
>> Fiware-middleware at lists.fi-ware.org
>> https://lists.fi-ware.org/listinfo/fiware-middleware
>




More information about the Fiware-middleware mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy