Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ERROR:The method or field .. is undefined for the type ..
ERROR:The method or field .. is undefined for the type .. [message #1760328] Tue, 25 April 2017 23:06 Go to next message
Peter Luthardt is currently offline Peter LuthardtFriend
Messages: 43
Registered: February 2014
Member
I have 2 DSL-s. One creates Java-Code which is used by the other, both DSL are used in the same project.
Now I get this ERROR when I run a maven build. In Eclipse it seems to work ok.
When I remove the line in the second DSL all classes are created as expected.

Can anybody tell where this ERROR is created so I can dig deeper.

Any hints welcome.
Thanks.
Re: ERROR:The method or field .. is undefined for the type .. [message #1760337 is a reply to message #1760328] Wed, 26 April 2017 04:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
Can you share a complete trace.
Do you have any warnings on the build.properties files.
Did you manually check the jar files for its contents
Do you use pure maven or maven Tycho


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: ERROR:The method or field .. is undefined for the type .. [message #1760340 is a reply to message #1760328] Wed, 26 April 2017 06:21 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 748
Registered: July 2009
Location: Dortmund, Germany
Senior Member

So the first DSL produces code which must be present in order to resolve types in the second DSL. This needs an incremental build and is just not how Maven works. Reading models and generating code is usually executed in the generate-sources lifecycle phase, which runs before the compile phase. The second DSL would need class files on the classpath to resolve types, which do not exist before they are compiled.

You have to split this into two projects.
Re: ERROR:The method or field .. is undefined for the type .. [message #1760347 is a reply to message #1760340] Wed, 26 April 2017 08:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
alternatively you can use xbase/jvmmodelinferrer for the generation. then this should be no problem

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: ERROR:The method or field .. is undefined for the type .. [message #1760352 is a reply to message #1760340] Wed, 26 April 2017 08:53 Go to previous message
Peter Luthardt is currently offline Peter LuthardtFriend
Messages: 43
Registered: February 2014
Member
Unfortunately the project is too big to share.
Both DSL-s are using xbase with the JvmModelInferer.
I had trouble with generation more then one java class form one resource before, but changing call order fixed the problem.
Now a had to add a new class and the problem started all over again.
I am shure that my implementation is fare from optimal, but for now I changed maven execution form
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>@xtextVersion@</version>
<configuration>
	<classPathLookupFilter>${ilf-dsl-classpath-filter</classPathLookupFilter>
	<compilerSourceLevel>1.8</compilerSourceLevel>
	<compilerTargetLevel>1.8</compilerTargetLevel>
</configuration>
<executions>
	<execution>
		<id>generate-sources</id>
		<phase>generate-sources</phase>
		<goals>
			<goal>generate</goal>
		</goals>
		<configuration>
			<sourceRoots>
				<source>${basedir}/src/main/java</source>
			</sourceRoots>
			<languages>
				<language>
					<setup>LanguageA</setup>
				</language>
				<language>
					<setup>LanguageB</setup>
				</language>
			</languages>
		</configuration>
	</execution>

<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>@xtextVersion@</version>
<configuration>
	<classPathLookupFilter>${ilf-dsl-classpath-filter}</classPathLookupFilter>
	<compilerSourceLevel>1.8</compilerSourceLevel>
	<compilerTargetLevel>1.8</compilerTargetLevel>
</configuration>
<executions>
	<execution>
		<id>generate-domain-sources</id>
		<phase>generate-sources</phase>
		<goals>
			<goal>generate</goal>
		</goals>
		<configuration>
			<sourceRoots>
				<source>${basedir}/src/main/java</source>
			</sourceRoots>
			<languages>
				<language>
					<setup>LanguageA</setup>
				</language>
			</languages>
		</configuration>
	</execution>
	<execution>
		<id>generate-ilf-sources</id>
		<phase>generate-sources</phase>
		<goals>
			<goal>generate</goal>
		</goals>
		<configuration>
			<sourceRoots>
				<source>${basedir}/src/main/java</source>
			</sourceRoots>
			<languages>
				<language>
					<setup>LanguageB</setup>
				</language>
			</languages>
		</configuration>
	</execution>
<executions>


Now the build works again.
Thanks for the hint.
Previous Topic:Alternative Rules
Next Topic:Xtext templates
Goto Forum:
  


Current Time: Tue Sep 21 20:48:24 GMT 2021

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

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

Back to the top