Errors When Adding Second Xcore project [message #1844084] |
Tue, 31 August 2021 19:06 |
Greg Lusk Messages: 36 Registered: February 2017 Location: USA |
Member |
|
|
I have created a project with a structure similar to the one described here:
https://blogs.itemis.com/en/using-xtext-with-xcore-and-gradle
We are using Java 11, Xtext 2.25.0, Gradle 6.7.1, and Eclipse 4.20.0.
When there is only one Xcore project in our setup, everything works as expected; when I change something in the .xcore file, Java files are generated, and class path references are resolved (we have our build output setup to generate code at ./build/xcore/main as recommended in the blog post).
If I add a second Xcore project to the workspace, followed by a new .xcore file in that project's src directory, things still work as expected; code is generated in the ./build/xcore/main folder as directed by the @GenModel setup for the modelDirectory.
However, as soon as I add a build.gradle file for the second Xcore project and perform a Gradle refresh on that project, things go wrong. Code stops being generated when the .xcore file changes, and I begin to get errors in Eclipse stating that the types are already defined in the xcore file. My build.gradle file looks like this:
dependencies {
compile 'org.eclipse.xtext:org.eclipse.xtext:2.25.0'
compile "org.eclipse.xtext:org.eclipse.xtext.xbase:2.25.0"
compile 'org.eclipse.emf:org.eclipse.emf.ecore.xcore.lib:1.6.0'
xtextLanguages ('org.eclipse.emf:org.eclipse.emf.ecore.xcore:1.17.0') {
exclude group: 'org.antlr', module: 'antlr-runtime'
exclude group: 'org.eclipse.xtext', module: 'org.eclipse.xtext'
exclude group: 'org.eclipse.xtext', module: 'org.eclipse.xtext.xbase'
}
xtextLanguages 'org.eclipse.emf:org.eclipse.emf.ecore.xcore.lib:1.6.0'
xtextLanguages 'org.eclipse.emf:org.eclipse.emf.codegen.ecore:2.25.0'
xtextLanguages 'org.eclipse.emf:org.eclipse.emf.codegen.ecore.xtext:1.6.0'
xtextLanguages 'org.eclipse.xtext:org.eclipse.xtext.ecore:2.25.0'
}
sourceSets {
main {
resources {
exclude '**/*.xcore'
}
}
}
// This is a workaround related to xtext issue https://github.com/eclipse/xtext/issues/1976
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.eclipse.platform' && details.requested.name == 'org.eclipse.core.runtime') {
details.useVersion "3.19.0"
}
if (details.requested.group == 'org.eclipse.platform' && details.requested.name == 'org.eclipse.equinox.common') {
details.useVersion("3.13.0")
}
}
}
}
xtext {
version = "${xtextVersion}"
languages {
ecore {
setup = 'org.eclipse.xtext.ecore.EcoreSupport'
}
codegen {
setup = 'org.eclipse.emf.codegen.ecore.xtext.GenModelSupport'
}
xcore {
setup = 'org.eclipse.emf.ecore.xcore.XcoreStandaloneSetup'
generator.outlet.cleanAutomatically=true
generator.outlet.producesJava = true
}
}
}
In the first Xcore project, code generation continues to work correctly.
Does anyone know why code generation would fail like this for my second project?
Thanks,
Greg
[Updated on: Tue, 31 August 2021 20:13] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03947 seconds