Reputation: 63
I tyr to migrate a project that contains both Java and Xtend classes to Gradle. Unfortunately, I could not find any possibility to achieve an automated compilation of the Xtend part.
I am well aware of the Xtext Gradle Plugins (http://xtext.github.io/xtext-gradle-plugin/) that to my knowledge hook into the compile step of the Java plugin.
However, a CompileJava task cannot complete in the first place because of various referencing errors which are caused by missing Xtend classes (that are not yet generated...). In general, a suitable workflow should be
To get it to work I need a way to compile Java and ignore errors without task failure for which I have not found any solution. And then I need to re-execute the compilation which I guess might require some other trick to bypass Gradle's up-to-date checking mechanism. Or am I fully mistaken?
Upvotes: 1
Views: 559
Reputation: 1019
The right sequence should be to first generate Xtend sources, and then compile everything. Just add the plugin and add new sourceSets as follows
plugins {
id "org.xtext.xtend" version "1.0.0"
}
apply plugin: 'org.xtext.xtend'
sourceSets {
main.xtendOutputDir = 'xtend-gen'
test.xtendOutputDir = 'test/xtend-gen'
}
build should work afterwards.
Upvotes: 2