Skip to main content



      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 19:06 Go to next message
Eclipse UserFriend
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 00:54 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: ERROR:The method or field .. is undefined for the type .. [message #1760340 is a reply to message #1760328] Wed, 26 April 2017 02:21 Go to previous messageGo to next message
Eclipse UserFriend
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 04:15 Go to previous messageGo to next message
Eclipse UserFriend
alternatively you can use xbase/jvmmodelinferrer for the generation. then this should be no problem
Re: ERROR:The method or field .. is undefined for the type .. [message #1760352 is a reply to message #1760340] Wed, 26 April 2017 04:53 Go to previous message
Eclipse UserFriend
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: Sun Mar 16 21:22:05 EDT 2025

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

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

Back to the top