Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Doing a Clean Build on Xtext 2.9.1
Doing a Clean Build on Xtext 2.9.1 [message #1752556] Wed, 25 January 2017 06:58 Go to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
I just created a new Xtext Project with Eclipse Mars (Xtext 2.9.1)
When I generate the MWE2 Workflow, some new files were automatically generated (TestRuntimeModule.xtend and TestStandaloneSetup.xtend). These files are in the src folder. I stored all the files in a git repo, except for the generated folders (src-gen, xtend-gen and bin). But my problem is, if I do a clean clone from the repo, where the TestRuntimeModule and TestStandaloneSetup is already there, I keep getting compiler errors even if I delete all the errors and do a clean build. Refershing the workspace also did not help.

The console shows that build is successful, the src-gen and xtend-gen directories are created, and the expected files are also there, but there are all the red x icons beside the files, and under the Problems tab, a list of errors are shown.

Description	Resource	Path	Location	Type
AbstractTestRuntimeModule cannot be resolved to a type.	TestRuntimeModule.xtend	/test/src/org	line: 10 /test/src/org/TestRuntimeModule.xtend	Xtend Problem
AbstractTestScopeProvider cannot be resolved to a type.	TestScopeProvider.xtend	/test/src/org/scoping	line: 13 /test/src/org/scoping/TestScopeProvider.xtend	Xtend Problem
AbstractTestValidator cannot be resolved to a type.	TestValidator.xtend	/test/src/org/validation	line: 12 /test/src/org/validation/TestValidator.xtend	Xtend Problem
Package 'org.parser.antlr.internal' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 27	Plug-in Problem
Package 'org.parser.antlr' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 25	Plug-in Problem
Package 'org.serializer' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 24	Plug-in Problem
Package 'org.services' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 19	Plug-in Problem
Package 'org.test.impl' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 18	Plug-in Problem
Package 'org.test.util' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 23	Plug-in Problem
Package 'org.test' does not exist in this plug-in	MANIFEST.MF	/test/META-INF	line 22	Plug-in Problem
Superclass must be a class	TestRuntimeModule.xtend	/test/src/org	line: 10 /test/src/org/TestRuntimeModule.xtend	Xtend Problem
Superclass must be a class	TestScopeProvider.xtend	/test/src/org/scoping	line: 13 /test/src/org/scoping/TestScopeProvider.xtend	Xtend Problem
Superclass must be a class	TestStandaloneSetup.xtend	/test/src/org	line: 10 /test/src/org/TestStandaloneSetup.xtend	Xtend Problem
Superclass must be a class	TestValidator.xtend	/test/src/org/validation	line: 12 /test/src/org/validation/TestValidator.xtend	Xtend Problem
TestStandaloneSetupGenerated cannot be resolved to a type.	TestStandaloneSetup.xtend	/test/src/org	line: 10 /test/src/org/TestStandaloneSetup.xtend	Xtend Problem
The method createInjectorAndDoEMFRegistration() is undefined for the type TestStandaloneSetup	TestStandaloneSetup.xtend	/test/src/org	line: 13 /test/src/org/TestStandaloneSetup.xtend	Xtend Problem


Any idea what I can do to fix this?
Re: Doing a Clean Build on Xtext 2.9.1 [message #1752561 is a reply to message #1752556] Wed, 25 January 2017 07:24 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 502
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Chris,

when you do not check in src-gen and xtend-gen, then the generated files are missing after a clean clone. TestRuntimeModule might be checked in, but derives from AbstractTestRuntimeModule, which is a generated file. Thus, after a clean checkout you have to run the MWE2 Workflow. You were not indicating that you did that. The errors listed let me assume that the files in src-gen are missing, or are not on the classpath.

~Karsten
Re: Doing a Clean Build on Xtext 2.9.1 [message #1752562 is a reply to message #1752561] Wed, 25 January 2017 07:30 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
Hi Karsten,
I have run MWE2 Workflow but still the error is the same. My TestRuntimeModule and TestStandaloneSetup was generated in Java before and did not gave me this problem. When I updated to the newer version of MWE2, it generates xtend. Is there a way to generate these files as java?
Re: Doing a Clean Build on Xtext 2.9.1 [message #1752564 is a reply to message #1752556] Wed, 25 January 2017 07:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 10538
Registered: July 2009
Senior Member
i dont get that:

the code in src will only compile if the generated code is in src-gen
Re: Doing a Clean Build on Xtext 2.9.1 [message #1752566 is a reply to message #1752564] Wed, 25 January 2017 08:03 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 502
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Ok, you have updated Xtext and use the current generator. This will generate the Runtime Module in Xtend, this is now default. The workflow can be configured to produce Java instead of Xtend:


	component = XtextGenerator {
   ...
		configuration = {
   ...
			code = {
   ...
				preferXtendStubs = false
			}
		}
Re: Doing a Clean Build on Xtext 2.9.1 [message #1752571 is a reply to message #1752566] Wed, 25 January 2017 09:00 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
Ok, thanks. it works now. I also noticed that the new workflow always generates the Validator and ScopeProvider class in src-gen.
In my MWE2, I have this:
		language = StandardLanguage {
			referencedResource = resource1
			name = grammarURI1
			fileExtensions = "myDsl"
			
			scopeProvider = scoping.ImportNamespacesScopingFragment2 {
				generateStub = false
			}
			
			generator = {
				generateJavaMain = true
				generateStub = false
			}
			
			serializer = {
				generateStub = false
			}
			
			validator = validation.ValidatorFragment2 {
				generateStub = false
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}


But why does the src-gen still have the org.scoping and org.validation classes?
src-gen/org/scoping/TestScopeProvider.java.
src-gen/org/validation/TestValidator.java

In the old MWE, this is generated as an abstract class. As I do not really need these, I would prefer an abstract class. So, how can I make MWE2 generate it as abstract?

[Updated on: Wed, 25 January 2017 09:18]

Report message to a moderator

Re: Doing a Clean Build on Xtext 2.9.1 [message #1752572 is a reply to message #1752571] Wed, 25 January 2017 09:03 Go to previous message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
@Christian, I know, it does not make sense also. I can actually see the classes already but the editor cannot seem to detect it. Maybe, the problem is with Eclipse.
I am using Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600.

Anyway, changing back to Java seems to work for me now.
Previous Topic:[XTEXT] How to display specific error for special characters?
Next Topic:Missing requirement building an updatesite that includes Xtext 2.10 runtime artifacts
Goto Forum:
  


Current Time: Wed May 24 15:51:21 GMT 2017

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

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