Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Build problems with xcore and xtext-maven-plugin:2.17.0.M2 #71

Closed
richard-melvin opened this issue Feb 8, 2019 · 20 comments
Closed

Build problems with xcore and xtext-maven-plugin:2.17.0.M2 #71

richard-melvin opened this issue Feb 8, 2019 · 20 comments

Comments

@richard-melvin
Copy link

Not sure if this is the right place to raise this, as it is a typical eclipse dependency interaction where it is impossible, as a user, to find the root cause.

Building a dsl with xcore, xtext-maven-plugin and the xtext-dev-bom, get

[ERROR] Failed to execute goal org.eclipse.xtext:xtext-maven-plugin:2.17.0.M2:generate (default) on project dsl.model: Execution default of goal org.eclipse.xtext:xtext-maven-plugin:2.17.0.M2:generate failed: An API incompatibility was encountered while executing org.eclipse.xtext:xtext-maven-plugin:2.17.0.M2:generate: java.lang.NoSuchMethodError: org.eclipse.emf.ecore.util.EcoreValidator$EGenericTypeBuilder.buildEGenericType(Ljava/lang/String;)Lorg/eclipse/emf/ecore/EGenericType;

This comes from a call in XcoreJvmInferrer of org.eclipse.emf.ecore.xcore 1.7.0 to EcoreValidator.EGenericTypeBuilder.INSTANCE.buildEGenericType, which does not exist until org.eclipse.emf.ecore 2.16.0.

Relevant classpath entries during the build are:

[ERROR] urls[0] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/xtext/xtext-maven-plugin/2.17.0.M2/xtext-maven-plugin-2.17.0.M2.jar
[ERROR] urls[1] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/emf/org.eclipse.emf.ecore.xcore/1.7.0/org.eclipse.emf.ecore.xcore-1.7.0.jar
[ERROR] urls[2] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/xtext/org.eclipse.xtext/2.17.0.M2/org.eclipse.xtext-2.17.0.M2.jar
[ERROR] urls[3] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.lib/2.17.0.M2/org.eclipse.xtend.lib-2.17.0.M2.jar
[ERROR] urls[4] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.lib.macro/2.17.0.M2/org.eclipse.xtend.lib.macro-2.17.0.M2.jar
[ERROR] urls[5] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/platform/org.eclipse.osgi/3.13.200/org.eclipse.osgi-3.13.200.jar
[ERROR] urls[6] = file:/C:/Users/melvin_r/.m2/repository/org/eclipse/emf/org.eclipse.emf.common/2.12.0/org.eclipse.emf.common-2.12.0.jar

The version 2.12.0 of org.eclipse.emf.common is specified by xtext-dev-bom 2.17.0.M2.

The only other publicly available version of org.eclipse.emf.ecore.xcore that I can find is 1.3.1, which fails with a different error.

Full stack is:

Thread [main] (Suspended (exception NoSuchMethodError))
owns: Object (id=32182)
XcoreJvmInferrer$TypeReferenceHelper.getEGenericType(String) line: 2679
XcoreJvmInferrer.getJvmTypeReference(String, EObject) line: 2736
XcoreJvmInferrer$10.inferStructure() line: 1618
XcoreJvmInferrer$10.inferStructure() line: 1
XcoreJvmInferrer$10(XcoreJvmInferrer$JvmElementInferrer).(int) line: 148
XcoreJvmInferrer$10.(XcoreJvmInferrer, int, GenEnum) line: 1612
XcoreJvmInferrer.getDeclaredType(GenEnum) line: 1612
XcoreJvmInferrer.getDeclaredTypes(GenClassifier) line: 1602
XcoreJvmInferrer.getDeclaredTypes(GenPackage) line: 1004
XcoreJvmInferrer.inferElements(GenModel) line: 218
XcoreModelAssociator.installDerivedState(DerivedStateAwareResource, boolean) line: 97
XcoreResource(DerivedStateAwareResource).installDerivedState(boolean) line: 243
XcoreResourceDescriptionManager(DerivedStateAwareResourceDescriptionManager).internalGetResourceDescription(Resource, IDefaultResourceDescriptionStrategy) line: 54

