Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore2Java ant task
Ecore2Java ant task [message #430913] Wed, 17 June 2009 13:21 Go to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Hi there,

I am generating the model,edit, editor source code using the following EMF
ant task that I have defined:

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

<property name="model" value="./model/product.ecore"/>
<property name="genmodel" value="./model/product.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}"
reconcileGenModel="reload"
generateJavaCode="true"
generateModelProject="true"
generateEditProject="true"
generateEditorProject="true"
modelProject="bt.com.ccm.product"
modelProjectFragmentPath="src">
<arg line="-editProject bt.com.ccm.product.edit src"/>
<arg line="-editorProject bt.com.ccm.product.editor src"/>
</emf.Ecore2Java>
</target>

</project>

The problem is that for the model project generated is not an EMF project
and subsequently does not include the necessary EMF plug-in dependencies.
These results in errors since EMF specific classes cannot be resolved.

Actually the output messages displayed onto the console when running the
task indicate that for the edit and editor projects the ant tasks creates
first an EMF project prior to generating the code; while for the model
project this does not occur.

Does anyone has any idea about this problem?

Thanks,

Achilleas
Re: Ecore2Java ant task [message #430914 is a reply to message #430913] Wed, 17 June 2009 13:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Achilleas,

Are you generating into an existing folder, perhaps one that even
contains a plugin.xml already, that's not been properly set up?


Achilleas wrote:
> Hi there,
>
> I am generating the model,edit, editor source code using the following
> EMF ant task that I have defined:
>
> <project name="Ecore2Java Generation" default="GenerateJava" basedir=".">
>
> <property name="model" value="./model/product.ecore"/>
> <property name="genmodel" value="./model/product.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}"
> reconcileGenModel="reload"
> generateJavaCode="true"
> generateModelProject="true"
> generateEditProject="true"
> generateEditorProject="true"
> modelProject="bt.com.ccm.product"
> modelProjectFragmentPath="src">
> <arg line="-editProject bt.com.ccm.product.edit src"/>
> <arg line="-editorProject bt.com.ccm.product.editor src"/>
> </emf.Ecore2Java>
> </target>
>
> </project>
>
> The problem is that for the model project generated is not an EMF
> project and subsequently does not include the necessary EMF plug-in
> dependencies. These results in errors since EMF specific classes
> cannot be resolved.
>
> Actually the output messages displayed onto the console when running
> the task indicate that for the edit and editor projects the ant tasks
> creates first an EMF project prior to generating the code; while for
> the model project this does not occur.
>
> Does anyone has any idea about this problem?
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore2Java ant task [message #430915 is a reply to message #430914] Wed, 17 June 2009 14:08 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Hi Ed,

No I am not generating into an existing folder. The projects do not exist
in the Eclipse workspace. They are created when I invoke the ant task
generation.

But for the model project only the JRE dependencies are included in the
project. No plug-in dependencies and therefore I get the erros in the
generated code.

\Any ideas?

Thanks,

Achilleas
Re: Ecore2Java ant task [message #430916 is a reply to message #430915] Wed, 17 June 2009 14:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Achilleas,

By guess would be that the folder actually exists already. Maybe not in
the workspace, but in the underlying file system, so that when the
project is created in the workspace, there's already old stuff in it.


Achilleas wrote:
> Hi Ed,
>
> No I am not generating into an existing folder. The projects do not
> exist in the Eclipse workspace. They are created when I invoke the ant
> task generation.
>
> But for the model project only the JRE dependencies are included in
> the project. No plug-in dependencies and therefore I get the erros in
> the generated code.
>
> \Any ideas?
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore2Java ant task [message #431201 is a reply to message #430916] Thu, 02 July 2009 13:11 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Hi Ed,

I have back to this issue after undertaking some other work and I still
have the same problem.

The project and the folder do not exist neither in the workspace or the
underlying system.

Do you have any other suggestions? DOes anyone have any other suggestions?

Thanks,

Achilleas
Re: Ecore2Java ant task [message #431202 is a reply to message #431201] Thu, 02 July 2009 13:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Achilleas,

Are a plugin.xml and a MANIFEST.MF being generated? What do they look like?


Achilleas wrote:
> Hi Ed,
>
> I have back to this issue after undertaking some other work and I
> still have the same problem.
>
> The project and the folder do not exist neither in the workspace or
> the underlying system.
>
> Do you have any other suggestions? DOes anyone have any other
> suggestions?
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore2Java ant task [message #431205 is a reply to message #431202] Thu, 02 July 2009 13:45 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Ed,

This is the plugin.xml generated for the model project:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>

<!--
<copyright>
</copyright>

$Id$
-->

<plugin>

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.com.bt/2009/product"
class="product.ProductPackage"/>
</extension>

</plugin>


This is the MANIFEST.MF for the model project:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: bt.com.ccm.product;singleton:=true
Bundle-Version: 1.0.0
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: product,
product.impl,
product.util
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport
Bundle-ActivationPolicy: lazy

As soon as the model, edit and editor projects are generated and the
errors appear, I configure the build path of the model project adding
merely the "org.eclipse.emf.ecore_2.4.0........." plug-in dependency and
all the errors dissapear and the plug-ins work just fine!

It seems very strange and I have run the ant task so many times but still
the same problem!

Thanks,

Achilleas
Re: Ecore2Java ant task [message #431206 is a reply to message #431205] Thu, 02 July 2009 14:05 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Achilleas,

Comments below.

Achilleas wrote:
> Ed,
>
> This is the plugin.xml generated for the model project:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?eclipse version="3.0"?>
>
> <!--
> <copyright>
> </copyright>
>
> $Id$
> -->
>
> <plugin>
>
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri="http://www.com.bt/2009/product"
> class="product.ProductPackage"/>
> </extension>
>
> </plugin>
>
>
> This is the MANIFEST.MF for the model project:
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: %pluginName
> Bundle-SymbolicName: bt.com.ccm.product;singleton:=true
> Bundle-Version: 1.0.0
> Bundle-ClassPath: .
> Bundle-Vendor: %providerName
> Bundle-Localization: plugin
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> Export-Package: product,
> product.impl,
> product.util
> Require-Bundle: org.eclipse.core.runtime,
> org.eclipse.emf.ecore;visibility:=reexport
So the dependency to get it to compile is there and should work.
> Bundle-ActivationPolicy: lazy
>
> As soon as the model, edit and editor projects are generated and the
> errors appear, I configure the build path of the model project adding
> merely the "org.eclipse.emf.ecore_2.4.0........." plug-in dependency
> and all the errors dissapear and the plug-ins work just fine!
But that dependency is already there. It sounds like perhaps the
..classpath file is not being updated, but that should happen
automatically... What if you just invoke PDE Tools->Update
classpath...? Does that do the trick too?
>
> It seems very strange and I have run the ant task so many times but
> still the same problem!
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore2Java ant task [message #431208 is a reply to message #431206] Thu, 02 July 2009 14:36 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Ed,

Yeah, you are right! That does the trick too!

I am running the ant task from another project and I just noticed that it
generates two projects (actually the one is a copy of the other).

The one is created in the project that contains the ant task and one in
the workspace as normal. If I delete one of the two the other gets deleted
also-very strange for me:)..it seems they are interlinked somehow!

Even if I create an EMF project myself with the appropriate name and run
the ant task from that project it creates other problems. The model
project MANIFEST.MF has an error that I need to resolve; set the
'singleton' directive. And the edit and editor projects errors are because
of access restrictions of the model project that I need to resolve.

Is there a specific way to invoke the ant script? I am including the ant
script..maybe I have something wrong in the script. Honestly don't know:)


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

<property name="model" value="./src/model/product.ecore"/>
<property name="genmodel" value="./src/model/product.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}"
reconcileGenModel="reload"
generateJavaCode="true"
generateModelProject="true"
generateEditProject="true"
generateEditorProject="true"
modelProject="bt.com.ccm.product"
modelProjectFragmentPath="src">
<arg line="-editProject bt.com.ccm.product.edit src"/>
<arg line="-editorProject bt.com.ccm.product.editor src"/>
</emf.Ecore2Java>
</target>

</project>


Thanks,

Achilleas
Re: Ecore2Java ant task [message #431209 is a reply to message #431208] Thu, 02 July 2009 14:38 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
These are the initial outputs on the console when generating the model,
edit and editor projects respectively.

[emf.Ecore2Java] >> Generating code
[emf.Ecore2Java] >> Generating packages
[emf.Ecore2Java] >> Generating model plugin.properties
[emf.Ecore2Java] >> Generating file /bt.com.ccm.product/plugin.properties
[emf.Ecore2Java] >> Opening folder /bt.com.ccm.product
[emf.Ecore2Java] >> Generating model build.properties
[emf.Ecore2Java] >> Generating model plugin.properties
[emf.Ecore2Java] >> Generating file /bt.com.ccm.product/build.properties
[emf.Ecore2Java] >> Opening folder /bt.com.ccm.product
[emf.Ecore2Java] >> Generating model META-INF/MANIFEST.MF
[emf.Ecore2Java] >> Generating file
/bt.com.ccm.product/META-INF/MANIFEST.MF
[emf.Ecore2Java] >> Opening folder /bt.com.ccm.product/META-INF
[emf.Ecore2Java] >> Updating duplicate resource:
'/bt.com.ccm.generation.plugin/bt.com.ccm.product/META-INF'.
[emf.Ecore2Java] >> Generating model plugin.xml
[emf.Ecore2Java] >> Generating file /bt.com.ccm.product/plugin.xml
[emf.Ecore2Java] >> Opening folder /bt.com.ccm.product

[emf.Ecore2Java] >> Generating code
[emf.Ecore2Java] >> Generating edit packages
[emf.Ecore2Java] >> Creating EMF project bt.com.ccm.product.edit
(bt.com.ccm.product.edit)
[emf.Ecore2Java] >> Opening 'bt.com.ccm.product.edit'.
[emf.Ecore2Java] >> Refreshing '/bt.com.ccm.product.edit'.

[emf.Ecore2Java] >> Generating code
[emf.Ecore2Java] >> Generating editor packages
[emf.Ecore2Java] >> Creating EMF project bt.com.ccm.product.editor
(bt.com.ccm.product.editor)
[emf.Ecore2Java] >> Opening 'bt.com.ccm.product.editor'.
[emf.Ecore2Java] >> Refreshing '/bt.com.ccm.product.editor'.

Thanks Ed!
Re: Ecore2Java ant task [message #431211 is a reply to message #431209] Thu, 02 July 2009 14:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Achilleas,

Unfortunately I know next to nothing about Ant. :-(

If the *.genmodel already exists, be sure that the properties for where
to generate the results are set properly there in the first place.


Achilleas wrote:
>
> These are the initial outputs on the console when generating the
> model, edit and editor projects respectively.
>
> [emf.Ecore2Java] >> Generating code
> [emf.Ecore2Java] >> Generating packages
> [emf.Ecore2Java] >> Generating model plugin.properties
> [emf.Ecore2Java] >> Generating file
> /bt.com.ccm.product/plugin.properties
> [emf.Ecore2Java] >> Opening folder /bt.com.ccm.product
> [emf.Ecore2Java] >> Generating model build.properties
> [emf.Ecore2Java] >> Generating model plugin.properties
> [emf.Ecore2Java] >> Generating file /bt.com.ccm.product/build.properties
> [emf.Ecore2Java] >> Opening folder /bt.com.ccm.product
> [emf.Ecore2Java] >> Generating model META-INF/MANIFEST.MF
> [emf.Ecore2Java] >> Generating file
> /bt.com.ccm.product/META-INF/MANIFEST.MF
> [emf.Ecore2Java] >> Opening folder /bt.com.ccm.product/META-INF
> [emf.Ecore2Java] >> Updating duplicate resource:
> '/bt.com.ccm.generation.plugin/bt.com.ccm.product/META-INF'.
> [emf.Ecore2Java] >> Generating model plugin.xml
> [emf.Ecore2Java] >> Generating file /bt.com.ccm.product/plugin.xml
> [emf.Ecore2Java] >> Opening folder /bt.com.ccm.product
>
> [emf.Ecore2Java] >> Generating code
> [emf.Ecore2Java] >> Generating edit packages
> [emf.Ecore2Java] >> Creating EMF project bt.com.ccm.product.edit
> (bt.com.ccm.product.edit)
> [emf.Ecore2Java] >> Opening 'bt.com.ccm.product.edit'.
> [emf.Ecore2Java] >> Refreshing '/bt.com.ccm.product.edit'.
>
> [emf.Ecore2Java] >> Generating code
> [emf.Ecore2Java] >> Generating editor packages
> [emf.Ecore2Java] >> Creating EMF project bt.com.ccm.product.editor
> (bt.com.ccm.product.editor)
> [emf.Ecore2Java] >> Opening 'bt.com.ccm.product.editor'.
> [emf.Ecore2Java] >> Refreshing '/bt.com.ccm.product.editor'.
>
> Thanks Ed!
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore2Java ant task [message #431212 is a reply to message #431211] Thu, 02 July 2009 14:59 Go to previous messageGo to next message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Ed it seems that this was actually the problem! I regenerated the EMF
model and deleted the ecore elements to leave only the configuration
information and now the projects are generated just fine!

Maybe there was an error in the previous genmodel i generated.

When I run the EMF ant task is there the option to create the genmodel;
i.e. if I have only the ecore file?

Do you have any idea where should I start for generating the GMF diagram
code now?

Thanks,

Achilleas
Re: Ecore2Java ant task [message #431214 is a reply to message #431212] Thu, 02 July 2009 15:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Achilleas,

I think it creates the GenModel if it doesn't already exist... I don't
know about GMF ant tasks...


Achilleas wrote:
>
> Ed it seems that this was actually the problem! I regenerated the EMF
> model and deleted the ecore elements to leave only the configuration
> information and now the projects are generated just fine!
>
> Maybe there was an error in the previous genmodel i generated.
>
> When I run the EMF ant task is there the option to create the
> genmodel; i.e. if I have only the ecore file?
>
> Do you have any idea where should I start for generating the GMF
> diagram code now?
>
> Thanks,
>
> Achilleas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore2Java ant task [message #431218 is a reply to message #431214] Thu, 02 July 2009 15:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aurelien.pupier.esial.net

>>
>> Do you have any idea where should I start for generating the GMF
>> diagram code now?

Hi,

it doesn't exist yet as EMF.

there is multiple entries discussing about that in the gmf newsgroup that you can look.
Re: Ecore2Java ant task [message #431230 is a reply to message #431218] Fri, 03 July 2009 14:09 Go to previous message
Achilleas is currently offline AchilleasFriend
Messages: 88
Registered: July 2009
Member
Hi,

I know that an ant task does not exist. I am trying to implement it! Just
see the new post I made in the GMF newsgroup.

Achilleas
Previous Topic:"Cannot complete the request."
Next Topic:[CDO+Hibernate] ClassCastException: org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl canno
Goto Forum:
  


Current Time: Thu Apr 25 17:14:19 GMT 2024

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

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

Back to the top