Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Git / Maven Setup for standalone build
Git / Maven Setup for standalone build [message #1841581] Fri, 21 May 2021 07:42 Go to next message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 80
Registered: December 2018
Member
Hi,

I am creating a new DSL with Git, GitLab and Maven, following Lorenzo's book and this guide:
https://www.eclipse.org/Xtext/documentation/350_continuous_integration.html

I am kinda new to Maven and Tycho but reasonably experienced with XText.

So far, everything works fine, so the Feature is nicely build by maven and works fine.

Now I would like to add a standalone version of the compiler. In my previous DSL projects I always creates a new Eclipse project that is not an Eclipse Plugin but a simple Java project where I used a Main.java class to read the .mydsl-files, compile them and write back the generated sources. I then used the compiled .jar file wherever I needed to compile my sources.

Now I wonder how I would do this with my new Maven setup - I might not have understood the guide (https://www.eclipse.org/Xtext/documentation/350_continuous_integration.html) correctly and could not find the Standalone code in the linked example (https://github.com/xtext/maven-xtext-example).

My questions:
1. would I still create a new plain Java project for the Standalone-Compiler (now build with Maven)?
2. if so, where would this project go? would it just be an additional module of my parent POM and go directly in the same Git repo or would I use a new Git repo for this?
3. In the guide (https://www.eclipse.org/Xtext/documentation/350_continuous_integration.html) the "Integration in Standard Maven Builds" is mentioned. Does the "standard maven build" actually refer to the Standalone-Compiler I described above?

Sorry for my confusion!
Re: Git / Maven Setup for standalone build [message #1841583 is a reply to message #1841581] Fri, 21 May 2021 07:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
you can use the maven share plugin also with tycho to create an all in one runnable jar file if you want e.g. https://github.com/eclipse/xtext-core/blob/1c665f64a5c5b2952658c6fe6a10bc7981a1f94d/org.eclipse.xtext.tests/testdata/wizard-expectations/lsMavenTychoFatjar/lsMavenTychoFatjar.parent/lsMavenTychoFatjar.ide/pom.xml#L125

the problem you have to get tycho and maven (transitive) dependencies under one hood.

Integration in Standard Maven Builds is about the a plugin that allows you to validate and generate files of your dsl in a maven priject.
it is not an arbitry jar you call with java -jar


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: Git / Maven Setup for standalone build [message #1841589 is a reply to message #1841583] Fri, 21 May 2021 10:53 Go to previous messageGo to next message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 80
Registered: December 2018
Member
OK, I see (I assume you meant maven SHADE not SHARE).

Two follow-up question:
1. I assume I would create a new module in my parent POM that refers to the child POM, in which I would configure the maven shade plugin. Is that correct? So when I build my DSL i would also automatically build the standalone.jar, right?

2. If I want to compile .myDsl files in a maven build process (obviously I mean a pipeline different from my DSL-pipeline). Is my approach (compile a simple standalone.jar, then run this jar through maven) suboptimal in your opinion? It seems that the other approach is to create a maven plugin that does the compilation in the maven pipeline for me, instead of using the standalone.jar-file? Did I understand you correctly this time? I would assume this is what the "Integration in Standard Maven Builds" is about.

Thanks for your help.

€:
OK, after Reading this article and looking into this class I think I have been doing in fundamentally wrong. Your "Integration in Standard Maven Builds" already describes how I can compile .mydsl files in client-projects. I will give this a try.

[Updated on: Fri, 21 May 2021 11:07]

Report message to a moderator

Re: Git / Maven Setup for standalone build [message #1841590 is a reply to message #1841589] Fri, 21 May 2021 11:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
1. yes
2. depends. If you are fine with the standalone jar or the maven plugin is insufficient then it's ok
But using the maven plugin would be the predictable way


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: Git / Maven Setup for standalone build [message #1841591 is a reply to message #1841590] Fri, 21 May 2021 11:16 Go to previous messageGo to next message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 80
Registered: December 2018
Member
Great, thank you. I just came to the same conclusions. I will try to forgo the standalone.jar and use the maven plugin.

One last question:
MYDSL actually compiles into MYSECONDDSL files. Both DSLs are XText-DSLs which I included in the same feature. They are meant to be compiled one after another (similar to how Xtend compiles into Java which compiles into ByteCode). As a futher complication, MYSECONDDSL-Files may crosslink to MYDSL files (but not this other way around), which means, that in order to compile MYSECONDDSL all MYDSL files have to be loaded into the ResourceSet as well.

Of course, in my standalone.jar this was relatively easy to achive. How would I do this in Maven? Would I just duplicate the xtext-maven-plugin in my client POM (once for each DSL) in order to run these languages one after another?

I fear that the MYDSL files would not be loaded into the ResourceSet when compiling MYSECONDDSL. If that poses a problem, I guess I could get rid of the cross-references between the two DSLs...

Thanks!
Re: Git / Maven Setup for standalone build [message #1841592 is a reply to message #1841591] Fri, 21 May 2021 11:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
i have doubts the plugin can do that

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: Git / Maven Setup for standalone build [message #1841593 is a reply to message #1841591] Fri, 21 May 2021 11:31 Go to previous message
Konrad Jünemann is currently offline Konrad JünemannFriend
Messages: 80
Registered: December 2018
Member
OK, read more into the MOJOs code and your guide (https://www.eclipse.org/Xtext/documentation/350_continuous_integration.html#integration-in-standard-maven-builds). I think I am getting a better grasp now - thanks for your work! Looks pretty good!
Previous Topic:Multiple Generator calls on Xtext language
Next Topic:Cross-referencing two different rules?
Goto Forum:
  


Current Time: Sun Sep 26 17:07:49 GMT 2021

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

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

Back to the top