Difference between revisions of "Acceleo/Maven"

From Eclipsepedia

Jump to: navigation, search
m (Stand Alone)
(Maven Tycho build)
Line 116: Line 116:
  
 
Launch this with the following command: mvn clean org.eclipse.acceleo:maven:3.2.1:acceleo-compile compile verify
 
Launch this with the following command: mvn clean org.eclipse.acceleo:maven:3.2.1:acceleo-compile compile verify
 +
 +
The following build only manages the compilation of an UML generator that is using another UML plugin as a dependency, for the support of features and update site have a look at Eclipse Minerva.
 +
 +
The regular header of a Tycho based build.
 +
  <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/xsd/maven-4.0.0.xsd">
 +
   
 +
    <modelVersion>4.0.0</modelVersion>
 +
 +
The configuration of the plugin (the artifactId must match the name of the plugin).
 +
    <groupId>org.eclipse.acceleo</groupId>
 +
    <artifactId>org.eclipse.acceleo.maven.plugin.tests</artifactId>
 +
    <version>1.0.0.qualifier</version>
 +
    <packaging>eclipse-plugin</packaging>
 +
 +
The properties of the build
 +
 +
    <properties>
 +
      <tycho-version>0.14.1</tycho-version>
 +
    </properties>
 +
   
 +
    <profiles>
 +
      <profile>
 +
        <id>platform-indigo</id>
 +
        <activation>
 +
          <activeByDefault>true</activeByDefault>
 +
          <property>
 +
            <name>platform-version-name</name>
 +
            <value>indigo</value>
 +
          </property>
 +
        </activation>
 +
        <properties>
 +
          <uml-to-java-site>http://marketplace.obeonetwork.com/updates/od5/</uml-to-java-site>
 +
          <eclipse-site>http://download.eclipse.org/releases/indigo</eclipse-site>
 +
          <platform-version>[3.7,3.8)</platform-version>
 +
        </properties>
 +
      </profile>
 +
    </profiles>
 +
 +
Where to find the dependencies.
 +
    <repositories>
 +
      <repository>
 +
        <id>eclipse-platform</id>
 +
        <layout>p2</layout>
 +
        <url>${eclipse-site}</url>
 +
      </repository>
 +
      <repository>
 +
        <id>uml-to-java</id>
 +
        <layout>p2</layout>
 +
        <url>${uml-to-java-site}</url>
 +
      </repository>
 +
      <repository>
 +
        <id>Indigo Release</id>
 +
        <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/indigo</url>
 +
      </repository>
 +
      <repository>
 +
        <id>Juno Release</id>
 +
        <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/juno</url>
 +
      </repository>
 +
      <repository>
 +
        <id>Snapshots</id>
 +
        <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/snapshots</url>
 +
      </repository>
 +
    </repositories>
 +
 +
Where to find the maven plugin used during the build.
 +
    <pluginRepositories>
 +
      <pluginRepository>
 +
        <id>codehaus.snapshots</id>
 +
        <url>http://snapshots.repository.codehaus.org/</url>
 +
      </pluginRepository>
 +
      <pluginRepository>
 +
        <id>Indigo Release</id>
 +
        <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/indigo</url>
 +
      </pluginRepository>
 +
      <pluginRepository>
 +
        <id>Juno Release</id>
 +
        <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/juno</url>
 +
      </pluginRepository>
 +
      <pluginRepository>
 +
        <id>Snapshots</id>
 +
        <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/snapshots</url>
 +
      </pluginRepository>
 +
    </pluginRepositories>
 +
 +
The dependencies used.
 +
    <dependencies>
 +
      <dependency>
 +
        <groupId>org.eclipse.acceleo</groupId>
 +
        <artifactId>maven</artifactId>
 +
        <version>3.2.1</version>
 +
      </dependency>
 +
      <dependency>
 +
        <groupId>org.eclipse.uml2</groupId>
 +
        <artifactId>uml</artifactId>
 +
        <version>3.2.1</version>
 +
      </dependency>
 +
      <dependency>
 +
        <groupId>org.eclipse.uml2</groupId>
 +
        <artifactId>common</artifactId>
 +
        <version>1.6.0</version>
 +
      </dependency>
 +
      <dependency>
 +
        <groupId>org.slf4j</groupId>
 +
        <artifactId>slf4j-simple</artifactId>
 +
        <version>1.6.4</version>
 +
      </dependency>
 +
    </dependencies>
 +
 +
