Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta)
Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1711643] Sun, 18 October 2015 22:33 Go to next message
Klaus Landsdorf is currently offline Klaus LandsdorfFriend
Messages: 3
Registered: October 2015
Junior Member
Hi,

Xtext and Xtend is great and easy to use, but it's not so easy to find out how to use more than one DSL in a multi-language project. The projects should be seperated and build with gradle and intellij idea 15.

There were no topic to find via search.

Please checkout attached files with very simple projects of xtend 2.9 beta, gradle and intellij idea 15. It shows you how I wish to use Xtext projects in seperated projects.

mydsl + yourdsl + ourdsl = ourused

The ourused project should be able to use all DSLs, so I tried to setup all DSLs in ourdsl project.

Main problem : genmodel is unmapped, genmodels are not included in jars of gradle build

jars are included from a libs folder via dependencies in gradle and imported in mwe2 of ourdsl

Please help!
Re: Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1711871 is a reply to message #1711643] Tue, 20 October 2015 08:19 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Hi Klaus,

the missing genmodels in the jar have been fixed in the nightly, you can fix it for your projects like this:

jar {
	from('model/generated') {
		into('model/generated')
	}
}


As for the multi-language-setup: Will all the languages be in the same repository? If so, you should create one big multi-project build instead of three seperate builds like you have now. You can then just use project dependencies instead of the jar-file hack you currently have. Also, in that case I would flatten the project structure so you only have one top-level project "languages-parent" with all the subprojects as direct children.

If the languages should live in separate repositories/have separate release cycles, then you need to publish them to a Maven repository in order to reference them in the downstream projects again. Maven publishing has also been added in the nightly already, so you can create a project with it and just copy-paste the build logic from there.

Cheers,
Stefan
Re: Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1713944 is a reply to message #1711871] Sun, 08 November 2015 21:26 Go to previous messageGo to next message
Klaus Landsdorf is currently offline Klaus LandsdorfFriend
Messages: 3
Registered: October 2015
Junior Member
Hi Stefan,

yes the languages should live in separate repositories, because mydsl and yourdsl are technical-languages and ourdsl is a business-language. The mydsl and yourdsl can be used standalone, but ourdsl needs mydsl and yourdsl as technical vocabulary. The jar includes the model with your quickfix, but it doesn't work.

OK, what can I do ...

I build mydsl, yourdsl and the ourdsl in Eclipse Mars.1 with 2.9.0.beta5 and it was quite easy to get what I want. The ourdsl get its dependencies by MANIFEST.MF via Add Button in required plug-ins and it works very well. I can use mydsl and yourdsl in ourdsl.

A diff of the idea and eclispe projects didn't help. I couldn't find anything what's missing in IntelliJ Idea 15 RC with Gradle 2.8.

Next test to find out the problem --> gradle eclipse > import Ideas Gradle-Projects to Eclipse, but it also dosen't work. It is not possible to setup mydsl and yourdsl as required plug-ins for ourdsl. As compile dependencies mydsl and yourdsl is installed to my local m2 Repo and the jar inculdes its model. The gradle generated eclipse projects including mydsl and yourdsl. A change of access rules for the jars in Build Path settings didn't help.

Next idea use xtext-gradle-plugin to setup the languages, but nothing ... *grr*

Now I've no idea what to try next.
The problem on build is everytime the same:

22:21:26: Executing external task 'build'...
:ourdsl:generateXtextLanguage
0 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project ourdsl at 'file:/Users/klaus/IdeaProjects/frugalSoftware/ourdsl/ourdsl.parent/ourdsl/'
2 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project ourdsl.ide at 'file:/Users/klaus/IdeaProjects/frugalSoftware/ourdsl/ourdsl.parent/ourdsl.ide/'
3 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project ourdsl.idea at 'file:/Users/klaus/IdeaProjects/frugalSoftware/ourdsl/ourdsl.parent/ourdsl.idea/'
3 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project ourdsl.web at 'file:/Users/klaus/IdeaProjects/frugalSoftware/ourdsl/ourdsl.parent/ourdsl.web/'
30 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.xbase.XbasePackage'
336 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
341 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
362 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
362 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
366 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.xtext.example.mydsl.myDsl.MyDslPackage'
368 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems instantiating module org.xtext.example.ourdsl.GenerateOurDsl: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module org.xtext.example.ourdsl.GenerateOurDsl: java.lang.reflect.InvocationTargetException
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:95)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: org.eclipse.emf.common.util.WrappedException: java.lang.reflect.InvocationTargetException
at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:56)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:143)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:114)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:296)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:142)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:114)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:296)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:296)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66)
at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:93)
... 4 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
... 29 more
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.IOException: The path '/mydsl/model/generated/MyDsl.genmodel' is unmapped
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.emf.mwe.utils.GenModelHelper.registerGenModel(GenModelHelper.java:35)
at org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenModelFile(StandaloneSetup.java:461)
... 34 more
Caused by: java.io.IOException: The path '/mydsl/model/generated/MyDsl.genmodel' is unmapped
at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:535)
at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1269)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
... 37 more
:ourdsl:generateXtextLanguage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ourdsl:generateXtextLanguage'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.388 secs
Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
22:21:30: External task execution finished 'build'.



May you can help. I want to use Idea and Gradle, please!

[Updated on: Sun, 08 November 2015 21:54]

Report message to a moderator

Re: Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1714227 is a reply to message #1713944] Tue, 10 November 2015 21:24 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Hi Klaus,

