Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with AbstractFormatter2 when building with gradle
Problems with AbstractFormatter2 when building with gradle [message #1754437] Fri, 17 February 2017 19:55 Go to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
I have a DSL for a language in this multi-project:
https://github.com/JPL-IMCE/jpl.imce.oml.specification.parent

It builds fine with gradle, including an Xcore metamodel
and an Xtext grammar with a few additional Xtend code generators.

I tried to add a formatter following the doc for the new AbstractFormatter2 API. When I build in the Eclipse IDE; it works fine -- i.e., I can launch
a runtime eclipse and test the formatter.

However, when I build with gradle, I get errors like this:

:jpl.imce.oml.specification:generateXtextLanguage
0    [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/emf/2002/Ecore' from 'platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel'
12   [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.w3.org/XML/1998/namespace' from 'platform:/resource/org.eclipse.emf.ecore/model/XMLNamespace.genmodel'
32   [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/emf/2003/XMLType' from 'platform:/resource/org.eclipse.emf.ecore/model/XMLType.genmodel'
70   [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding generated EPackage 'org.eclipse.xtext.xbase.XbasePackage'
107  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
109  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
118  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
118  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
473  [main] INFO  text.xtext.generator.XtextGenerator  - Initializing Xtext generator
473  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding generated EPackage 'org.eclipse.xtext.common.types.TypesPackage'
534  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/'
534  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification.tests at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/'
534  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification.ide at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.ide/'
534  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification.ui at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.ui/'
535  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification.ui.tests at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.ui.tests/'
535  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification.idea at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.idea/'
535  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering project jpl.imce.oml.specification.web at 'file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.web/'
542  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Using resourceSet registry. The registered Packages will not be registered in the global EPackage.Registry.INSTANCE!
1379 [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'xcore.lang' from 'platform:/resource/org.eclipse.emf.ecore.xcore.lib/model/XcoreLang.xcore'
1870 [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'jpl.imce.oml.specification.ecore' from 'platform:/resource/jpl.imce.oml.specification.ecore/model/OMLSpecification.xcore'
4185 [main] INFO  text.xtext.generator.XtextGenerator  - Generating jpl.imce.oml.specification.OntologicalModelingLanguage
17856 [main] INFO  text.xtext.generator.XtextGenerator  - Generating common infrastructure
17867 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.
:jpl.imce.oml.specification:generateXtext
Warning: NLS unused message: auth_alreadySpecified in: org.eclipse.core.internal.runtime.messages
Warning: NLS missing message: line_separator_platform_mac_os_9 in: org.eclipse.core.internal.runtime.messages
ERROR:The method getAnnotationPropertyAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 60 column : 41)
ERROR:The method getAnnotationPropertyAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 61 column : 41)
ERROR:The method getAnnotationAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 67 column : 33)
ERROR:The method getAnnotationAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 68 column : 33)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 75 column : 39)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 76 column : 39)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 78 column : 52)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 79 column : 52)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 102 column : 42)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 103 column : 42)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 123 column : 50)
ERROR:The method getTerminologyGraphAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 124 column : 50)
ERROR:The method getAspectAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 135 column : 29)
ERROR:The method getAspectAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 136 column : 29)
:jpl.imce.oml.specification:generateXtext FAILED

FAILURE: Build failed with an exception.


It seems that there is some kind of registration or injector missing when running in standalone with gradle that happens when running in the IDE.

I'm using Eclipse Neon with Xtext 2.10 and the xtext-gradle-plugin 1.0.17

Any suggestions?

