Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Unable to execute MWE2Runner with maven
Unable to execute MWE2Runner with maven [message #1783672] Thu, 15 March 2018 12:46 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 46
Registered: December 2014
Member
Hello,

i created a simple Workflow:

module workflow
 
Workflow {
     
    component = test.test.MetaModelGenerator2 {
        fileName = "src/main/resources/aspect-meta-model-shapes.ttl"
        
    }
     
}
     


public class MetaModelGenerator2 extends AbstractWorkflowComponent {

	private String fileName;

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	@Override
	public void checkConfiguration(Issues issues) {
		if (fileName == null) {
			throw new IllegalArgumentException("A filename have to be declared");
		}

	}

	@Override
	protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
		System.out.println("Hello World" + fileName);

	}

}


Error
1    [org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main()] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - [XtextLinkingDiagnostic: null:9 Couldn't resolve reference to JvmType 'test.test.MetaModelGenerator2'., XtextLinkingDiagnostic: null:10 Couldn't resolve reference to JvmIdentifiableElement 'fileName'.]
java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:9 Couldn't resolve reference to JvmType 'test.test.MetaModelGenerator2'., XtextLinkingDiagnostic: null:10 Couldn't resolve reference to JvmIdentifiableElement 'fileName'.]
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:88)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
	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.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
	at java.lang.Thread.run(Thread.java:748)


I added all dependencies from a xtext example project pom.
Does anyone know my mistake?

[Updated on: Thu, 15 March 2018 12:47]

Report message to a moderator

Re: Unable to execute MWE2Runner with maven [message #1783677 is a reply to message #1783672] Thu, 15 March 2018 13:19 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

One possibility: "module workflow" is very dangerous since MWE2 will lookup "workflow" in its index and might execute something different if there is another "workflow", perhaps resulting from your debugging struggles. Use a fully qualified distinctive name.

Regards

Ed Willink
Re: Unable to execute MWE2Runner with maven [message #1783679 is a reply to message #1783677] Thu, 15 March 2018 13:29 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 612
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Very likely problem: You have your MetaModelGenerator2 class in the same project as the workflow. Since the MetaModelGenerator2 class must be compiled and on the classpath before executing your workflow, it has to be in a separate Maven module that has been built before.
Re: Unable to execute MWE2Runner with maven [message #1783688 is a reply to message #1783677] Thu, 15 March 2018 14:23 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 46
Registered: December 2014
Member
Ed Willink wrote on Thu, 15 March 2018 13:19
Hi

One possibility: "module workflow" is very dangerous since MWE2 will lookup "workflow" in its index and might execute something different if there is another "workflow", perhaps resulting from your debugging struggles. Use a fully qualified distinctive name.

Regards

Ed Willink


Okay i will try that.

Karsten Thoms wrote on Thu, 15 March 2018 13:29
Very likely problem: You have your MetaModelGenerator2 class in the same project as the workflow. Since the MetaModelGenerator2 class must be compiled and on the classpath before executing your workflow, it has to be in a separate Maven module that has been built before.


Mhm ok, good to know.
Re: Unable to execute MWE2Runner with maven [message #1783689 is a reply to message #1783688] Thu, 15 March 2018 14:36 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 612
Registered: July 2009
Location: Dortmund, Germany
Senior Member

That's a standard Maven lifecycle issue :)
Re: Unable to execute MWE2Runner with maven [message #1783691 is a reply to message #1783689] Thu, 15 March 2018 14:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Sorry, the problem I alluded to was https://bugs.eclipse.org/bugs/show_bug.cgi?id=356663 and was fixed 8 years ago so even with Karsten's observation that Maven copying creates a duplicate it should not matter. However I only use MWE2 from MWE2 launches and so I don't experience the confusingly inconsistent classpaths that Maven/Tycho facilitate.

My workflows always start with something like

Workflow {
bean = ResourceSetImpl : libResourceSet {}
bean = StandaloneSetup { resourceSet = libResourceSet
platformUri = "../../plugins"
// scanClassPath = true
}

with platformUri and scanClassPath needing to be compatible with the prevailing working directory. I suspect that you should use at least StandaloneSetup and carefully instrument the different behaviours from MWE2 launch and Maven to get them consistent.

Regards

Ed Willink
Re: Unable to execute MWE2Runner with maven [message #1783712 is a reply to message #1783691] Fri, 16 March 2018 08:04 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 46
Registered: December 2014
Member
With two different projects it works fine :)
Previous Topic:Cross reference, Qualified name and scoping
Next Topic:Using IContextualOutputConfigurationProvider
Goto Forum:
  


Current Time: Fri Sep 21 02:48:04 GMT 2018

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

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

Back to the top