Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [MWE2] Referring to paths/files inside standalone JAR
[MWE2] Referring to paths/files inside standalone JAR [message #651492] Mon, 31 January 2011 12:21 Go to next message
Loek Cleophas is currently offline Loek CleophasFriend
Messages: 3
Registered: December 2010
Junior Member
Hi

I have an Xtext-based generator project org.xtext.mydsl.generator, that contains amongst others
- src/model/MyModel.mydsl;
- src/mydir/SomeFile.hpp
- src/workflows/myworkflow.mwe2;

The following is a relevant extract of that MWE2 workflow.

Workflow {

	component = org.eclipse.xtext.mwe.Reader {
                ...
		path = "src/model"
		register = org.xtext.example.mydsl.MyDSLStandaloneSetup {}
		load = {
                        ...
		}
	}

	<processing of and code generation using loaded model>

	component = org.eclipse.emf.mwe.utils.FileCopy {
		sourceFile = "src/mydir/SomeFile.hpp"
		targetFile = "src-gen/mydir/SomeFile.hpp"
	}

}


This works fine when running the MWE2 workflow inside Eclipse - e.g. it finds the model file and processes it, and it finds the source file to copy and copies it to the target location.

I have also created a "standalone launcher" Java class in the project, which calls Mwe2Launcher.main to launch the MWE2 workflow. That works fine from within Eclipse as well.

I've exported the project into a JAR, using the launcher class as the main class, and can run the standalone launcher class just fine from the terminal (using java -jar myjar.jar <params for standalone launcher class>).

However, when run that way (i.e. using java -jar), the MWE2 workflow interprets the paths in the workflow as paths on the local filesystem - whereas I want to refer to the files as included in the JAR. I know they are in the jar; using jar tf myjar.jar gives amongst others
model/MyModel.mydsl
mydir/SomeFile.hpp

How do I define path and sourceFile in my MWE2 workflow such that they refer to the files inside the JAR? Just using "model/MyModel.mydsl" and "mydir/SomeFile.hpp" obviously does not do the trick.

Any help is appreciated.

Regards,
Loek
Re: [MWE2] Referring to paths/files inside standalone JAR [message #651643 is a reply to message #651492] Tue, 01 February 2011 02:19 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Loek Cleophas wrote on Mon, 31 January 2011 07:21

However, when run that way (i.e. using java -jar), the MWE2 workflow interprets the paths in the workflow as paths on the local filesystem - whereas I want to refer to the files as included in the JAR. I know they are in the jar; using jar tf myjar.jar gives amongst others
model/MyModel.mydsl
mydir/SomeFile.hpp



Hi Loek,

I'm not sure, but I think this http://www.eclipse.org/forums/index.php?t=msg&th=202671& amp;start=0&S=df32efc44998e754519701ff5aade2a7 recent thread might be helpful.

-Miles
Re: [MWE2] Referring to paths/files inside standalone JAR [message #661593 is a reply to message #651643] Fri, 25 March 2011 14:11 Go to previous message
Loek Cleophas is currently offline Loek CleophasFriend
Messages: 3
Registered: December 2010
Junior Member
Hi

Miles - thanks for the suggestion, and apologies for the late thanks...

As a late followup, at least in case anyone else will run into this in the future: I have briefly looked at that bug, which has a latter long and intricate description. Our problem might indeed be related to this bug.
I have decided to take a different route for now, circumventing the issue: I've replaced the FileCopy actions in MWE2 by the use of Xpand templates to simply spit out the non-variable files.

Regards,
Loek
Previous Topic:Custom tag, SortImportStatments
Next Topic:M2T transformation for Android Applications
Goto Forum:
  


Current Time: Thu Apr 25 20:00:59 GMT 2024

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

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

Back to the top