3

I have an Xtext project in a git repository. I tried various ways to import it into a blank workspace. I didn't succeed so far. I search google for at least two hours. I found various tutorials how to setup a new Xtext project in Eclipse, but not how to import already existing resources.

The closest I got so far is this: Import > Projects from git > Existing local repository > Import Dialog

At least the default Xtext project and the ui project were imported. The test project was not recognized as project -> could not import it so far.

The imported projects don't work. The packages are shown as folders and I don't even have a java compiler on the buildPath.

folders are shown instead of packages

Can someone please explain to me how can I import an existing Xtext project to eclipse correctly? My only solution so far is copying my friends workspace folder. I can create a new Xtext project in eclipse, but how can I import an existing project?

Zoltán Ujhelyi
  • 13,788
  • 2
  • 32
  • 37
Thomas Solti
  • 861
  • 8
  • 17

1 Answers1

2

More than likely the creator of the Xtext project has not included the generated code into the git repository. However, this results in some possible problems:

  1. The end-user has to execute the mwe2 workflow of the grammar manually after checkout; until that it is expected to have compile errors in the project.
    • Related issue: if the src-gen folder is missing the xtext project, the mwe2 workflow fails very badly. This can happen, as the src-gen folder only contains generated code; and empty folders are not transferred by git.
  2. Because of the internal structure of the Xtext/Xtend compiler it is possible that after the workflow is executed, some Xtend files are still erroneous. If so, you have to clean your projects again (use the Clean item from the Projects menu).
  3. In your project (by looking at the screenshot) it seems the .project and .classpath files of the projects were not committed into the repository. These files are used by Eclipse to understand which builders to add, what are the source folders, etc.

I would suggest to contact the original creator of the repository, as I believe, he/she has not committed everything required for opening the project in eclipse.

Zoltán Ujhelyi
  • 13,788
  • 2
  • 32
  • 37
  • when I try to run the mwe2 workflow it says: "Please put bundle 'org.eclipse.emf.mwe2.launch' on your project's classpath" – Thomas Solti Mar 21 '14 at 11:03
  • you are right.. the author didn't commit everything. thanks a lot!! – Thomas Solti Mar 21 '14 at 11:09
  • I now stumbled into the Related issue you mentioned here. the src-gen folder doesn't exist and the mwe2 workflow fails badly. Could you give me a hint how to proceed? – Thomas Solti Mar 21 '14 at 12:27
  • 1
    Create an empty src-gen folder (but not source folder) in the root of your xtext project. – Zoltán Ujhelyi Mar 21 '14 at 13:04
  • I finally managed by creating the folder src-gen manually and committing it as an empty folder using this solution: http://stackoverflow.com/questions/115983/how-do-i-add-an-empty-directory-to-a-git-repository if the folder exists -> mwe2 workflow does it's job quite well. thanks!! – Thomas Solti Mar 21 '14 at 13:06
  • I'm having the same issue. I tried project clean, but unfortunately nothing changed. The project's .project and .classpath files are present. Any idea how what to do next? @ZoltánUjhelyi – HaniBhat Feb 17 '20 at 17:15
  • @HaniBhat: I'd look at the projects classpath settings to make sure everything that contains Java sources is set up as a source folder. – Zoltán Ujhelyi Feb 18 '20 at 09:40