MavenThirdPartyDevelopers

From Java CoG Kit

Jump to: navigation, search

Contents

Using the Maven Repository as a third-party Developer

This page describes how third party developers also using the Maven platform can utilize the Java CoG Kit. Developers using Maven do not need to download the dependencies by hand. Instead, they specify the CoG Kit dependency in their own pom.xml, and Maven takes care of the rest.

As the CoG Kit is broken down into modules, a third-party developer need only specify the modules he or she needs in the pom.xml. For a summary of these modules see this page.

Prerequisites

You must have a working version of Java 1.5 and Maven 2.0 to use this project.

Download Our Sample Project

One of the easier ways to get going is to download our sample Maven project. Everything is set up and you can worry about changing the group and artifact ids later. Please consult the README in the project for more information.

The project is available for download here.

Create Your Own Project from Scratch

Much of this is drawn from the Maven Getting Started Guide so it would be beneficial to read that as well.

Use the Maven archetype plugin to create a blank sample project as follows (change the groupId and artifactId as you so desire):

 mvn archetype:create -DgroupId=org.cogkit -DartifactId=sample-app

The following directory structure will be create:

my-app
|-- pom.xml
 -- src
    |-- main
    |    -- java
    |        -- com
    |            -- mycompany
    |                -- app
    |                    -- App.java
    |-- test
         -- java
             -- com
                 -- mycompany
                     -- app
                         -- AppTest.java

Modify the default pom.xml and add the Java CoG Kit Maven Repository to your list of repositories. When complete your pom.xml should look similar to the following:

 <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.cogkit</groupId>
   <artifactId>sample-app</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>Maven Quick Start Archetype</name>
   <url>http://maven.apache.org</url>
   <repositories>
     <repository>
       <id>www.cogkit.org</id>
       <name>CoGKit Repository</name>
       <url>http://www.cogkit.org/maven/repository</url>
       <layout>default</layout>
     </repository>
   </repositories>
   <dependencies>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
 </project>

Now add the dependencies to the same pom.xml file. All the available dependencies are listed below, but you may pick and choose. Currently only snapshot versions (which are in active development) are available, but this will soon change.

   <dependencies>
      
       ...
 
     <dependency>
       <groupId>org.cogkit</groupId>
       <artifactId>util</artifactId>
       <version>5.0-SNAPSHOT</version>        
     </dependency>
     <dependency>
       <groupId>org.cogkit</groupId>
       <artifactId>cogkit-core</artifactId>
       <version>5.0-SNAPSHOT</version>        
     </dependency>
     <dependency>
       <groupId>org.cogkit</groupId>
       <artifactId>karajan</artifactId>
       <version>5.0-SNAPSHOT</version>        
     </dependency>
     <dependency>
       <groupId>org.cogkit</groupId>
       <artifactId>karajan-viewer</artifactId>
       <version>5.0-SNAPSHOT</version>        
     </dependency>
     <dependency>
       <groupId>org.cogkit</groupId>
       <artifactId>qstat</artifactId>
       <version>5.0-SNAPSHOT</version>        
     </dependency>
     <dependency>
       <groupId>org.cogkit</groupId>
       <artifactId>ui</artifactId>
       <version>5.0-SNAPSHOT</version>        
     </dependency>
 
       ...
 
   </dependencies>

After your pom.xml file is properly set up, you may add your code to the src/main/resources/java directory. Please refer to the Maven documentation for more information on compiling, packaging and deploying your code.

Personal tools
Collaboration and Jobs