your manifests don't have a bundle name. The bundle name is mandatory for doing platform:resource URIS in the mwe2 workflow. You need to add this to your sourceLayout.gradle

jar {
	manifest {
		attributes 'Bundle-SymbolicName': project.name
	}
}


This has already been fixed in Beta6.

Cheers,
Stefan
Re: Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1714346 is a reply to message #1714227] Thu, 12 November 2015 01:10 Go to previous messageGo to next message
Klaus Landsdorf is currently offline Klaus LandsdorfFriend
Messages: 3
Registered: October 2015
Junior Member
Hi Stefan,

yes, thank you it works, but the Facets in Idea (143.747.5) are not included as in Eclipse. Just *.ourdsl Files generating code and there is just a Facet and Module for OurDsl.

How to get the Facets for MyDsl and YourDsl to generate with *ourdsl, *.mydsl and *.yourdsl Files on gradle runIdea OurDsl-Project?

If project will be build and start with Eclipse there is also no Plug-In to find. There is no *.ui project as in Eclipse.

Beta6 didn't work:

1 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - [XtextLinkingDiagnostic: null:58 Couldn't resolve reference to JvmType 'WizardConfig'., XtextLinkingDiagnostic: null:59 Couldn't resolve reference to JvmIdentifiableElement 'runtimeRoot'., XtextLinkingDiagnostic: null:60 Couldn't resolve reference to JvmIdentifiableElement 'eclipseEditor'., XtextLinkingDiagnostic: null:61 Couldn't resolve reference to JvmIdentifiableElement 'ideaEditor'., XtextLinkingDiagnostic: null:62 Couldn't resolve reference to JvmIdentifiableElement 'webSupport'., XtextLinkingDiagnostic: null:63 Couldn't resolve reference to JvmIdentifiableElement 'genericIdeSupport'., XtextLinkingDiagnostic: null:64 Couldn't resolve reference to JvmIdentifiableElement 'testingSupport'., XtextLinkingDiagnostic: null:65 Couldn't resolve reference to JvmIdentifiableElement 'mavenLayout'., XtextLinkingDiagnostic: null:72 Couldn't resolve reference to JvmIdentifiableElement 'uri'.]
java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:58 Couldn't resolve reference to JvmType 'WizardConfig'., XtextLinkingDiagnostic: null:59 Couldn't resolve reference to JvmIdentifiableElement 'runtimeRoot'., XtextLinkingDiagnostic: null:60 Couldn't resolve reference to JvmIdentifiableElement 'eclipseEditor'., XtextLinkingDiagnostic: null:61 Couldn't resolve reference to JvmIdentifiableElement 'ideaEditor'., XtextLinkingDiagnostic: null:62 Couldn't resolve reference to JvmIdentifiableElement 'webSupport'., XtextLinkingDiagnostic: null:63 Couldn't resolve reference to JvmIdentifiableElement 'genericIdeSupport'., XtextLinkingDiagnostic: null:64 Couldn't resolve reference to JvmIdentifiableElement 'testingSupport'., XtextLinkingDiagnostic: null:65 Couldn't resolve reference to JvmIdentifiableElement 'mavenLayout'., XtextLinkingDiagnostic: null:72 Couldn't resolve reference to JvmIdentifiableElement 'uri'.]
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:88)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
:ourdsl:generateXtextLanguage FAILED

FAILURE: Build failed with an exception.

Step by Step ... Wink
Thanks for your help!

https://github.com/biancode/mydsl-idea

may you can test it from github

[Updated on: Thu, 12 November 2015 01:36]

Report message to a moderator

Re: Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1714422 is a reply to message #1714346] Thu, 12 November 2015 14:46 Go to previous messageGo to next message
Stefan Oehme is currently offline Stefan OehmeFriend
Messages: 159
Registered: April 2010
Location: Kiel
Senior Member

Hi Klaus,

regarding the IntelliJ projects: Since you have them in separate projects, you have to publish each language to an IntelliJRepository and then reference it using the ideaDevelopment block:

ideaDevelopment {
  pluginRepositories {
    url ...
  }
  pluginDependencies {
    id 'mydsl' version '1.0.0'
  }
}


If they were in one multi-project build, it would be easier, like in the Xtext/Xtend plugins in our code base. See the xtext-idea-gradle-plugin page for more info.

Regarding Eclipse:

Projects created with Beta5 will not work with Beta6. The best thing is to recreate them and copy over your customizations.
Also, projects created in IntelliJ do not have a .ui plugin. If you want to have both Eclipse and IntelliJ support, you'll have to develop with Eclipse for now.

Hope that helps =)

Cheers,
Stefan
Re: Gradle Multi-Language Project (IntelliJ Idea 15, Xtend 2.9 Beta) [message #1751556 is a reply to message #1714227] Wed, 11 January 2017 12:58 Go to previous message
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 64
Registered: November 2014
Member
Hi

I have added this in my source-layout.gradle
Quote:
Hi Klaus,

your manifests don't have a bundle name. The bundle name is mandatory for doing platform:resource URIS in the mwe2 workflow. You need to add this to your sourceLayout.gradle

jar {
manifest {
attributes 'Bundle-SymbolicName': project.name
}
}


This has already been fixed in Beta6.

but still I am getting the same error The path /com.mncml/model/mnc.genmodel is unmapped

Please help.
Puneet

[Updated on: Wed, 11 January 2017 13:00]

Report message to a moderator

Previous Topic:Xtext Symbol
Next Topic:Reference across multiple files not working
Goto Forum:
  


Current Time: Fri Apr 19 19:05:58 GMT 2024

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

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

Back to the top