Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Can't resolve jvmType reference to file in project (using maven)
Can't resolve jvmType reference to file in project (using maven) [message #1661283] Mon, 09 March 2015 15:05 Go to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
Hi..
I need your help, fixing an issue with JvmType references to files in the current project.
For some reason, they don't seem to work when compiling the project with maven (so, using the StandaloneSetup).

I get the following:
ERROR:Couldn't resolve reference to JvmType

Everything is fine when working on the project in Eclipse. It's just our CI build that fails...

I did some extensive research into the issue, but couldn't figure out how to fix this. My guess is, that the file simply isn't compiled yet (i.e. not present in target/classes) thus Xtext can't find it.

The weird thing is, that I think it did work before...

Thanks

Patrice
Re: Can't resolve jvmType reference to file in project (using maven) [message #1663886 is a reply to message #1661283] Tue, 10 March 2015 16:43 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Hey Patrice,

please attach the buildscript, project layout and the source file in questions. Without this information, it is almost impossible to help.

Best Regards,
Stefan
Re: Can't resolve jvmType reference to file in project (using maven) [message #1664156 is a reply to message #1663886] Tue, 10 March 2015 19:16 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
I can try.. It's a rather complex project, but I should be able to whip up a small example project.

What exactly do you need? The pom and the model files?
Re: Can't resolve jvmType reference to file in project (using maven) [message #1664174 is a reply to message #1664156] Tue, 10 March 2015 19:28 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
Here we go.

The layout is a standard maven layout:
./src/main/java/de/bitzeche/test:
TestClass.java

./src/main/resources:
test.idef	test.impl

./:
pom.xml


The procedureParam is defined as follows (simplified):
ProcedureParam:
	type=SimpleType name=ID
;
SimpleType:
	javaType = [jvmTypes::JvmType|FQN]
;



And here's what I get when I try to compile it on the command-line:
...
[INFO] Encoding: UTF-8
[INFO] Compiler source level: 1.8
[INFO] Compiler target level: 1.8
[INFO] Using common types.
[INFO] Collecting source models.
[INFO] Installing type provider.
[INFO] Generating stubs into <full-path>/jvmtype-test/target/xtext-temp/stubs
[INFO] Compiling stubs located in <full-path>/jvmtype-test/target/xtext-temp/stubs
[INFO] Installing type provider for stubs.
[INFO] Validate and generate.
[INFO] Starting validation for input: 'test.idef'
[INFO] Starting validation for input: 'test.impl'
[ERROR] ERROR:Couldn't resolve reference to JvmType 'de.bitzeche.test.TestClass'. (file:<full-path>/jvmtype-test/src/main/resources/test.impl line : 7)
...
  • Attachment: pom.xml
    (Size: 6.41KB, Downloaded 76 times)
  • Attachment: test.impl
    (Size: 0.17KB, Downloaded 68 times)

[Updated on: Tue, 10 March 2015 19:32]

Report message to a moderator

Re: Can't resolve jvmType reference to file in project (using maven) [message #1665860 is a reply to message #1664174] Wed, 11 March 2015 12:26 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Your configuration looks fine at first glance. Could you run maven in debug (-X) mode and attach the relevant output? It will tell you more details about which paths and files were used.
Re: Can't resolve jvmType reference to file in project (using maven) [message #1666642 is a reply to message #1665860] Wed, 11 March 2015 19:52 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
Sure.

Here we go Smile
Re: Can't resolve jvmType reference to file in project (using maven) [message #1667987 is a reply to message #1666642] Thu, 12 March 2015 09:22 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

[WARNING] source level should be comprised in between '1.3' and '1.7'

Seems like there is an older version of JDT on the classpath that doesn't support Java 8 like you specified in your POM. Either use Java 7 or update your dependencies.
Re: Can't resolve jvmType reference to file in project (using maven) [message #1668092 is a reply to message #1667987] Thu, 12 March 2015 10:21 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
hmm.. That would make sense..

Isn't that an issue with the text-maven-plugin, though? JDT comes packaged with it
Re: Can't resolve jvmType reference to file in project (using maven) [message #1668139 is a reply to message #1668092] Thu, 12 March 2015 10:50 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
I can confirm, that it works with source level 1.7, so it's definitely an issue with Java 8
Re: Can't resolve jvmType reference to file in project (using maven) [message #1668442 is a reply to message #1668139] Thu, 12 March 2015 13:43 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Indeed, Xtext 2.7.3 shipped with jdt.core 3.7, which can only handle Java 7.

Xtext 2.8 fixes that problem.
Re: Can't resolve jvmType reference to file in project (using maven) [message #1668471 is a reply to message #1668442] Thu, 12 March 2015 13:58 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
Ok. Time to move to 2.8 then.

Which introduces a new issue: Now eclipse can't resolve the jvmTypes either due to the TypesAwareDefaultGlobalScopeProvider not being used in the generated DSLRuntimeModule...
Guess that's a bug?


Update:
I should be more precise.

The generated AbstractDSLRuntimeModule overwrites the bindIGlobalScopeProvider method from DefaultCommonTypesRuntimeModule (which uses the proper provider):
// contributed by org.eclipse.xtext.generator.scoping.AbstractScopingFragment
	public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
		return org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.class;
	}

[Updated on: Thu, 12 March 2015 14:05]

Report message to a moderator

Re: Can't resolve jvmType reference to file in project (using maven) [message #1668777 is a reply to message #1668471] Thu, 12 March 2015 16:39 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Yes that looks like a bug, can you please file it? =)

As a workaround, add the correct binding to your RuntimeModule
Re: Can't resolve jvmType reference to file in project (using maven) [message #1669303 is a reply to message #1668777] Thu, 12 March 2015 21:19 Go to previous messageGo to next message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
That's what I ended up doing.

It totally works with Xtext 2.8 Smile Thanks Stefan for your help!!!
Re: Can't resolve jvmType reference to file in project (using maven) [message #1669437 is a reply to message #1669303] Thu, 12 March 2015 22:27 Go to previous message
Patrice Brendamour is currently offline Patrice BrendamourFriend
Messages: 24
Registered: March 2015
Junior Member
And here's the bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=462037
Previous Topic:EmbeddedXtextEditor for java
Next Topic:Xtext Java Grammar
Goto Forum:
  


Current Time: Sat Apr 10 21:58:50 GMT 2021

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

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

Back to the top