The configuration of the build.
 +
    <build>
 +
      <plugins>
 +
        <plugin>
 +
          <groupId>org.eclipse.tycho</groupId>
 +
          <artifactId>tycho-maven-plugin</artifactId>
 +
          <version>${tycho-version}</version>
 +
          <extensions>true</extensions>
 +
        </plugin>
 +
        <plugin>
 +
          <groupId>org.eclipse.tycho</groupId>
 +
          <artifactId>target-platform-configuration</artifactId>
 +
          <version>${tycho-version}</version>
 +
          <configuration>
 +
            <resolver>p2</resolver>
 +
            <pomDependencies>consider</pomDependencies>
 +
          </configuration>
 +
        </plugin>
 +
        <plugin>
 +
          <groupId>org.eclipse.acceleo</groupId>
 +
          <artifactId>maven</artifactId>
 +
          <version>3.2.1</version>
 +
          <executions>
 +
            <execution>
 +
              <phase>compile</phase>
 +
            </execution>
 +
          </executions>
 +
          <configuration>
 +
            <useBinaryResources>false</useBinaryResources>
 +
            <usePlatformResourcePath>true</usePlatformResourcePath>
 +
            <acceleoProject>
 +
              <root>${project.basedir}</root>
 +
              <entries>
 +
                <entry>
 +
                  <input>src/main/java</input>
 +
                  <output>target/classes</output>
 +
                </entry>
 +
              </entries>
 +
              <jars>
 +
                <jar>p2.eclipse-plugin:org.obeonetwork.pim.uml2.gen.java</jar>
 +
              </jars>
 +
            </acceleoProject>
 +
            <packagesToRegister>
 +
              <packageToRegister>org.eclipse.uml2.uml.UMLPackage</packageToRegister>
 +
            </packagesToRegister>
 +
            <uriHandler>org.eclipse.acceleo.maven.AcceleoURIHandler</uriHandler>
 +
          </configuration>
 +
        </plugin>
 +
      </plugins>
 +
      <pluginManagement>
 +
        <plugins>
 +
          <plugin>
 +
            <groupId>org.eclipse.tycho</groupId>
 +
            <artifactId>tycho-compiler-plugin</artifactId>
 +
            <version>${tycho-version}</version>
 +
            <configuration>
 +
              <encoding>UTF-8</encoding>
 +
            </configuration>
 +
          </plugin>
 +
          <plugin>
 +
            <!-- TODO remove workaround when https://issues.sonatype.org/browse/TYCHO-473 is fixed -->
 +
            <groupId>org.eclipse.tycho</groupId>
 +
            <artifactId>tycho-source-plugin</artifactId>
 +
            <version>${tycho-version}</version>
 +
            <executions>
 +
              <execution>
 +
                <id>attach-source</id>
 +
                <phase>process-classes</phase>
 +
                <goals>
 +
                  <goal>plugin-source</goal>
 +
                </goals>
 +
              </execution>
 +
            </executions>
 +
          </plugin>
 +
          <plugin>
 +
            <groupId>org.apache.maven.plugins</groupId>
 +
            <artifactId>maven-resources-plugin</artifactId>
 +
            <version>2.4.1</version>
 +
            <configuration>
 +
              <encoding>ISO-8859-1</encoding>
 +
            </configuration>
 +
          </plugin>
 +
          <plugin>
 +
            <groupId>org.apache.maven.plugins</groupId>
 +
            <artifactId>maven-antrun-plugin</artifactId>
 +
            <version>1.3</version>
 +
          </plugin>
 +
        </plugins>
 +
      </pluginManagement>
 +
    </build>
 +
  </project>

Revision as of 09:38, 8 June 2012

Maven Integration

Stand Alone

Launch this with the following command: mvn clean org.eclipse.acceleo:maven:3.2.1:acceleo-compile compile verify

The header of a regular maven pom.xml file.

 <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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