@cdietrich
Copy link
Member

you should keep to the old emf/xcore versions the bom wants to have.
see eclipse/xtext#1282 for the emf update

@cdietrich
Copy link
Member

and use java 8 for that.

@cdietrich
Copy link
Member

@richard-melvin
Copy link
Author

I guess I'll have to wait on 2.17.0 release, as the older versions suddenly started failing with an error:

[ERROR] Failed to execute goal org.eclipse.xtext:xtext-maven-plugin:2.15.0:generate (default) on project dsl.model: Execution default of goal org.eclipse.xtext:xtext-maven-plugin:2.15.0:generate failed: An API incompatibility was encountered while executing org.eclipse.xtext:xtext-maven-plugin:2.15.0:generate: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.batch.FileSystem.getClasspath(Ljava/lang/String;Ljava/lang/String;ZLorg/eclipse/jdt/internal/compiler/env/AccessRuleSet;Ljava/lang/String;Ljava/util/Map;)Lorg/eclipse/jdt/internal/compiler/batch/FileSystem$Classpath;

as covered by eclipse/xtext#1373, which ended up closed with the advice 'use a newer version'.

@cdietrich
Copy link
Member

no this wont help. M2 has everything we plan

@cdietrich
Copy link
Member

if you basically list everything you want explicitely and dont pull
new platform/emf/jdt plugins then everthing will work fine

@cdietrich
Copy link
Member

you you just use xcore maven will pull arbitry combinations cause
all the plugins have ranges that ly

@cdietrich
Copy link
Member

can you provide a minimal sample project sowing the problem?

@richard-melvin
Copy link
Author

Reproduction test case:

dsl.model.minimal.zip

The model needs to have a bit of stuff in it to cause some generic type reasoning to happen.

I want to specify everything; I just have no idea what combination of versions of the 56 jar files involved would successfully compile against each other.

@cdietrich
Copy link
Member

i dont get it running neither . the iterable import in the xcore file looks bugus.
if i change it to java.lang.Iterable it still dont work

[ERROR] ERROR:java.lang.Iterable cannot be resolved. (file:/home/dietrich/Downloads/dsl.model.minimal/src/main/resources/Demo.xcore line : 23 column : 8)
[ERROR] ERROR:A generic type in this context must refer to a classifier or a type parameter (file:/home/dietrich/Downloads/dsl.model.minimal/src/main/resources/Demo.xcore line : 23 column : null)
[ERROR] ERROR:A generic type may have arguments only if it refers to a classifier (file:/home/dietrich/Downloads/dsl.model.minimal/src/main/resources/Demo.xcore line : 23 column : null)
[INFO] ------------------------------------------------

is this the message you get?

@cdietrich
Copy link
Member

https://github.com/cdietrich/xcore-maven-example works with 2.16
but the same problem: i cannot reference to java.lang.Something
@szarnekow @merks do you know how xcore refers to java and why that could fail in this usecase?

@cdietrich
Copy link
Member

