Community
Participate
Working Groups
I have a code generator on UML2 on my project. It's pom file is the following : <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2011, Cedric Brun <cedric.brun@obeo.fr> --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.obeonetwork.dsl.uml</groupId> <artifactId>uml-parent</artifactId> <version>0.9.0-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <artifactId>org.obeonetwork.dsl.uml2.design.gen</artifactId> <packaging>eclipse-plugin</packaging> <name>Viewpoint Based Modeler Generator</name> <repositories> <repository> <id>acceleo</id> <layout>p2</layout> <url>http://download.eclipse.org/modeling/m2t/acceleo/updates/milestones/3.1</url> </repository> </repositories> <build> <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 --> <resources> <resource> <directory>src</directory> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <executions> <execution> <phase>compile</phase> <goals> <goal>java</goal> </goals> <configuration> <!-- Calls the AcceleoMainCompiler to launch the compilation. --> <mainClass>org.eclipse.acceleo.parser.compiler.AcceleoMainCompiler</mainClass> <arguments> <argument>${basedir}/src/org/obeonetwork/dsl/uml2/design/gen/main/</argument> <argument>${basedir}/target/classes</argument> <argument></argument> <argument>true</argument> </arguments> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.sonatype.tycho</groupId> <artifactId>maven-osgi-source-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> </plugin> </plugins> </build> </project> I'm using the p2 resolution to get all the dependencies for the Acceleo compilation cycle. I had to add a few requirements in my Manifest.MF to force the resolution (If I could add those in the pom.xml and not in the manifest it would be nice ^^) : org.eclipse.uml2.uml, org.eclipse.acceleo.parser, org.eclipse.acceleo.common, org.eclipse.acceleo.profiler The build is failing with a : [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default)l [ERROR] 2:The metamodel couldn't be resolved [ERROR] 5:Invalid Type: Model [ERROR] 8:Unrecognized variable: (name) [ERROR] 8:Unrecognized variable: (name) [ERROR] -> [Help 1] Looks like the parser is not able to register the required EMF Package (here UMLPackage). I'm quite sure I don't even have a workaround here :/
You have to add dependency to your metamodel in maven deps (for example org.eclipse.uml2.ecore), then edit your acceleocompiler class and set NSUri of the model (don't forget to add @generated NOT in the package). I did an ant task used with the antrun plugin plus system eclipse dependencies to do the job (eclipse and acceleo libraries are not in the eclipse repo yet). Regards, Charlie
(In reply to comment #1) > You have to add dependency to your metamodel in maven deps (for example > org.eclipse.uml2.ecore), then edit your acceleocompiler class and set NSUri of > the model (don't forget to add @generated NOT in the method comments). I did an ant > task used with the antrun plugin plus system eclipse dependencies to do the job > (eclipse and acceleo libraries are not in the eclipse repo yet). > > Regards, Charlie
I'll close this issue since Cedric's problem has already resolved. You can find an example of the solution here: https://github.com/ObeoNetwork/UML-Java-Generation