The information of the project to build.

   <groupId>org.eclipse.acceleo</groupId>
   <artifactId>maven-test</artifactId>
   <version>3.2.1</version>
   <packaging>jar</packaging>
   <name>org.eclipse.acceleo.maven.tests</name>
   <description>The Acceleo maven tests plugin.</description>    

The repositories to use for the dependencies of this project (ex: org.eclipse.uml2.uml).

   <repositories>
     <repository>
       <id>Indigo Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/indigo</url>
     </repository>
     <repository>
       <id>Juno Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/juno</url>
     </repository>
     <repository>
       <id>Snapshots</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/snapshots</url>
     </repository>
   </repositories>

The repositories where the plugin used during the build will be found (ex: org.eclipse.acceleo.maven).

   <pluginRepositories>
     <pluginRepository>
       <id>Indigo Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/indigo</url>
     </pluginRepository>
     <pluginRepository>
       <id>Juno Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/juno</url>
     </pluginRepository>
     <pluginRepository>
       <id>Snapshots</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/snapshots</url>
     </pluginRepository>
   </pluginRepositories>

The dependencies used to build. Here, the Acceleo maven plugin, the two plugins needed for the UML meta-model and log4j.

   <dependencies>
     <dependency>
       <groupId>org.eclipse.acceleo</groupId>
       <artifactId>maven</artifactId>
       <version>3.2.1</version>
     </dependency>
     <dependency>
       <groupId>org.eclipse.uml2</groupId>
       <artifactId>uml</artifactId>
       <version>3.2.1</version>
     </dependency>
     <dependency>
       <groupId>org.eclipse.uml2</groupId>
       <artifactId>common</artifactId>
       <version>1.6.0</version>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
       <version>1.6.4</version>
     </dependency>
   </dependencies>

The configuration of the Acceleo build.

   <build>
     <plugins>
       <plugin>
         <groupId>org.eclipse.acceleo</groupId>
         <artifactId>maven</artifactId>
         <version>3.2.1</version>
         <executions>
           <execution>
             <phase>compile</phase>
           </execution>
         </executions>
         <configuration>
           <useBinaryResources>false</useBinaryResources>
           <usePlatformResourcePath>true</usePlatformResourcePath>
           <acceleoProject>
             <root>${project.basedir}</root>
             <entries>
               <entry>
                 <input>src/main/java</input>
                 <output>target/classes</output>
               </entry>
             </entries>
           </acceleoProject>
           <packagesToRegister>
             <packageToRegister>org.eclipse.uml2.uml.UMLPackage</packageToRegister>
           </packagesToRegister>
         </configuration>
       </plugin>
     </plugins>
   </build>
 </project>

Maven Tycho build

Launch this with the following command: mvn clean org.eclipse.acceleo:maven:3.2.1:acceleo-compile compile verify

The following build only manages the compilation of an UML generator that is using another UML plugin as a dependency, for the support of features and update site have a look at Eclipse Minerva.

The regular header of a Tycho based build.

 <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/xsd/maven-4.0.0.xsd">
   
   <modelVersion>4.0.0</modelVersion>

The configuration of the plugin (the artifactId must match the name of the plugin).

   <groupId>org.eclipse.acceleo</groupId>
   <artifactId>org.eclipse.acceleo.maven.plugin.tests</artifactId>
   <version>1.0.0.qualifier</version>
   <packaging>eclipse-plugin</packaging>

The properties of the build

   <properties>
     <tycho-version>0.14.1</tycho-version>
   </properties>
   
   <profiles>
     <profile>
       <id>platform-indigo</id>
       <activation>
         <activeByDefault>true</activeByDefault>
         <property>
           <name>platform-version-name</name>
           <value>indigo</value>
         </property>
       </activation>
       <properties>
         <uml-to-java-site>http://marketplace.obeonetwork.com/updates/od5/</uml-to-java-site>
         <eclipse-site>http://download.eclipse.org/releases/indigo</eclipse-site>
         <platform-version>[3.7,3.8)</platform-version>
       </properties>
     </profile>
   </profiles>

Where to find the dependencies.

   <repositories>
     <repository>
       <id>eclipse-platform</id>
       <layout>p2</layout>
       <url>${eclipse-site}</url>
     </repository>
     <repository>
       <id>uml-to-java</id>
       <layout>p2</layout>
       <url>${uml-to-java-site}</url>
     </repository>
     <repository>
       <id>Indigo Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/indigo</url>
     </repository>
     <repository>
       <id>Juno Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/juno</url>
     </repository>
     <repository>
       <id>Snapshots</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/snapshots</url>
     </repository>
   </repositories>

Where to find the maven plugin used during the build.

   <pluginRepositories>
     <pluginRepository>
       <id>codehaus.snapshots</id>
       <url>http://snapshots.repository.codehaus.org/</url>
     </pluginRepository>
     <pluginRepository>
       <id>Indigo Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/indigo</url>
     </pluginRepository>
     <pluginRepository>
       <id>Juno Release</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/releases/juno</url>
     </pluginRepository>
     <pluginRepository>
       <id>Snapshots</id>
       <url>https://raw.github.com/eclipse/acceleo/master/maven/repository/snapshots</url>
     </pluginRepository>
   </pluginRepositories>

The dependencies used.

   <dependencies>
     <dependency>
       <groupId>org.eclipse.acceleo</groupId>
       <artifactId>maven</artifactId>
       <version>3.2.1</version>
     </dependency>
     <dependency>
       <groupId>org.eclipse.uml2</groupId>
       <artifactId>uml</artifactId>
       <version>3.2.1</version>
     </dependency>
     <dependency>
       <groupId>org.eclipse.uml2</groupId>
       <artifactId>common</artifactId>
       <version>1.6.0</version>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
       <version>1.6.4</version>
     </dependency>
   </dependencies>

The configuration of the build.

   <build>
     <plugins>
       <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>tycho-maven-plugin</artifactId>
         <version>${tycho-version}</version>
         <extensions>true</extensions>
       </plugin>
       <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>target-platform-configuration</artifactId>
         <version>${tycho-version}</version>
         <configuration>
           <resolver>p2</resolver>
           <pomDependencies>consider</pomDependencies>
         </configuration>
       </plugin>
       <plugin>
         <groupId>org.eclipse.acceleo</groupId>
         <artifactId>maven</artifactId>
         <version>3.2.1</version>
         <executions>
           <execution>
             <phase>compile</phase>
           </execution>
         </executions>
         <configuration>
           <useBinaryResources>false</useBinaryResources>
           <usePlatformResourcePath>true</usePlatformResourcePath>
           <acceleoProject>
             <root>${project.basedir}</root>
             <entries>
               <entry>
                 <input>src/main/java</input>
                 <output>target/classes</output>
               </entry>
             </entries>
             <jars>
               <jar>p2.eclipse-plugin:org.obeonetwork.pim.uml2.gen.java</jar>
             </jars>
           </acceleoProject>
           <packagesToRegister>
             <packageToRegister>org.eclipse.uml2.uml.UMLPackage</packageToRegister>
           </packagesToRegister>
           <uriHandler>org.eclipse.acceleo.maven.AcceleoURIHandler</uriHandler>
         </configuration>
       </plugin>
     </plugins>
     <pluginManagement>
       <plugins>
         <plugin>
           <groupId>org.eclipse.tycho</groupId>
           <artifactId>tycho-compiler-plugin</artifactId>
           <version>${tycho-version}</version>
           <configuration>
             <encoding>UTF-8</encoding>
           </configuration>
         </plugin>
         <plugin>
           <groupId>org.eclipse.tycho</groupId>
           <artifactId>tycho-source-plugin</artifactId>
           <version>${tycho-version}</version>
           <executions>
             <execution>
               <id>attach-source</id>
               <phase>process-classes</phase>
               <goals>
                 <goal>plugin-source</goal>
               </goals>
             </execution>
           </executions>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-resources-plugin</artifactId>
           <version>2.4.1</version>
           <configuration>
             <encoding>ISO-8859-1</encoding>
           </configuration>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-antrun-plugin</artifactId>
           <version>1.3</version>
         </plugin>
       </plugins>
     </pluginManagement>
   </build>
 </project>