[ggl2-users] How to create a ggl Maven project "from scratch"?

  • From: Thomas LEDUC <thomas.leduc@xxxxxxxxxxxxxx>
  • To: ggl2-users@xxxxxxxxxxxxx
  • Date: Thu, 20 Dec 2012 15:58:12 +0100

Dear GGL2 developers & users,

I would like to compile and pack a set of Java classes (and JAR
dependencies) and ggl script into a single JAR file with dependencies.
I'm used to use the Maven project management tool.

My aim is to deliver some devs (based on both ggl scripts and native
java developments) into a single external JAR file that can enrich the
Java build path of any new ggl project.

To that purpose, I've tried to adapt the pom.xml file of my Maven
project. unfortunately, the below content does not seem to be suitable.
Could you please tell me how to do? I would like to write a simple
tutorial entitled "How to produce your own GGL plugin using Maven and
the binaries of the 1M6 release".

Thanks once again for your help.

Thomas

PS: the pom.xml I've tested in vain

<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>
   <groupId>org.t4ggl</groupId>
   <artifactId>t4ggl</artifactId>
   <packaging>jar</packaging>
   <version>0.0.1</version>
   <name>t4ggl</name>
   <url>http://maven.apache.org</url>

   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <installDir>target/lib</installDir>
   </properties>

   <repositories>
      <repository>
         <id>org.gearscape.ggl</id>
         <name>GGL Repository</name>
         <url>http://www.fergonco.es/maven-repo</url>
      </repository>
   </repositories>

   <dependencies>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>3.8.1</version>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>com.vividsolutions</groupId>
         <artifactId>jts</artifactId>
         <version>1.12</version>
      </dependency>
      <dependency>
         <groupId>jfree</groupId>
         <artifactId>jfreechart</artifactId>
         <version>1.0.13</version>
      </dependency>
      <dependency>
         <groupId>jfree</groupId>
         <artifactId>jcommon</artifactId>
         <version>1.0.16</version>
      </dependency>

      <dependency>
         <groupId>org.gearscape.ggl</groupId>
         <artifactId>runtime</artifactId>
         <version>1.0.1</version>
      </dependency>

      <dependency>
         <groupId>com.ximpleware</groupId>
         <artifactId>vtd-xml</artifactId>
         <version>2.10</version>
      </dependency>
      <dependency>
         <groupId>org.apache.xmlbeans</groupId>
         <artifactId>xmlbeans</artifactId>
         <version>2.4.0</version>
      </dependency>
      <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
         <version>2.0.1</version>
      </dependency>
      <dependency>
         <groupId>joda-time</groupId>
         <artifactId>joda-time</artifactId>
         <version>2.0</version>
      </dependency>
   </dependencies>

   <build>
      <resources> 
         <resource> 
            <directory>src-ggl</directory> 
         </resource>
      </resources>
      <plugins>
         <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.8</version>
            <configuration>
               <classpathContainers>

<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER
                  </classpathContainer>
                  <classpathContainer>org.gearscape.ggl.GGL_CONTAINER
                  </classpathContainer>
               </classpathContainers>
               <additionalProjectnatures>
                  <projectnature>org.eclipse.xtext.ui.shared.xtextNature
                  </projectnature>
               </additionalProjectnatures>
               <buildcommands>
                  <buildcommand>org.eclipse.xtext.ui.shared.xtextBuilder
                  </buildcommand>

<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
               </buildcommands>
               <sourceIncludes>
                  <sourceInclude>**/*.ggl</sourceInclude>
                  <sourceInclude>**/log4j.properties</sourceInclude>
               </sourceIncludes>
            </configuration>
         </plugin>
         <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
               <execution>
                  <phase>install</phase>
                  <goals>
                     <goal>copy</goal>
                     <goal>copy-dependencies</goal>
                  </goals>
                  <configuration>
                     <artifactItems>
                        <artifactItem>
                           <groupId>${project.groupId}</groupId>

<artifactId>${project.artifactId}</artifactId>
                           <version>${project.version}</version>
                           <type>${project.packaging}</type>
                        </artifactItem>
                     </artifactItems>
                     <outputDirectory>${installDir}</outputDirectory>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
               <execution>
                  <phase>generate-sources</phase>
                  <goals>
                     <goal>add-source</goal>
                  </goals>
                  <configuration>
                     <sources>
                        <source>src-ggl</source>
                        <source>src-gen</source>
                     </sources>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <configuration>
               <descriptorRefs>
                  <descriptorRef>jar-with-dependencies</descriptorRef>
               </descriptorRefs>
            </configuration>
            <executions>
               <execution>
                  <id>make-assembly</id> <!-- this is used for
inheritance merges -->
                  <phase>package</phase> <!-- bind to the packaging
phase -->
                  <goals>
                     <goal>single</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>

-- 
Thomas LEDUC

UMR CNRS/MCC 1563 - Laboratoire CERMA
Tel : +33 (0) 240 597 599 ---  Fax : +33 (0) 240 591 177
ensa Nantes - 6, quai F. Mitterrand - BP 16202 - F-44262 NANTES cedex 2


Other related posts: