Home » Modeling » EMF » Ecore2Java: differences with the GenModel context menu?
Ecore2Java: differences with the GenModel context menu? [message #479230] |
Mon, 10 August 2009 11:23 |
Eclipse User |
|
|
|
Originally posted by: nyoescape.gmail.com
Hello all,
I'm probably doing something wrong, but there appear to be some
differences between how the Ecore2Java Ant task and the "Generate X
Model" EMF context menu entries work. I'm not sure if they are
intentional or not. Let me list them:
- the paths in the "editProject", "editorProject" and "testProject"
arguments and the "modelproject" attribute seem to be relative paths
from the current directory, which I can't control, since I have to use
the same JRE as the IDE, due to other reasons.
If I try to use an absolute path to a subdirectory of the workspace, I
get an "overlapping path" error message to the effect of
"/home/user/workspace/MyModel.edit overlaps with the existing
MyModel.edit project" (which does not exist yet). To make it work, I
have to use something different, like
"/home/user/workspace/generated/MyModel.edit".
The generated .gemodel has the previous absolute paths in the
editDirectory, editorDirectory and testDirectory attributes. To
produce code using the "Generate X Model" context menu entries from
it, I have to change them to workspace paths, or they create
If possible, I'd like the Ant task to use workspace paths as well (but
this probably requires changes to the code), or avoid those
path overlap errors.
- even if I pass the -testProjects argument, the tests project is not
generated, as in the "Generate Tests Project" context menu entry.
- the edit and editor projects are correctly generated and appear in my
workspace, but they do not have the Java and PDE natures assigned to
them. Their .project files contain the bare minimum (name and empty
buildSpec and nature elements), and they don't have any .classpath
files. However, when generating them from the context menu, they work
just fine.
I'm using the Ecore2Java task like this:
<emf.Ecore2Java model="model/mymodel.ecore"
genmodel="model/mymodel.genmodel"
modelproject="${basedir}"
modelProjectFragmentPath="src" modelPluginID="MyModel">
<arg line="-editProject ${basedir}/../generated/MyModel.edit src" />
<arg line="-editorProject ${basedir}/../generated/MyModel.editor src" />
<arg line="-testsProject ${basedir}/../generated/MyModel.tests src" />
</emf.Ecore2Java>
Thanks in advance,
Antonio
|
|
| | |
Re: Ecore2Java: differences with the GenModel context menu? [message #479672 is a reply to message #479294] |
Tue, 11 August 2009 21:43 |
Eclipse User |
|
|
|
Originally posted by: nyoescape.gmail.com
Hi Marcelo,
> The EMF tasks are not designed to be used with the UI actions. Their
> goal is to provide the means to generate the artifacts in situations in
> which the Ui is not available. It is possible to change the code to
> provide this support. Feel free to open a feature request, remembering
> that this will be probably be a low priority at this moment.
Well, that's not quite what I meant. I just meant to say that some files
were being generated from one place and not from the other, that's all.
That is, the .project and .classpath files, mostly. I agree with the
current design.
> One very important constraint to run the EMF Ant tasks (or the EMF
> headless applications on which the tasks rely) is that they should not
> be generating artifacts in the workspace of the Eclipse that is running
> them. In other words, when running your scripts, make sure the -data
> option of your command line (or the workspace of the launcher) points to
> a different directory.
Yes, so it seems. Using anything other than a direct subdirectory of the
workspace works (for instance, (workspace)/generated/MyModel.edit works
just fine). Rather than a regular Run Configuration, I'm using an Ant
Builder, as I need it to be run from the same JRE as my Eclipse instance.
> Respecting the constraint above, I was able to generate the code that I
> believe you are looking for. One detail: the edit and editor projects
> are not added to the workspace in which your UI is running (remember
> that the Ant tasks are working on a different one).
With the "(workspace)/generated/MyModel.edit" caveat above, they are
actually added to my workspace, if I tell the Ant Builder to refresh my
entire workspace after it has run. Odd, but convenient.
> I will fix these as soon as possible. Would you mind opening one defect
> for each problem?
Well, it seems that you beat me to it :-). Thanks!
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286251
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286267
> I am attaching here a zip with the project that I used to generate code.
> I includes a launcher (Eclipse Ant Runner) that will run the Ant script
> that is selected in the navigator/explorer.
Works fine from here, except for the problems that you seem to have
fixed already. That was quick :-).
Thanks for the good work,
Antonio
|
|
|
Goto Forum:
Current Time: Sat Apr 20 04:29:31 GMT 2024
Powered by FUDForum. Page generated in 0.03181 seconds
|