Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign
Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774857] Fri, 20 October 2017 14:58 Go to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
I'm stumped. I have a working Xtext 2.8.x Project that we were building manually.

I've been able to get 2 Xtext 2.10 Maven projects to build successfully in Jenkins and I've copied over these Maven/Tycho setup poms and adjusted them into my Xtext 2.8.x Project.

What I'm seeing is that Maven/Tycho is not actually building the xtend-gen and src-gen directories during the clean install Maven run. This results in compile errors.

If I, instead, allow Eclipse to build the src-gen/xtend-gen directories, then I run Maven, I get a successful build and deployment (but I know Maven isn't really building the Xtext artifacts).

I briefly attempted to change my MWE2 workflow from 2.8.x to 2.10 but there is such a significant difference and change in project directory structure (the ide split) that I don't want to go down that path. Nearly a full day of swimming in problems has convinced me I don't want to go to the newest MWE2 for this project unless I just want to hand migrate and start from 2.10+ from scratch and rebuild it all.

Can anyone think of any Maven tricks I can play in the POMs to get my 2.8.x Xtext Project to build with 2.10 in Maven? Everything works and compiles fine in the Eclipse IDE with the target set to 2.10, so that shouldn't be an issue, I just can't figure out how to tell Maven to generate the src-gen/xtend-gen directories with Maven and my current MWE2.

Any tricks?
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774859 is a reply to message #1774857] Fri, 20 October 2017 15:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
i am not sure what you are talking about. the maven files you use with xtext 2.8.4 are handcrafted, arent they. xtext xtend-java trafo is done by the xtend maven plugin. the src-gen stuff is created by the mwe (no matter if called via exec maven or fornax plugin. the build.properties file determines which source folders tycho sees.

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774861 is a reply to message #1774859] Fri, 20 October 2017 15:10 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Christian Dietrich wrote on Fri, 20 October 2017 11:01
the maven files you use with xtext 2.8.4 are handcrafted, arent they.


I've never built the 2.8.4 Project with Maven. I've copied over working pom files from my Xtext 2.10 projects. They are hand crafted only in the sense that I changed all the project names I'm trying to build, but those are the only changes I made. (the original 2.10 poms were hand copied and modified from 2.10 examples on github or from a 2.10 example project in Eclipse)
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774862 is a reply to message #1774861] Fri, 20 October 2017 15:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
yes but that poms target the new workflow and the new generator => will not work 1.1
maybe you should have a look at pre 2.9 maven stuff e.g. https://github.com/cdietrich/xtext-maven-example/tree/78982f3d73303a32a7ef74b5dd2fa6162717a771


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774863 is a reply to message #1774862] Fri, 20 October 2017 15:28 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Thank you, I will check that link and report back. Have a good weekend.
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774871 is a reply to message #1774863] Fri, 20 October 2017 18:07 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Making progress, but I can't tell if I'm any closer. I've run into an issue with the example in that my ecore model is defined external to my DSL project. When the MWE2 engine is run, it cannot find the registered GeneratedPackage:

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
... 35 more
Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't find an interface <my package>.<mypackage>Package
at org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGeneratedEPackage(StandaloneSetup.java:430)
... 40 more

My Standlone bean has the following defined (which works cleanly in the Eclipse IDE):

Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
registerGeneratedEPackage = "<my package>.<my package>Package"
registerGenModelFile = "platform:/resource/<project dir>/model/<model name>.genmodel"


I don't have anything in the pom that I know of that says "hey, look somewhere else for the model packages"
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774872 is a reply to message #1774871] Fri, 20 October 2017 18:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
did you adapt the manifest?

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774873 is a reply to message #1774872] Fri, 20 October 2017 18:26 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
I did not modify my manifest of my DSL. The manifest is correct enough that Eclipse IDE can build it, so I thought Tycho would take over from there. I just did removed the 2.10 org.eclipse.xtext.xtext.generator (2 xtexts), but that didn't make a difference. The DSL's manifest does contain the project that contains the externally model and generated package. MWE2 can find that externally generated package in the IDE.
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774874 is a reply to message #1774873] Fri, 20 October 2017 18:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
what happens if you add it?

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774876 is a reply to message #1774874] Fri, 20 October 2017 18:51 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Adding the org.eclipse.xtext.xtext.generator back into my DSL's manifest doesn't seem to make a difference. The Maven invoked MWE2 run still can't find the referenceGeneratedPackage from my StandaloneSetup bean.
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774877 is a reply to message #1774876] Fri, 20 October 2017 18:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
no add the metamodel plugin to the manifest of the mydsl plugin

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774879 is a reply to message #1774877] Fri, 20 October 2017 19:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
you actually need to add it to the exec plugin as well e.g.

<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.2.1</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<includeProjectDependencies>false</includeProjectDependencies>
					<includePluginDependencies>true</includePluginDependencies>
					<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
					<arguments>
						<argument>file://${project.basedir}/src/org/xtext/example/mydsl/GenerateMyDsl.mwe2</argument>
						<argument>
							-p
						</argument>
						<argument>
							runtimeProject=/${project.basedir}
						</argument>
					</arguments>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.eclipse.xtext</groupId>
						<artifactId>org.eclipse.xtext.xtext</artifactId>
						<version>${xtext-version}</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.xtext</groupId>
						<artifactId>org.eclipse.xtext.xbase</artifactId>
						<version>${xtext-version}</version>
					</dependency>
					<dependency>
						<groupId>org.eclipse.equinox</groupId>
						<artifactId>common</artifactId>
						<version>3.6.200-v20130402-1505</version>
					</dependency>
					<dependency>
						<groupId>org.xtext.example</groupId>
						<artifactId>org.xtext.example.mydsl.metamodel</artifactId>
						<version>1.0.0-SNAPSHOT</version>
					</dependency>
				</dependencies>
			</plugin>


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774881 is a reply to message #1774877] Fri, 20 October 2017 19:13 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
The metamodel plugin is already in the Require-Bundle section of the DSL plugin.
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774882 is a reply to message #1774881] Fri, 20 October 2017 19:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
you need to adapt pom as well. looks like exec does not see manifest

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774883 is a reply to message #1774857] Fri, 20 October 2017 19:15 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 627
Registered: July 2009
Location: Dortmund, Germany
Senior Member

My suggestion would have been to create a new project set incl. build scripts and then copy content over. That's the easiest way to migrate to the new project structure and workflows and makes you future compatible.
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774884 is a reply to message #1774883] Fri, 20 October 2017 19:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
well the metamodel problem will be there in 2.12 as well

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774890 is a reply to message #1774884] Fri, 20 October 2017 20:39 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Ah... okay.. . I added the this dependency part in the exec-maven-plugin:

<dependency>
<groupId>org.xtext.example</groupId>
<artifactId>org.xtext.example.mydsl.metamodel</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>

And I can now Maven build in the Eclipse IDE. Which is progress!

However, Jenkins can't see the plugin. Which I don't understand. The plugin is in a feature that my Target requires, so it's puzzling.

But I've gotten much further. Thanks!
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774891 is a reply to message #1774890] Fri, 20 October 2017 20:45 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Actually, Jenkins is giving me a warning that:

[WARNING] The POM for<company>.<Feature>:<plugin>:jar:2.0.0-SNAPSHOT is missing, no dependency information available

yeah, it's missing. It's not within this DSL's parent's pom structure because it's a part of another feature altogether. Is there a special way to tell the exec-maven-plugin that I have a dependency on a plugin that's in another feature and pom structure?
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774893 is a reply to message #1774891] Fri, 20 October 2017 21:03 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
I changed the pom module ordering of the parent such that the feature specified in my target file gets loaded before I try to compile my DSL - confirmed by the Reactor Summary showing the target before. Still can't find the exec-maven-plugin dependency on Jenkins. Weird.

Is this a problem where the exec-maven-plugin is literally looking for 2.0.0-SHAPSHOT and can't find it in the actual target because the target repository has the literal version 2.0.0.201710202100.jar?

I thought the SNAPSHOT mechanism was supposed to smooth over all that.

[Updated on: Fri, 20 October 2017 21:22]

Report message to a moderator

Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774907 is a reply to message #1774893] Sat, 21 October 2017 05:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
Unmfortunately this is something painful to reproduce

You need to store that stuff in a maven repo
Or you need to fiddle around with wired name tycho uses e.g
<groupId>p2.osgi.bundle</groupId>
<artifactId>org.other.metamodel</artifactId>


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774908 is a reply to message #1774907] Sat, 21 October 2017 05:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
And maybe version should be ${project.version}
(Again hard to follow your structure)


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1774909 is a reply to message #1774908] Sat, 21 October 2017 05:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
and a last thought: update to Xtext 2.12 or 2.13, create new projects with a wizard, the stuff in the pom there can load the plugins from the target platform as well
no need to add an explicit dependency

<configuration>
					<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
					<arguments>
						<argument>/${project.basedir}/src/org/xtext/example/mydsl1/GenerateMyDsl.mwe2</argument>
						<argument>-p</argument>
						<argument>rootPath=/${project.basedir}/..</argument>
					</arguments>
					<classpathScope>compile</classpathScope>
					<includePluginDependencies>true</includePluginDependencies>
					<cleanupDaemonThreads>false</cleanupDaemonThreads><!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
				</configuration>


dont know why this is not working for you (even with 2.8.4)
again no way to reproduce


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 21 October 2017 05:38]

Report message to a moderator

Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1775022 is a reply to message #1774909] Mon, 23 October 2017 15:18 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Thanks for the help. I guess I'll have to move at least to Xtext 2.10. Trying to make this work for 2.8.4 is wasting time unfortunately. FWIW, I've added my repository that contains the metamodel plugin to the parent pom. It had zero effect in Jenkins. The exec-maven-plugin stills complains it can't find a POM for the dependency listed in the DSL POM. It's like the tycho configuration can't resolve the dependency from the target information and the exec-maven can't use the included repository to resolve the plugin dependency.


Xtext 2.9-2.10 always felt like Xtext 3.0 to me since there were so many changes and restructured MWE2 and project layout. I guess I'll just have to Right Click -> Run As.. -> Maven clean install in Windows Eclipse for a while until I have another 3-5 days to manually rebuild/migrate my DSL in Xtext 2.10 or above.

Thank you for trying to help. We got pretty close. I really appreciate your effort.
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1775112 is a reply to message #1775022] Tue, 24 October 2017 17:13 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 96
Registered: May 2012
Member
Just for posterity. Migrating to Xtext 2.10 or above is the proper advice like you said. I now have Jenkins building a version of my grammar in Xtext 2.10. The previous attempt was too error prone and hard to debug and getting Jenkins to run the Maven build for the 2.10 version was much easier to debug and understand what was going on.

Now I have an auto-building project that I can use to continuously test my hand migration of customized files from 2.8.4. (proposals, error handling, derived state aware resource, etc...)

As far as the pain in going from 2.8.4 to 2.10, it was about a day with distractions. I burned way more time than that trying to get it to work with 2.8.4. Which leads me to some of my favorite sayings:
"Technical debt must be paid" and
"Never enough time to do it right, but always enough time to do it again."

Thanks again Christian. You're the best!
Re: Xtext 2.8.x Project Building in Xtext 2.10 with Maven Not Workign [message #1775113 is a reply to message #1775112] Tue, 24 October 2017 17:36 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12254
Registered: July 2009
Senior Member
You are welcome

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:DSL runtime workspace blocks at start waiting for non-existing .*._trace files to be refreshed
Next Topic:Xbase: TypeComputer for own generated Java Classes
Goto Forum:
  


Current Time: Wed Sep 26 15:28:10 GMT 2018

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

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

Back to the top