scope.getAllElements()
(com.google.common.collect.Iterables$2) [User, BigDecimal, BigInteger, Boolean, Byte, Character, Date, Double, Float, Integer, Class, Object, Long, Short, String, java.math.BigDecimal, java.math.BigInteger, boolean, java.lang.Boolean, byte, java.lang.Byte, char, java.lang.Character, java.util.Date, double, java.lang.Double, float, java.lang.Float, int, java.lang.Integer, java.lang.Class, java.lang.Object, long, java.lang.Long, short, java.lang.Short, java.lang.String, org.eclipse.emf.ecore.EBigDecimal, org.eclipse.emf.ecore.EBigInteger, org.eclipse.emf.ecore.EBoolean, org.eclipse.emf.ecore.EBooleanObject, org.eclipse.emf.ecore.EByte, org.eclipse.emf.ecore.EByteArray, org.eclipse.emf.ecore.EByteObject, org.eclipse.emf.ecore.EChar, org.eclipse.emf.ecore.ECharacterObject, org.eclipse.emf.ecore.EDate, org.eclipse.emf.ecore.EDiagnosticChain, org.eclipse.emf.ecore.EDouble, org.eclipse.emf.ecore.EDoubleObject, org.eclipse.emf.ecore.EEList, org.eclipse.emf.ecore.EEnumerator, org.eclipse.emf.ecore.EFeatureMap, org.eclipse.emf.ecore.EFeatureMapEntry, org.eclipse.emf.ecore.EFloat, org.eclipse.emf.ecore.EFloatObject, org.eclipse.emf.ecore.EInt, org.eclipse.emf.ecore.EIntegerObject, org.eclipse.emf.ecore.EJavaClass, org.eclipse.emf.ecore.EJavaObject, org.eclipse.emf.ecore.ELong, org.eclipse.emf.ecore.ELongObject, org.eclipse.emf.ecore.EMap, org.eclipse.emf.ecore.EResource, org.eclipse.emf.ecore.EResourceSet, org.eclipse.emf.ecore.EShort, org.eclipse.emf.ecore.EShortObject, org.eclipse.emf.ecore.EString, org.eclipse.emf.ecore.ETreeIterator, org.eclipse.emf.ecore.EInvocationTargetException, org.eclipse.emf.ecore.EAttribute, org.eclipse.emf.ecore.EAnnotation, org.eclipse.emf.ecore.EClass, org.eclipse.emf.ecore.EClassifier, org.eclipse.emf.ecore.EDataType, org.eclipse.emf.ecore.EEnum, org.eclipse.emf.ecore.EEnumLiteral, org.eclipse.emf.ecore.EFactory, org.eclipse.emf.ecore.EModelElement, org.eclipse.emf.ecore.ENamedElement, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EOperation, org.eclipse.emf.ecore.EPackage, org.eclipse.emf.ecore.EParameter, org.eclipse.emf.ecore.EReference, org.eclipse.emf.ecore.EStructuralFeature, org.eclipse.emf.ecore.ETypedElement, org.eclipse.emf.ecore.EStringToStringMapEntry, org.eclipse.emf.ecore.EGenericType, org.eclipse.emf.ecore.ETypeParameter, org.eclipse.emf.ecore.xml.namespace.SpaceType, org.eclipse.emf.ecore.xml.namespace.LangType, org.eclipse.emf.ecore.xml.namespace.LangTypeNull, org.eclipse.emf.ecore.xml.namespace.SpaceTypeObject, org.eclipse.emf.ecore.xml.namespace.XMLNamespaceDocumentRoot, org.eclipse.emf.ecore.xml.type.AnySimpleType, org.eclipse.emf.ecore.xml.type.AnyURI, org.eclipse.emf.ecore.xml.type.Base64Binary, org.eclipse.emf.ecore.xml.type.Boolean, org.eclipse.emf.ecore.xml.type.BooleanObject, org.eclipse.emf.ecore.xml.type.Byte, org.eclipse.emf.ecore.xml.type.ByteObject, org.eclipse.emf.ecore.xml.type.Date, org.eclipse.emf.ecore.xml.type.DateTime, org.eclipse.emf.ecore.xml.type.Decimal, org.eclipse.emf.ecore.xml.type.Double, org.eclipse.emf.ecore.xml.type.DoubleObject, org.eclipse.emf.ecore.xml.type.Duration, org.eclipse.emf.ecore.xml.type.ENTITIES, org.eclipse.emf.ecore.xml.type.ENTITIESBase, org.eclipse.emf.ecore.xml.type.ENTITY, org.eclipse.emf.ecore.xml.type.Float, org.eclipse.emf.ecore.xml.type.FloatObject, org.eclipse.emf.ecore.xml.type.GDay, org.eclipse.emf.ecore.xml.type.GMonth, org.eclipse.emf.ecore.xml.type.GMonthDay, org.eclipse.emf.ecore.xml.type.GYear, org.eclipse.emf.ecore.xml.type.GYearMonth, org.eclipse.emf.ecore.xml.type.HexBinary, org.eclipse.emf.ecore.xml.type.ID, org.eclipse.emf.ecore.xml.type.IDREF, org.eclipse.emf.ecore.xml.type.IDREFS, org.eclipse.emf.ecore.xml.type.IDREFSBase, org.eclipse.emf.ecore.xml.type.Int, org.eclipse.emf.ecore.xml.type.Integer, org.eclipse.emf.ecore.xml.type.IntObject, org.eclipse.emf.ecore.xml.type.Language, org.eclipse.emf.ecore.xml.type.Long, org.eclipse.emf.ecore.xml.type.LongObject, org.eclipse.emf.ecore.xml.type.Name, org.eclipse.emf.ecore.xml.type.NCName, org.eclipse.emf.ecore.xml.type.NegativeInteger, org.eclipse.emf.ecore.xml.type.NMTOKEN, org.eclipse.emf.ecore.xml.type.NMTOKENS, org.eclipse.emf.ecore.xml.type.NMTOKENSBase, org.eclipse.emf.ecore.xml.type.NonNegativeInteger, org.eclipse.emf.ecore.xml.type.NonPositiveInteger, org.eclipse.emf.ecore.xml.type.NormalizedString, org.eclipse.emf.ecore.xml.type.NOTATION, org.eclipse.emf.ecore.xml.type.PositiveInteger, org.eclipse.emf.ecore.xml.type.QName, org.eclipse.emf.ecore.xml.type.Short, org.eclipse.emf.ecore.xml.type.ShortObject, org.eclipse.emf.ecore.xml.type.String, org.eclipse.emf.ecore.xml.type.Time, org.eclipse.emf.ecore.xml.type.Token, org.eclipse.emf.ecore.xml.type.UnsignedByte, org.eclipse.emf.ecore.xml.type.UnsignedByteObject, org.eclipse.emf.ecore.xml.type.UnsignedInt, org.eclipse.emf.ecore.xml.type.UnsignedIntObject, org.eclipse.emf.ecore.xml.type.UnsignedLong, org.eclipse.emf.ecore.xml.type.UnsignedShort, org.eclipse.emf.ecore.xml.type.UnsignedShortObject, org.eclipse.emf.ecore.xml.type.AnyType, org.eclipse.emf.ecore.xml.type.ProcessingInstruction, org.eclipse.emf.ecore.xml.type.SimpleAnyType, org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot]

