Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Unsuccessful build using Maven due missing EMF classes(Maven does not see extended EcoreUtil class )
Unsuccessful build using Maven due missing EMF classes [message #1787128] Sat, 19 May 2018 12:40 Go to next message
Marek Stankiewicz is currently offline Marek StankiewiczFriend
Messages: 11
Registered: June 2016
Junior Member
I am moving my projects to Maven and start having problems with what looks like missing EMF classes.

The error I am getting is as follows

The method getRoot(EObject, boolean) is undefined for the type Class<EcoreUtil2>

The problem can be easily recreated using sample DSL Hello generated by the Xtext project wizard by adding the following class.
package org.xtext.example.util

import org.eclipse.xtext.EcoreUtil2
import org.eclipse.emf.ecore.EObject

class Utility {

def void doit(EObject context) {
EcoreUtil2.getResourceSet(EcoreUtil2.getRoot(context, true)).allContents.toList
}

}

I am new to Maven, but suspect that there are some missing packages in the Maven repository or something wrong with dependencies.

Version: Oxygen.3a Release (4.7.3a)
Xtext 2.12
Maven 1.8

Does anybody have a similar problem and how to solve it?
Re: Unsuccessful build using Maven due missing EMF classes [message #1787129 is a reply to message #1787128] Sat, 19 May 2018 12:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you please explain what you actually try to do
are you using maven tycho or pure maven


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 19 May 2018 12:53]

Report message to a moderator

Re: Unsuccessful build using Maven due missing EMF classes [message #1787130 is a reply to message #1787129] Sat, 19 May 2018 12:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
and: which method do you actually want to call. i dont know that getRoot method. only getRootContainer

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unsuccessful build using Maven due missing EMF classes [message #1787131 is a reply to message #1787129] Sat, 19 May 2018 13:07 Go to previous messageGo to next message
Marek Stankiewicz is currently offline Marek StankiewiczFriend
Messages: 11
Registered: June 2016
Junior Member
Hi Christian, Thanks for your reply.
Basically, I am developing utility class in one of my Xtext projects that navigates thru the resources. All works fine when building using native Eclipse. I moved my projects to Maven to benefit from automation
outside eclipse.

I managed to recreate the problem in a very simple project created by default by the New Xtext Project wizard.

I only added a simple Xtend file with one method as described above.
It looks like EcoreUtil2 extends EcoreUtil

and EcoreUtil has a public method

public static Notifier getRoot(EObject eObject, boolean resolve)

It works fine in eclipse and does not indicate any problems. It just when running verify in the mvn.



Re: Unsuccessful build using Maven due missing EMF classes [message #1787132 is a reply to message #1787131] Sat, 19 May 2018 13:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
but you import xtexts ecoreutil2

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unsuccessful build using Maven due missing EMF classes [message #1787133 is a reply to message #1787132] Sat, 19 May 2018 13:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
and: where is the util placed in relation to the call site

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unsuccessful build using Maven due missing EMF classes [message #1787134 is a reply to message #1787133] Sat, 19 May 2018 13:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
and no ecoreutil does not have a getroot (at least not in all versions)
maybe you maven and explicit or implicit target platform differs
do where does the ecoreutil.getroot come from.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unsuccessful build using Maven due missing EMF classes [message #1787135 is a reply to message #1787134] Sat, 19 May 2018 13:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
looks like its new in emf 2.13 +

https://github.com/eclipse/emf/blob/53e094c68d2e1fadc5ef8da17abbbe721aea5f04/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreUtil.java#L3479


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unsuccessful build using Maven due missing EMF classes [message #1787136 is a reply to message #1787134] Sat, 19 May 2018 13:14 Go to previous messageGo to next message
Marek Stankiewicz is currently offline Marek StankiewiczFriend
Messages: 11
Registered: June 2016
Junior Member
This one has getRoot()

/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.emf.ecore.source_2.13.0.v20170609-0707.jar
Re: Unsuccessful build using Maven due missing EMF classes [message #1787137 is a reply to message #1787136] Sat, 19 May 2018 13:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
then the question is: if you use maven, did you set the target platform to use an update site that contains that version or did you change eclipse to use the target platform that is used in maven?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 19 May 2018 13:22]

Report message to a moderator

Re: Unsuccessful build using Maven due missing EMF classes [message #1787138 is a reply to message #1787137] Sat, 19 May 2018 13:45 Go to previous messageGo to next message
Marek Stankiewicz is currently offline Marek StankiewiczFriend
Messages: 11
Registered: June 2016
Junior Member
well, I used all defaults set by New Xtext Project. It generates the pom file as attached.

It shows dependency as

<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.mwe2.launch</artifactId>
<version>2.9.0.201605261059</version>
<scope>compile</scope>
</dependency>

Could it be a problem?
  • Attachment: pom.xml
    (Size: 4.46KB, Downloaded 76 times)
Re: Unsuccessful build using Maven due missing EMF classes [message #1787141 is a reply to message #1787138] Sat, 19 May 2018 14:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
No. Have a look at the target file. Open it and hit the button that says something
Like „set as target platform "


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unsuccessful build using Maven due missing EMF classes [message #1787149 is a reply to message #1787141] Sat, 19 May 2018 20:17 Go to previous messageGo to next message
Marek Stankiewicz is currently offline Marek StankiewiczFriend
Messages: 11
Registered: June 2016
Junior Member
New Xtext Project wizard produces the following target file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="z2.target" sequenceNumber="1">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.feature.group" version="0.0.0"/>
<unit id="org.eclipse.platform.feature.group" version="0.0.0"/>
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.xpand" version="0.0.0"/>
<unit id="org.eclipse.xtend" version="0.0.0"/>
<unit id="org.eclipse.xtend.typesystem.emf" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/neon/201606221000/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/modeling/emft/mwe/updates/releases/2.9.0/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.12.0/"/>
</location>
</locations>
</target>

I have modified file to point oxygen instead of neon, so it looks like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="z1.target" sequenceNumber="1">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.feature.group" version="0.0.0"/>
<unit id="org.eclipse.platform.feature.group" version="0.0.0"/>
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.draw2d.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.xpand" version="0.0.0"/>
<unit id="org.eclipse.xtend" version="0.0.0"/>
<unit id="org.eclipse.xtend.typesystem.emf" version="0.0.0"/>
<unit id="org.eclipse.emf.mwe2.launcher.feature.group" version="0.0.0"/>
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/oxygen/"/>
</location>
</locations>
</target>

This solved problem with getRoot().
Re: Unsuccessful build using Maven due missing EMF classes [message #1787151 is a reply to message #1787149] Sun, 20 May 2018 05:00 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Yes that's what I meant

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Generated code
Next Topic:The trick doesn't work for a rule that may be consumed without object instantiation
Goto Forum:
  


Current Time: Fri Mar 29 06:56:48 GMT 2024

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

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

Back to the top