- Nicolas.
Re: Problems with AbstractFormatter2 when building with gradle [message #1754439 is a reply to message #1754437] Fri, 17 February 2017 20:04 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
To give you a sense of what's going on, here's an example of a formatter that builds OK with gradle as long as it doesn't use the injected grammar access:


@SuppressWarnings("all")
class OntologicalModelingLanguageFormatter extends AbstractFormatter2 {
	
	@Inject extension OntologicalModelingLanguageGrammarAccess

	def dispatch void format(TerminologyExtent terminologyExtent, extension IFormattableDocument document) {
		terminologyExtent.prepend[noSpace]
		
		for (AnnotationProperty annotationProperty : terminologyExtent.getAnnotationProperties()) {
			annotationProperty.format;
		}
		
		for (TerminologyGraph terminologyGraph : terminologyExtent.getTerminologyGraphs()) {
			terminologyGraph.format;
		}
		
		for (Bundle bundle : terminologyExtent.getBundles()) {
			bundle.format;
		}
		
		for (DescriptionBox description : terminologyExtent.getDescriptions()) {
			description.format;
		}
	}

	def dispatch void format(AnnotationProperty annotationProperty, extension IFormattableDocument document) {
		annotationProperty.prepend[noSpace]
		//annotationProperty.regionFor.ruleCall(annotationPropertyAccess.ANNOTATION_PROPERTY_TOKENTerminalRuleCall_0).append[oneSpace]
		//annotationProperty.regionFor.ruleCall(annotationPropertyAccess.EQUALTerminalRuleCall_2).surround[noSpace]
		annotationProperty.regionFor.feature(OMLPackage.eINSTANCE.annotationProperty_Iri).append[newLine]
	}


When I build, I get:

:jpl.imce.oml.specification:generateXtext
WARNING:The import 'jpl.imce.oml.specification.ecore.TerminologyBoxStatement' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 25 column : 1)
WARNING:The import 'jpl.imce.oml.specification.ecore.Annotation' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 20 column : 1)
WARNING:The import 'jpl.imce.oml.specification.ecore.Aspect' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 32 column : 1)
WARNING:The import 'jpl.imce.oml.specification.ecore.TerminologyBoxAxiom' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 24 column : 1)
WARNING:The extension jpl.imce.oml.specification.services.OntologicalModelingLanguageGrammarAccess is not used in OntologicalModelingLanguageFormatter (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 37 column : 2)

BUILD SUCCESSFUL


If I uncomment the two lines above, I get:

:jpl.imce.oml.specification:generateXtext
WARNING:The import 'jpl.imce.oml.specification.ecore.TerminologyBoxStatement' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 25 column : 1)
WARNING:The import 'jpl.imce.oml.specification.ecore.Annotation' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 20 column : 1)
WARNING:The import 'jpl.imce.oml.specification.ecore.Aspect' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 32 column : 1)
WARNING:The import 'jpl.imce.oml.specification.ecore.TerminologyBoxAxiom' is never used. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 24 column : 1)
ERROR:The method getAnnotationPropertyAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 61 column : 41)
ERROR:The method getAnnotationPropertyAccess() from the type OntologicalModelingLanguageGrammarAccess refers to the missing type Object (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification/src/jpl/imce/oml/specification/formatting2/OntologicalModelingLanguageFormatter.xtend line : 62 column : 41)
:jpl.imce.oml.specification:generateXtext FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jpl.imce.oml.specification:generateXtext'.
> Xtext validation failed, see build log for details.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jpl.imce.oml.specification:generateXtext'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196)
        at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.GradleException: Xtext validation failed, see build log for details.
        at org.xtext.gradle.builder.XtextGradleBuilder.build(XtextGradleBuilder.java:210)
        at org.xtext.gradle.tasks.XtextGenerate.generate(XtextGenerate.java:149)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
        ... 70 more


BUILD FAILED


