|
|
|
Re: Maven build with ant task ecore2Java [message #977174 is a reply to message #976769] |
Fri, 09 November 2012 04:40 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Artem,
Comments below.
On 08/11/2012 9:59 PM, Artem G. wrote:
> Hi Ed,
>
> thanks for your reply. I figured out how can I do it properly with
> maven. Hier is my maven task:
>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-maven-plugin</artifactId>
> <extensions>true</extensions>
> </plugin>
> <plugin>
> <groupId>org.eclipse.tycho.extras</groupId>
> <artifactId>tycho-eclipserun-plugin</artifactId>
> <version>0.16.0</version>
> <configuration>
> <appArgLine>-application
> org.eclipse.ant.core.antRunner -nosplash -buildfile
> build.xml</appArgLine>
> <dependencies>
> <dependency>
> <artifactId>org.eclipse.ant.core</artifactId>
> <type>eclipse-plugin</type>
> </dependency>
> <dependency>
> <artifactId>org.eclipse.emf.ant</artifactId>
> <type>eclipse-plugin</type>
> </dependency>
> <dependency>
> <artifactId>org.eclipse.emf.importer.ecore</artifactId>
> <type>eclipse-plugin</type>
> </dependency>
> </dependencies>
> </configuration>
> <executions>
> <execution>
> <goals>
> <goal>eclipse-run</goal>
> </goals>
> <phase>compile</phase>
> </execution>
> </executions>
> </plugin>
>
>
> But now I have a next problem. I have an eclipse project:
>
> org.example.project
> |-plugin.xml
> |-META-INF
> |-model
> |-myEcore.ecore
>
> and if I generate a genmodel from ecore and generate model java code
> from this genmodel(it has /org.example.project/model-gen as "Model
> Directory" property) over Eclipse UI it place model code right in
> model-gen directory and don't create plugin.xml etc in this model-gen
> directory, looks like it take org.example.projects' plugin.xml etc.
Yes, it generally won't generate one once it exists though in the latest
builds I've added support for merging of plugin.xml and MANIFEST.MF....
> So but if place build.xml in org.example.project like this:
> code]
> org.example.project
> |-build.xml
> |-plugin.xml
> |-META-INF
> |-model
> |-myEcore.ecore
> [/code]
> with build.xml:
>
> <emf.Ecore2Java
> model="${antfile.dir}/model/@{modelName}.ecore"
> genModel="${antfile.dir}/model/@{modelName}.genmodel"
> modelProject="${antfile.dir}"
> modelProjectFragmentPath="model-gen"
> modelPluginID="${modelPlugin.ID}"
> generateJavaCode="true"
> generateModelProject="false"
> generateEditProject="false"
> generateEditorProject="false"
> validateModel="true"
> copyright="This is my code."
> jdkLevel="${genJDKLevel}">
> <settings/>
> </emf.Ecore2Java>
>
> and run, it gives me an error: The project description file
> (.project) for 'org.example.project' is missing. This file contains
> important information about the project. The project will not
> function properly until this file is restored.
>
> If I change modelProject path like this:
>
> <emf.Ecore2Java
> model="${antfile.dir}/model/@{modelName}.ecore"
> genModel="${antfile.dir}/model/@{modelName}.genmodel"
> modelProject="${antfile.dir}/org.genetty.gendsl"
> modelProjectFragmentPath="model-gen"
> modelPluginID="${modelPlugin.ID}"
> generateJavaCode="true"
> generateModelProject="false"
> generateEditProject="false"
> generateEditorProject="false"
> validateModel="true"
> copyright="This is my code."
> jdkLevel="${genJDKLevel}">
> <settings/>
> </emf.Ecore2Java>
>
> it generate all model code with new plugin.xml etc in
> org.example.project directory inside org.example.project:
>
> org.example.project
> |-build.xml
> |-plugin.xml
> |-META-INF
> |-model
> |-myEcore.ecore
> |-model-gen
> |-org.example.project
> |-plugin.xml
> |-META-INF
> |-model-gen
> |-MyEcore.java
> ....
>
>
> How can I set the modelProject path to generate model code in
> model-gen and use existing plugin.xml?
It seems to me there was some trick to let it know where the project
starts. Oh yes, hunting around I find
org.eclipse.emf.codegen.ecore.Generator.EclipseHelper.findOrCreateContainerHelper(String,
String, Monitor) where adding a "/./" in the path to indicate where the
project actually starts on the path. I also see that -projects would
help (point at the folder in which the , but I'm not sure how you
specify that in Ant.
public void printGenerateUsage()
{
System.out.println("Usage arguments:");
System.out.println(" [-projects <project-root-directory>]");
System.out.println(" [-dynamicTemplates] [-forceOverwrite | -diff]");
System.out.println(" [-generateSchema] [-nonNLSMarkers]");
System.out.println(" [-codeFormatting { default | <profile-file> }
]");
System.out.println(" [-model] [-edit] [-editor] [-tests]");
System.out.println(" [-autoBuild <true|false>]");
System.out.println(" [-reconcile]");
System.out.println(" <genmodel-file>");
System.out.println(" [ <target-root-directory> ]");
System.out.println("");
System.out.println("For example:");
System.out.println("");
System.out.println(" generate result/model/Extended.genmodel");
}
Can you run under debug control to see how best to take advantage of
these "tricks"?
>
> Thank you very much for your previous message!
> Artem.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03778 seconds