Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How do I re-import a maven Xtext project?(I ran "mvn clean", how do I import project into new Eclipse workspace?)
How do I re-import a maven Xtext project? [message #1787086] Fri, 18 May 2018 16:00 Go to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 138
Registered: March 2010
Senior Member
Hello,

Very basic question: how do I re-import an Xtext project for which I have deleted the ".project" files? I ran "mvn clean" and removed eclipse-specific stuff (.project/.classpath/.settings) in order to get to a state suitable for a "clean" import to a source repository. Before doing that I deleted the project from my workspace.

I had noticed the initial ".project" files had the maven nature, so I assumed I would be able to re-import using "Existing Maven Projects" facility, but that fails: the main language project's "GenerateMyDsl.mwe2" has a lot of erros about "Couldn't resolve reference to JvmIdentifiableElement 'baseName'." and such.

Is it possible to fix the project (I tried adding the plugin nature which I think was missing, but it did not seem to help)...
Re: How do I re-import a maven Xtext project? [message #1787087 is a reply to message #1787086] Fri, 18 May 2018 16:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
is your project a maven project or a maven tycho project?
in doubt you can use the wizard to create all kinds of combinations


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: How do I re-import a maven Xtext project? [message #1787088 is a reply to message #1787087] Fri, 18 May 2018 16:12 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 138
Registered: March 2010
Senior Member
It's maven tycho (as generated by Xtext) because I chose to have Eclipse plugin support.

I am comparing files manually now to figure out what's wrong. The first difference is that the main language module (the one with GenerateMyDsl.mwe2 ) had the Xtext nature in it after I re-imported, but originally that nature was NOT present. So I unconfigured Xtext and the problems view is clean, but now I can't run the launch configuration for "Generate MyDsl (mydsl) Language Infrastructure". It seems like it's missing the JRE and classpath, which I guess is because there is no Java nature on the project?

It seems to me I'm doing something very wrong, there should be some easy way to reimport from a clean state?
Re: How do I re-import a maven Xtext project? [message #1787091 is a reply to message #1787088] Fri, 18 May 2018 16:47 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 138
Registered: March 2010
Senior Member
Ok, so here's how I managed to "fix" it:

1) Re-import with File -> Import -> Existing Maven projects

This reads pom.xml and creates all projects, but your main language project will have errors in the "Generate[something].mwe2" file. This is because the pom.xml has "<packaging>eclipse-plugin</packaging>" which seems to confuse m2e, so the project doesn't even have the Java nature (no builder, etc). See below for next steps.

2) Open the pom.xml from Eclipse and edit to change packaging to "jar" and save. Then right-click on project and choose "Maven -> Update project..." and ok. This re-adds the Java nature to the project. UNDO your edit to return to eclipse-plugin packaging and REPEAT the "update project" again.

3) Right-click on project and go to "Java build path -> Source" and remove src/main/java and src/test/java so that it is empty (they were added by m2e when you switched to jar packaging above).

4) Right-click on project and go to "Configure -> Convert to Plugin Projects" and click Finish. You now have the plugin project nature again (it was also missing).

5) Right-click on project and go to "Plugin tools -> Update classpath..." . This restores the source folder (src, src-gen, xtend-gen) and adds the "Plug-in dependencies" to the classpath.

At this point you can run "Generate[something].mwe2" again.

So, I guess the root cause is that m2e does not really understand "eclipse-packaging"... Or is there some other "proper" way to do this?
Re: How do I re-import a maven Xtext project? [message #1787093 is a reply to message #1787091] Fri, 18 May 2018 16:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
Do you have the m2e extensions for eclipse tycho installed

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: How do I re-import a maven Xtext project? [message #1787094 is a reply to message #1787093] Fri, 18 May 2018 16:56 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 138
Registered: March 2010
Senior Member
I am pretty sure I don't. How does one install these?
Re: How do I re-import a maven Xtext project? [message #1787096 is a reply to message #1787094] Fri, 18 May 2018 17:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
https://wiki.eclipse.org/Tycho/FAQ#What_do_I_need_to_install_in_my_Eclipse_IDE_to_easily_work_with_Tycho.3F

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: How do I re-import a maven Xtext project? [message #1787097 is a reply to message #1787096] Fri, 18 May 2018 17:05 Go to previous message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 138
Registered: March 2010
Senior Member
You'll never guess what happened next Christian... everything "just works"! :-)

Thanks a lot for your help.
Previous Topic:Xtext 2.9.1 and Eclipse Photon Milestone 6 (4.8.0M6)
Next Topic:Validating x,y coordinates
Goto Forum:
  


Current Time: Mon Sep 27 11:24:08 GMT 2021

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

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

Back to the top