=> is it possible Iterable is simply not allowed in an op e.g.

    op Iterable x() {
    	null
    }```

@cdietrich
Copy link
Member

cdietrich commented Feb 10, 2019

import org.eclipse.xtext.common.types.Iterable
somehow works when having plugin dependencies in eclipse.
have no idea why
update: it links to datatype types in common.types.jar

@cdietrich
Copy link
Member

@merks
Copy link

merks commented Feb 10, 2019

Note that the name referenced in the op's return type must refer to an EClassifier in some Ecore model. So while many things are visible because Ecore has EDataTypes for them and the scoping rules make those visible, don't expect some arbitrary Java class name to be visible in this scope. One must define a type in some Xcore model to make Iterable visible as the return type of an op or as the type of any of its parameters. E.g., like this:

type Iterable wraps Iterable

class Test {
op Iterable<?> bar() {
return null
}
}

@merks
Copy link

merks commented Feb 10, 2019

Oops, it should be like this with a type parameter so that you can pass arguments and so there is no raw type warning.

type Iterable<T> wraps Iterable

class Test
{
	op Iterable<?> bar() {
		return null
	}
	
}

@merks
Copy link

merks commented Feb 10, 2019

Hmm, every time the < T > disappears when I post Iterable < T >when I post!

@richard-melvin
Copy link
Author

Following the link above and copying out the exact full list of dependencies to the dependency section of the maven-plugin does seem to work.

@cdietrich
Copy link
Member

TODO: can we improve something or just close

@richard-melvin
Copy link
Author

Might as well close this specific issue. But please keep in mind that there is obviously some kind of underlying process or tools issue that causes these kind of dependency problems to keep happening.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants