Skip to main content



      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 08:40 Go to next message
Eclipse UserFriend
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 08:49 Go to previous messageGo to next message
Eclipse UserFriend
can you please explain what you actually try to do
are you using maven tycho or pure maven

[Updated on: Sat, 19 May 2018 08:53] by Moderator

Re: Unsuccessful build using Maven due missing EMF classes [message #1787130 is a reply to message #1787129] Sat, 19 May 2018 08:59 Go to previous messageGo to next message
Eclipse UserFriend
and: which method do you actually want to call. i dont know that getRoot method. only getRootContainer
Re: Unsuccessful build using Maven due missing EMF classes [message #1787131 is a reply to message #1787129] Sat, 19 May 2018 09:07 Go to previous messageGo to next message
Eclipse UserFriend
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 09:08 Go to previous messageGo to next message
Eclipse UserFriend
but you import xtexts ecoreutil2
Re: Unsuccessful build using Maven due missing EMF classes [message #1787133 is a reply to message #1787132] Sat, 19 May 2018 09:09 Go to previous messageGo to next message
Eclipse UserFriend
and: where is the util placed in relation to the call site
Re: Unsuccessful build using Maven due missing EMF classes [message #1787134 is a reply to message #1787133] Sat, 19 May 2018 09:11 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Unsuccessful build using Maven due missing EMF classes [message #1787135 is a reply to message #1787134] Sat, 19 May 2018 09:14 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Unsuccessful build using Maven due missing EMF classes [message #1787136 is a reply to message #1787134] Sat, 19 May 2018 09:14 Go to previous messageGo to next message
Eclipse UserFriend
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 09:17 Go to previous messageGo to next message
Eclipse UserFriend
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?

[Updated on: Sat, 19 May 2018 09:22] by Moderator

Re: Unsuccessful build using Maven due missing EMF classes [message #1787138 is a reply to message #1787137] Sat, 19 May 2018 09:45 Go to previous messageGo to next message
Eclipse UserFriend
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 105 times)
Re: Unsuccessful build using Maven due missing EMF classes [message #1787141 is a reply to message #1787138] Sat, 19 May 2018 10:39 Go to previous messageGo to next message
Eclipse UserFriend
No. Have a look at the target file. Open it and hit the button that says something
Like „set as target platform "
Re: Unsuccessful build using Maven due missing EMF classes [message #1787149 is a reply to message #1787141] Sat, 19 May 2018 16:17 Go to previous messageGo to next message
Eclipse UserFriend
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 01:00 Go to previous message
Eclipse UserFriend
Yes that's what I meant
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 Jun 13 10:26:37 EDT 2025

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

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

Back to the top