Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using Ecore2Java ant task
Using Ecore2Java ant task [message #426927] Mon, 26 January 2009 15:26 Go to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Hi,

I am trying to use the Ecore2Java ant task to generate the
model,edit,editor projects programmatically.

I have written the following Ant script:

<project name="C Generation" default="all" basedir=".">

<property name="model.file"
value="./bt.com.cpemss.plugin/model/fin.ecore"/>
<property name="genmodel.file"
value="./bt.com.cpemss.plugin/model/fin.genmodel"/>

<taskdef name="emfGen"
classname="org.eclipse.emf.importer.ecore.taskdefs.EcoreGeneratorTask "/>

<target name="genJava">
<echo message="java generation from ecore model"/>
<emf.Ecore2Java model="${model.file}"
genModel="${genmodel.file}"
modelProject="bt.com.cpemss.plugin"
reconcileGenModel="keep"
generateJavaCode="true"
generateModelProject="true"
generateEditProject="true"
generateEditorProject="true"
modelPluginID="bt.com.cpemss.plugin"
modelProjectFragmentPath="src">
</emf.Ecore2Java>
</target>

<target name="all" depends="genJava">
</target>

</project>

The exception message I am getting when running it from eclipse is the
following:


Buildfile:
D:\Borland\Together\2007\eclipse\workspace\bt.com.cpemss.plu gin\build.xml

genJava:
[echo] java generation from ecore model

BUILD FAILED
D:\Borland\Together\2007\eclipse\workspace\bt.com.cpemss.plu gin\build.xml:19:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
java.net.MalformedURLException: unknown protocol: d

Total time: 297 milliseconds


I have searched the newsgroup and google up to find what is that message
but no luck. Is there anyone that can help on this?

Thanks,

Achilleas
Re: Using Ecore2Java ant task [message #426928 is a reply to message #426927] Mon, 26 January 2009 15:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Achilleas,

I don't see where this is coming from by the symptom tells me that
somewhere you've specified a file system path "d:/..." where a URI is
required "file:/d:/..."...


Achilleas wrote:
> Hi,
>
> I am trying to use the Ecore2Java ant task to generate the
> model,edit,editor projects programmatically.
>
> I have written the following Ant script:
>
> <project name="C Generation" default="all" basedir=".">
>
> <property name="model.file"
> value="./bt.com.cpemss.plugin/model/fin.ecore"/>
> <property name="genmodel.file"
> value="./bt.com.cpemss.plugin/model/fin.genmodel"/>
>
> <taskdef name="emfGen"
> classname="org.eclipse.emf.importer.ecore.taskdefs.EcoreGeneratorTask "/>
>
> <target name="genJava">
> <echo message="java generation from ecore model"/>
> <emf.Ecore2Java model="${model.file}"
> genModel="${genmodel.file}"
> modelProject="bt.com.cpemss.plugin"
> reconcileGenModel="keep"
> generateJavaCode="true"
> generateModelProject="true"
> generateEditProject="true"
> generateEditorProject="true"
> modelPluginID="bt.com.cpemss.plugin"
> modelProjectFragmentPath="src">
> </emf.Ecore2Java>
> </target>
>
> <target name="all" depends="genJava">
> </target>
>
> </project>
>
> The exception message I am getting when running it from eclipse is the
> following:
>
>
> Buildfile:
> D:\Borland\Together\2007\eclipse\workspace\bt.com.cpemss.plu gin\build.xml
>
> genJava:
> [echo] java generation from ecore model
>
> BUILD FAILED
> D:\Borland\Together\2007\eclipse\workspace\bt.com.cpemss.plu gin\build.xml:19:
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> java.net.MalformedURLException: unknown protocol: d
>
> Total time: 297 milliseconds
>
>
> I have searched the newsgroup and google up to find what is that
> message but no luck. Is there anyone that can help on this?
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using Ecore2Java ant task [message #426929 is a reply to message #426928] Mon, 26 January 2009 16:37 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Thanks Ed for your reply.

I cannot understand where this occurs since I did not define manually
anywhere the argument "d:/..." instead of "file://d:/....."!

Could this be part of the lanuch configuration parameters in eclipse? It
is the first time I am using ant so I don't know.

I will try to invoke the ant task outside eclipse to see what happens. Any
other suggestions will be appreciated??

Thanks,

Achilleas
Re: Using Ecore2Java ant task [message #426931 is a reply to message #426929] Mon, 26 January 2009 16:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030407030609050808000805
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Achilleas,

My Ant skills are really non-existent. If I were to guess, I'd say that
relative paths like this get resolved to a file system path by Ant
rather than to a URI.

./bt.com.cpemss.plugin/model/fin.ecore

So it's likely that using
"platform:/resource/bt.com.cpemss.plugin/model/fin.ecore" would work
better...


Achilleas wrote:
> Thanks Ed for your reply.
>
> I cannot understand where this occurs since I did not define manually
> anywhere the argument "d:/..." instead of "file://d:/....."!
>
> Could this be part of the lanuch configuration parameters in eclipse?
> It is the first time I am using ant so I don't know.
>
> I will try to invoke the ant task outside eclipse to see what happens.
> Any other suggestions will be appreciated??
>
> Thanks,
>
> Achilleas
>

--------------030407030609050808000805
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Achilleas,<br>
<br>
My Ant skills are really non-existent.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using Ecore2Java ant task [message #426954 is a reply to message #426931] Mon, 26 January 2009 17:13 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Thanks Ed,

I have tried that already through some scripts I have discovered but still
i get the same exception.

I hope someone else might be able to help; i will keep searching and
trying:)

Thanks,

Achilleas
Re: Using Ecore2Java ant task [message #426962 is a reply to message #426954] Tue, 27 January 2009 10:48 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Hi again,

Are there any other views of what could be the problem? I am kind of lost
here guys and I am thinking of writing Java code directly to generate the
model,edit and editor code.

Any recommendations are appreciated!

Thanks,

Achilleas
Re: Using Ecore2Java ant task [message #426965 is a reply to message #426962] Tue, 27 January 2009 11:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Achilleas,

Marcelo is more likely to have some idea of what's going on, since he
did all the ant tasks. Hopefully he'll shed some light on your issue
today...


Achilleas wrote:
> Hi again,
>
> Are there any other views of what could be the problem? I am kind of
> lost here guys and I am thinking of writing Java code directly to
> generate the model,edit and editor code.
>
> Any recommendations are appreciated!
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using Ecore2Java ant task [message #426968 is a reply to message #426965] Tue, 27 January 2009 11:41 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Ed,

Thanks for pointing to me that the relative paths are the cause of this. I
was following the documentation of the EcoreGenerator class that assigns
the complete path to the ecore and genmodel files.

Instead I replaced the originally assigned path
"./bt.com.cpemss.plugin/model/fin.ecore" to "./model/fin.ecore" and this
resolved the problem.

I have included the following ant task that works perfectly now just in
case someone requires something similar.

<project name="Ecore2Java Generation" default="GenerateJava" basedir=".">

<property name="model" value="./model/fin.ecore"/>
<property name="genmodel" value="./model/fin.genmodel"/>

<taskdef name="emfGen"
classname="org.eclipse.emf.importer.ecore.taskdefs.EcoreGeneratorTask "/>

<target name="GenerateJava">
<echo message="Generate the model,edit and editor Java code from the
ecore model"/>
<emf.Ecore2Java model="${model}"
genModel="${genmodel}"
modelProject="bt.com.cpemss.plugin"
reconcileGenModel="keep"
generateJavaCode="true"
generateModelProject="true"
generateEditProject="true"
generateEditorProject="true"
modelProjectFragmentPath="src">
</emf.Ecore2Java>
</target>
</project>

Thanks,

Achilleas
Re: Using Ecore2Java ant task [message #665042 is a reply to message #426927] Wed, 13 April 2011 03:02 Go to previous message
Daniel Ford is currently offline Daniel FordFriend
Messages: 148
Registered: July 2009
Location: New York
Senior Member
Having just run into exactly the same problem, but not really seeing the
solution here, I worked through an existing working example and was able
to duplicate the problem on the working example. It seems that if you
have a typo in the name of the ecore file (such that it can't be found,
I suspect) then you'll get the "MalformedURLException" with the
mysterious message "unknown protocol : d" (or "c" in my case).

I suspect Achilleas corrected the name, but didn't realize that that was
the problem.

Dan

On 1/26/2009 10:26 AM, Achilleas wrote:
> Hi,
>
> I am trying to use the Ecore2Java ant task to generate the
> model,edit,editor projects programmatically.
>
> I have written the following Ant script:
>
> <project name="C Generation" default="all" basedir=".">
>
> <property name="model.file"
> value="./bt.com.cpemss.plugin/model/fin.ecore"/>
> <property name="genmodel.file"
> value="./bt.com.cpemss.plugin/model/fin.genmodel"/>
>
> <taskdef name="emfGen"
> classname="org.eclipse.emf.importer.ecore.taskdefs.EcoreGeneratorTask "/>
>
> <target name="genJava">
> <echo message="java generation from ecore model"/>
> <emf.Ecore2Java model="${model.file}"
> genModel="${genmodel.file}"
> modelProject="bt.com.cpemss.plugin"
> reconcileGenModel="keep"
> generateJavaCode="true"
> generateModelProject="true"
> generateEditProject="true"
> generateEditorProject="true"
> modelPluginID="bt.com.cpemss.plugin"
> modelProjectFragmentPath="src">
> </emf.Ecore2Java>
> </target>
>
> <target name="all" depends="genJava">
> </target>
>
> </project>
>
> The exception message I am getting when running it from eclipse is the
> following:
>
>
> Buildfile:
> D:\Borland\Together\2007\eclipse\workspace\bt.com.cpemss.plu gin\build.xml
>
> genJava:
> [echo] java generation from ecore model
>
> BUILD FAILED
> D:\Borland\Together\2007\eclipse\workspace\bt.com.cpemss.plu gin\build.xml:19:
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> java.net.MalformedURLException: unknown protocol: d
>
> Total time: 297 milliseconds
>
>
> I have searched the newsgroup and google up to find what is that message
> but no luck. Is there anyone that can help on this?
>
> Thanks,
>
> Achilleas
>
Previous Topic:[CDO] OCL query and deleted objects
Next Topic:[Teneo] CNF on LogFactory
Goto Forum:
  


Current Time: Thu Apr 25 10:40:45 GMT 2024

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

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

Back to the top