Does this help narrow down the problem?
Re: Problems with AbstractFormatter2 when building with gradle [message #1754440 is a reply to message #1754439] Fri, 17 February 2017 20:09 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
I guess one workaround is to engineer the formatter2 without actually using the grammar access.

For example:

//annotationProperty.regionFor.ruleCall(annotationPropertyAccess.ANNOTATION_PROPERTY_TOKENTerminalRuleCall_0).append[oneSpace]
annotationProperty.regionFor.keyword("annotationProperty").append[oneSpace]
		
//annotationProperty.regionFor.ruleCall(annotationPropertyAccess.EQUALTerminalRuleCall_2).surround[noSpace]
annotationProperty.regionFor.keyword("=").surround[noSpace]


It would be nice if we could use formatter2 with grammar access and have that build properly with the xtext-gradle-plugin.

Has someone tried this combo?
Re: Problems with AbstractFormatter2 when building with gradle [message #1754441 is a reply to message #1754440] Fri, 17 February 2017 20:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
sounds like https://github.com/eclipse/xtext-extras/issues/30 which is fixed in the current xtext 2.11

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754456 is a reply to message #1754441] Fri, 17 February 2017 23:35 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Indeed, this looks like the same bug.

I'll try to upgrade to Xtext 2.11.
Re: Problems with AbstractFormatter2 when building with gradle [message #1754459 is a reply to message #1754456] Sat, 18 February 2017 00:08 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Argh... the Neon modeling package includes EMF Parsley 1.0.2 which in turns requires Xtext 2.10 currently.
I guess I have to wait before I can use Xtext 2.11.
Re: Problems with AbstractFormatter2 when building with gradle [message #1754536 is a reply to message #1754459] Sun, 19 February 2017 19:00 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Doing formatting without grammar access is not very pretty; I couldn't get any of the indentation to work as it used to.
So I created a branch with an eclipse target configured for Xtext 2.11; hoping to be able to use grammar access for formatting with indentation.
I had to add a few explicit dependencies compared to what I had for Xtext 2.10.

https://github.com/JPL-IMCE/jpl.imce.oml.specification.parent/tree/xtext2.11

The problem I'm encountering now is in generating the tests from Xtend.
Every test X defined in X.xtend, I get an error that X is already defined in X.xtend.
Why is this an error? I cleaned the project but I still get these errors.

:jpl.imce.oml.specification.tests:generateTestXtext
ERROR:The type OMLAnnotationTest1 is already defined in OMLAnnotationTest1.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLAnnotationTest1.xtend line : 34 column : 7)
ERROR:The type OMLAnnotationTest2 is already defined in OMLAnnotationTest2.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLAnnotationTest2.xtend line : 33 column : 7)
ERROR:The type OMLFileTests is already defined in OMLFileTests.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLFileTests.xtend line : 38 column : 7)
WARNING:The value of the field OMLFileTests.parseHelper is not used (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLFileTests.xtend line : 41 column : 33)
WARNING:The extension org.eclipse.xtext.testing.validation.ValidationTestHelper is not used in OMLFileTests (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLFileTests.xtend line : 45 column : 2)
WARNING:The value of the field OMLFileTests.resourceSetProvider is not used (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLFileTests.xtend line : 49 column : 29)
ERROR:The type OMLTerminologyExtensionTest1 is already defined in OMLTerminologyExtensionTest1.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyExtensionTest1.xtend line : 31 column : 7)
WARNING:The type ValidationTestHelper is deprecated (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyExtensionTest1.xtend line : 27 column : 8)
WARNING:The type ValidationTestHelper is deprecated (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyExtensionTest1.xtend line : 37 column : 12)
WARNING:The method assertNoErrors(EObject) from the type ValidationTestHelper is deprecated (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyExtensionTest1.xtend line : 58 column : 10)
ERROR:The type OMLTerminologyGraph1Test is already defined in OMLTerminologyGraph1Test.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyGraph1Test.xtend line : 33 column : 7)
ERROR:The type OMLTerminologyGraph2Test is already defined in OMLTerminologyGraph2Test.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyGraph2Test.xtend line : 32 column : 7)
ERROR:The type OMLTerminologyGraph3Test is already defined in OMLTerminologyGraph3Test.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OMLTerminologyGraph3Test.xtend line : 31 column : 7)
ERROR:The type OntologicalModelingLanguageParsingTest is already defined in OntologicalModelingLanguageParsingTest.xtend. (file:/opt/local/imce/tools/neon/workspace/jpl.imce.oml.specification.parent/jpl.imce.oml.specification.tests/src/jpl/imce/oml/specification/tests/OntologicalModelingLanguageParsingTest.xtend line : 30 column : 7)
:jpl.imce.oml.specification.tests:generateTestXtext FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jpl.imce.oml.specification.tests:generateTestXtext'.
> Xtext validation failed, see build log for details.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jpl.imce.oml.specification.tests:generateTestXtext'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196)
        at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.GradleException: Xtext validation failed, see build log for details.
        at org.xtext.gradle.builder.XtextGradleBuilder.build(XtextGradleBuilder.java:210)
        at org.xtext.gradle.tasks.XtextGenerate.generate(XtextGenerate.java:149)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
        ... 73 more


BUILD FAILED

Re: Problems with AbstractFormatter2 when building with gradle [message #1754538 is a reply to message #1754536] Sun, 19 February 2017 20:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
maybe eclipse and gradle come it other in the way. sounds similar to https://github.com/xtext/xtext-gradle-plugin/issues/72
unfortunately your setup seems to be highly customized. thus having a smaller reproducible example would be nice.

i get a

gov.nasa.jpl.imce.oml.specification.scala.generators.OMLSpecificationTablesGeneratorTest > testGenerate FAILED
java.lang.NoClassDefFoundError at OMLSpecificationTablesGeneratorTest.java:35
Caused by: java.lang.ClassNotFoundException at OMLSpecificationTablesGeneratorTest.java:35

1 test completed, 1 failed
:gov.nasa.jpl.imce.oml.specification.scala.generators:test FAILED

only


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754541 is a reply to message #1754538] Mon, 20 February 2017 02:34 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Following your suggestion, I made a simplified example with just the Xcore metamodel, the Xtext grammar and some unit tests.
See this branch: https://github.com/JPL-IMCE/jpl.imce.oml.specification.parent/tree/xtext2.11.basic

I removed all generated files including Eclipse metadata.
To build, start:

./scripts/travis-build.sh

This should succeed; however, it is lacking generating the ecore metamodel from the Xcore source.
I haven't figured out how to do this from gradle.
Re: Problems with AbstractFormatter2 when building with gradle [message #1754543 is a reply to message #1754541] Mon, 20 February 2017 04:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
This should be doable with the Xtext gradle plugin
(Register xcorestandalonesetup as Language )


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754544 is a reply to message #1754543] Mon, 20 February 2017 04:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
(for that a issue on the xtext-gradle-plugin would be a better place to discuss)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754545 is a reply to message #1754544] Mon, 20 February 2017 04:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
besides this java.srcDirs = ['src', 'build/src-gen']

but you generate to src-gen. => stuff does not get found

so i am wondering why you did not take the gradle stuff generated by the wizard as start


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754548 is a reply to message #1754545] Mon, 20 February 2017 06:41 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Building Eclipse plugins/features & publishing has been a problem for many years for me because I really don't grok Maven pom.

I am accustomed to working with Scala & SBT; which is really nice because there is a lot of compile-time checking that helps understand what's going on.
Gradle is somewhat similar to SBT in the way it operates except that it lacks the compile time checking and adds a lot of dependency injection.
I find this a lot more difficult to understand.

Regarding the gradle wizard: yes, I had tried the wizard; however, I also needed to publish a P2 repo built from features & plugins.
All the examples I searched for were using tycho/pom. The closest I found was Eclipse Buildship itself -- it's bizarre that the project
isn't going to publish reusable scripts. So I copied & adapted their scripts -- Not very easy to do because there is really poor support for editing these kinds of scripts in Eclipse.

Now, I managed to simplify even more my project here:
https://github.com/JPL-IMCE/oml.core

I kept the essential -- i.e., all the Xcore, Xtend, Xtext stuff.
The problem now is that in order to use the Xtext 2.11-based grammar access formatter; I need to build the enchilada using gradle.
And that's where the problems begin.

It seems that I'm missing something that would "compile" the source Xcore file to generate several artifacts; including an ecore file.
I'm surprised that the ecore file is needed because it's not even generated in the itemis example here:
https://github.com/itemis/itemis-blog/tree/xcore_gradle

I kept my example as close as that one except that I use Xtext 2.11 and that I use EMF/CDO.


Re: Problems with AbstractFormatter2 when building with gradle [message #1754549 is a reply to message #1754548] Mon, 20 February 2017 06:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
sorry i still dont get any of you problems but different ones

:oml.model:compileJava
/data/tmp/oml.core/oml.model/build/xcore/main/gov/nasa/jpl/oml/OML2OTIProvenance.java:21: error: package org.eclipse.emf.cdo does not exist
import org.eclipse.emf.cdo.CDOObject;
^


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754550 is a reply to message #1754549] Mon, 20 February 2017 07:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
and i dont get your point:

the xcore file a a ecore+genmodel i n one.
using xtext-gradle-plugin should work fine generating code (the strange warnings you can get rid of with bundleManifest="false" to the @GenModel - you have to maintian plugin.xml and manifest manually.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754601 is a reply to message #1754550] Mon, 20 February 2017 18:24 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Thanks for the tip; I updated the genmodel annotations following the itemis-blog example for xcore-gradle-build and added repository & dependencies for cdo.

Now, I can build; however, there are strange errors that do not break the build (see the abbreviated stack traces below)
Is this normal?

./gradlew :oml.model:build 2>&1 | grep -v 'at \(org.gradle\|java.\|com.google\|sun\|org.eclipse.xtext\|org.xtext\)'
:oml.model:generateXtextjava.io.IOException: The path '/oml.model/plugin.properties' is unmapped
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:501)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:349)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.createOutputStream(AbstractGeneratorAdapter.java:2388)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenModelGeneratorAdapterFactory$2.createOutputStream(XcoreGenModelGeneratorAdapterFactory.java:170)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateProperties(AbstractGeneratorAdapter.java:1758)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter.generateModelPluginProperties(GenModelGeneratorAdapter.java:257)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter.generateModel(GenModelGeneratorAdapter.java:153)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:215)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:317)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:708)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:619)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.generateGenModel(XcoreGenerator.java:280)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.doGenerate(XcoreGenerator.java:228)
java.io.IOException: The path '/oml.model/build.properties' is unmapped
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:501)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:349)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.createOutputStream(AbstractGeneratorAdapter.java:2388)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenModelGeneratorAdapterFactory$2.createOutputStream(XcoreGenModelGeneratorAdapterFactory.java:170)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateText(AbstractGeneratorAdapter.java:737)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter.generateModelBuildProperties(GenModelGeneratorAdapter.java:279)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter.generateModel(GenModelGeneratorAdapter.java:154)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:215)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:317)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:708)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:619)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.generateGenModel(XcoreGenerator.java:280)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.doGenerate(XcoreGenerator.java:228)
java.io.IOException: The path '/oml.model/plugin.xml' is unmapped
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:501)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:349)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.createOutputStream(AbstractGeneratorAdapter.java:2388)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenModelGeneratorAdapterFactory$2.createOutputStream(XcoreGenModelGeneratorAdapterFactory.java:170)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateText(AbstractGeneratorAdapter.java:737)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter.generateModelManifest(GenModelGeneratorAdapter.java:211)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapter.generateModel(GenModelGeneratorAdapter.java:155)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:215)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:317)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:708)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:619)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.generateGenModel(XcoreGenerator.java:280)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.doGenerate(XcoreGenerator.java:228)
java.io.IOException: The path '/oml.model/build/xcore/main/gov/nasa/jpl/oml/impl/oml.ecore' is unmapped
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:501)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:349)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfChangedWithMemoryBuffer(ResourceImpl.java:1234)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:985)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter.generatePackageSerialization(GenPackageGeneratorAdapter.java:544)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter.generateModel(GenPackageGeneratorAdapter.java:213)
	at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:215)
	at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:317)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:708)
	at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:619)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.generateGenModel(XcoreGenerator.java:280)
	at org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.doGenerate(XcoreGenerator.java:228)

