Difference between Gradle and Eclipse?

140 views
Skip to first unread message

roland.sp...@gmail.com

unread,
Jan 8, 2016, 1:21:24 PM1/8/16
to Xtend Programming Language
Hello,
I tried to switch to the newest xtend (from 2.8 to 2.9.1) and the latest xtend gradle plugin (1.0.2), but I get some errors while building with gradle. In eclipse all works fine. 
e.g.
ERROR:Type mismatch: cannot convert from element type Object to ServerPlayer (file:.../ComputeWinSituation.xtend line : 31 column : 30)

The line is:
private static def cleanPlayerStrength(ServerGame game) {
 
for (ServerPlayer player : game.players) {

game.players is defined as:

public interface Game<PLAYERTYPE extends Player,...>... {
 
Collection<PLAYERTYPE> getPlayers();

and ServerGame as
public interface ServerGame extends Game<ServerPlayer,...>

In my eyes (and Eclipse) this should work. 
The build.gradle for this project is:

buildscript {
 repositories
{
 mavenCentral
()
 jcenter
()
 maven
{
 url
"https://plugins.gradle.org/m2/"
 
}
 
}
 dependencies
{
 classpath
"org.xtext:xtext-gradle-plugin:1.0.+"
 
}
}

apply plugin
: "org.xtext.xtend"
sourceSets
.main.java.srcDirs = [ "src/" ]

sourceCompatibility
= 1.7
targetCompatibility
= 1.7

[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
dependencies
{
 compile project
(":ABattle.XCommon")
    compile
'org.slf4j:slf4j-api:1.7.10'
 compile
"org.eclipse.xtend:org.eclipse.xtend.lib:$xtendVersion"
 compile
"org.eclipse.xtend:org.eclipse.xtend.lib.macro:$xtendVersion"
    compile
"com.badlogicgames.gdx:gdx:$gdxVersion"
    compile
"com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    compile
'com.esotericsoftware.kryo:kryo:2.24.0'
 compile
'com.esotericsoftware:kryonet:2.22.0-RC1'
 compile files
('../ABattle.Android/libs/minlog-none-1.2.jar')
}


The ABattle.XCommon project is build and looks good (Contains some active annotations which are applied to the Common project. This actually works in gradle, some classes with annotations are correctly build).

Any ideas how to find the problem?

bye
Roland

Sven Efftinge (sven@efftinge.de)

unread,
Jan 8, 2016, 1:26:17 PM1/8/16
to xtend...@googlegroups.com
Could you try to reduce this to something you can fully share, so we can reproduce and debug it?

Sven

--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

roland.sp...@gmail.com

unread,
Jan 8, 2016, 6:43:21 PM1/8/16
to Xtend Programming Language
Hi,
I already expected this, so I reduce it a bit (an older version of the full code is at https://github.com/CymricNPG/abattle, the code is open source). I put the whole stripped down archive at google drive: https://drive.google.com/file/d/0B6YsHjW6BdveZWlSc05Bc3ZpWHM/view?usp=sharing (If you cannot download it, I can use some other location).

I get the following messages when I start gradle:

./gradlew --version


------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------


Build time:   2015-12-21 21:15:04 UTC
Build number: none
Revision:     276bdcded730f53aa8c11b479986aafa58e124a6


Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM
:          1.7.0_79 (Oracle Corporation 24.79-b02)
OS
:           Linux 3.10.0-327.3.1.el7.x86_64 amd64

./gradlew :ABattle.Desktop:build


Configuration on demand is an incubating feature.
:ABattle.XCommon:generateXtext
:ABattle.XCommon:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:ABattle.XCommon:processResources UP-TO-DATE
:ABattle.XCommon:classes
:ABattle.XCommon:jar
:ABattle.Common:generateXtext
ERROR
:The method or field id is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/client/commands/BoardUpdateCommandProcessor.xtend line : 122 column : 39)
ERROR
:The method or field id is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/client/commands/GameUpdateProcessor.xtend line : 22 column : 40)
ERROR
:The method strength(int) is undefined for the type Object (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/client/commands/GameUpdateProcessor.xtend line : 26 column : 11)
ERROR
:The method or field id is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/StatisticsSender.xtend line : 25 column : 67)
ERROR
:The method or field strength is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/StatisticsSender.xtend line : 25 column : 71)
ERROR
:The method or field id is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/StatisticsSender.xtend line : 26 column : 50)
ERROR
:The method or field id is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/PreGameThread.xtend line : 32 column : 52)
ERROR
:Type mismatch: cannot convert from element type Object to ServerPlayer (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/DataHelper.xtend line : 13 column : 30)
ERROR
:The method or field computer is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/GameSender.xtend line : 40 column : 62)
ERROR
:The method or field computer is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/game/impl/InitGameSender.xtend line : 60 column : 62)
ERROR
:The method or field strength is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/logic/ComputeWinSituation.xtend line : 19 column : 42)
ERROR
:Type mismatch: cannot convert from element type Object to ServerPlayer (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/logic/ComputeWinSituation.xtend line : 31 column : 30)
ERROR
:Type mismatch: cannot convert from Cell to ServerCell (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/logic/ComputeWinSituation.xtend line : 16 column : 83)
ERROR
:The method or field computer is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/logic/ComputerAI.xtend line : 27 column : 37)
ERROR
:Type mismatch: cannot convert from Player to ServerPlayer (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/logic/ComputerAI.xtend line : 30 column : 20)
ERROR
:The method or field id is undefined (file:/home/cymric/tmp/abattle/ABattle.Common/src/net/npg/abattle/server/service/impl/StartGameThread.xtend line : 53 column : 50)
:ABattle.Common:generateXtext FAILED

FAILURE
: Build failed with an exception.

* What went wrong:
Execution failed for task ':ABattle.Common:generateXtext'.
> Xtext validation failed, see build log for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED



Roland

roland.sp...@gmail.com

unread,
Feb 14, 2016, 12:20:56 PM2/14/16
to Xtend Programming Language, roland.sp...@gmail.com

Hello,
the last weeks I had a lot of work, so I couldn't look at this error. Today I stripped the project down to 7 classes and put it on https://github.com/CymricNPG/xtend-error .
If I run ./gradlew build I get the following error:
ERROR:The method or field id is undefined for the type Object (file:.../xtend-error/src/test/BoardUpdateCommandProcessor.xtend line : 6 column : 42)

The failing code is:
 new(ClientGame game) {
 
var player = game.players.findFirst[it.id == 343]


If I remove the Exception from line 27 in Game.java:
void addPlayer(P player) throws BaseException;

gradle builds the project without error.

In Eclipse Mars I get no error.Is this a bug in the gradle plugin or in xtend?
be
Roland

Sven Efftinge (sven@efftinge.de)

unread,
Feb 15, 2016, 2:30:27 AM2/15/16
to xtend...@googlegroups.com
Thanks for coming back to this. If it works within Eclipse, than it seems to be a bug in the gradle plugin. 
Could you file a ticket there including the pointer?

--
Reply all
Reply to author
Forward
0 new messages