Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » dsl maven build cannot resolve types defined in xtend
dsl maven build cannot resolve types defined in xtend [message #1753873] Sat, 11 February 2017 03:46 Go to next message
paul lu is currently offline paul luFriend
Messages: 27
Registered: April 2013
Junior Member
Hi,

I met a compilation problem in building a dsl project, where the dsl code uses types from xtend code.

I experimented with the example project:
https://github.com/xtext/maven-xtext-example

Defined a Foo type in
example-project/src/main/java/my/pack/Foo.xtend
package my.pack
class Foo { }
Then changed the example-project/src/main/java/Super.hero file to:
hero Superman can FLY {
pirntln(new my.pack.Foo())
println("Hello I can fly!")
}

In mvn compile, I got the error:
ERROR:my.pack.Foo cannot be resolved. (file:/Users/paul/Downloads/maven-xtext-example/example-project/src/main/java/Super.hero line : 2 column : 17)

The pom adds both the xtend plugin and the dsl plugin. Are the maven plugins not able to perform this kind of build? I tried the same on the gradle version, it seems to work.

Thanks,
Paul
Re: dsl maven build cannot resolve types defined in xtend [message #1753874 is a reply to message #1753873] Sat, 11 February 2017 05:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 10423
Registered: July 2009
Senior Member
Hi,

the problem is a different one.
the xtext maven plgin does not know xtend, the xtend maven plugin does not know hero

you need the xtext maven plugin to know xtend and remove the xtend maven plugin

<plugin>
				<groupId>org.eclipse.xtext</groupId>
				<artifactId>xtext-maven-plugin</artifactId>
				<version>${xtext-version}</version>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<languages>
						<language>
							<setup>my.mavenized.HeroLanguageStandaloneSetup</setup>
							<outputConfigurations>
								<outputConfiguration>
									<outputDirectory>src/main/generated-sources/xtend/</outputDirectory>
								</outputConfiguration>
							</outputConfigurations>
						</language>
						
						<language>
							<setup>org.eclipse.xtend.core.XtendStandaloneSetup</setup>
							<outputConfigurations>
								<outputConfiguration>
									<outputDirectory>src/main/generated-sources/xtend/</outputDirectory>
								</outputConfiguration>
							</outputConfigurations>
						</language>
					
					</languages>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>my.mavenized.herolanguage</groupId>
						<artifactId>my.mavenized.herolanguage</artifactId>
						<version>1.0.0-SNAPSHOT</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.xtend</groupId>
						<artifactId>org.eclipse.xtend.core</artifactId>
						<version>${xtext-version}</version>
					</dependency>
				</dependencies>
			</plugin>

Re: dsl maven build cannot resolve types defined in xtend [message #1753913 is a reply to message #1753874] Sun, 12 February 2017 11:16 Go to previous message
paul lu is currently offline paul luFriend
Messages: 27
Registered: April 2013
Junior Member
Thanks, that works : )
Previous Topic:After Migration 2.10 -> 2.11. Cannot start application
Next Topic:Standalone executable with multiple DSLs
Goto Forum:
  


Current Time: Mon Apr 24 04:00:35 GMT 2017

Powered by FUDForum. Page generated in 0.07363 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software