:oml.model:compileJava
:oml.model:processResources
:oml.model:classes
:oml.model:jar
:oml.model:assemble
:oml.model:generateTestXtext UP-TO-DATE
:oml.model:compileTestJava UP-TO-DATE
:oml.model:processTestResources UP-TO-DATE
:oml.model:testClasses UP-TO-DATE
:oml.model:test UP-TO-DATE
:oml.model:check UP-TO-DATE
:oml.model:build

BUILD SUCCESSFUL



Re: Problems with AbstractFormatter2 when building with gradle [message #1754603 is a reply to message #1754601] Mon, 20 February 2017 18:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
sounds like a question for the emf forum. (its pure xcore specific)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754611 is a reply to message #1754603] Tue, 21 February 2017 04:29 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
I carefully compared my project with https://github.com/itemis/itemis-blog/tree/xcore_gradle
Even simplified mine to be as close as possible to the itemis example.

Ultimately, I found that there is a difference in the *.xcore source that causes a difference in the beheavior of the gradle generateXtext task.

In the itemis example, the xcore is simple and the generated source impl folder does *NOT* have an *.ecore file.

In my case, the xcore is more complicated and when building with the Eclipse IDE, the generated source impl folder contains an *.ecore file.
The problem is that, currently, the xtext gradle builder does not have a way to specify some kind of EMF ResourceSet Pathmap so that it could properly save the generated *.ecore file -- when it has created one.

As far as why the Xcore builder generates an *.ecore file in some complex cases but not in simple ones; I haven't figured out exactly why.
I made some tests by commenting/uncommenting some sections; re-running the gradle generateXtext task to see if it produces errors or not.
It is unclear what really causes this difference in behavior.

It's worth asking on the EMF forum about the Xcore generator specifically.
If it is necessary for the XcoreGenerator to produce an *.ecore file for my metamodel; then the problem remains that there seems to be something missing w.r.t. being able to specify some kind of EMF ResourceSet pathmap in gradle.
Re: Problems with AbstractFormatter2 when building with gradle [message #1754612 is a reply to message #1754611] Tue, 21 February 2017 04:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
It would be nice to have a possibility to specify the path maps in gradle and maybe the xtext maven plugin
I am not sure where to address this issue

- at emf (where xcore resides)
- at xtext-gradle-plugin


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with AbstractFormatter2 when building with gradle [message #1754614 is a reply to message #1754611] Tue, 21 February 2017 04:57 Go to previous message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 40
Registered: December 2014
Member
Follow-up with questions on the EMF forum: https://www.eclipse.org/forums/index.php/m/1754613/#msg_1754613
Previous Topic:[SOLVED] Cannot cross reference element composed of multiple IDs
Next Topic:How use Xtext grammar DSL writing in editor for translating to another language ?
Goto Forum:
  


Current Time: Tue Apr 16 23:38:23 GMT 2024

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

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

Back to the top