My favorites | Sign in
Logo
                
Search
for
Updated Oct 28, 2009 by matt.senter
Labels: Phase-Support
MavenHowTo  
Tellurium Maven Guide.

Introduction

Tellurium has converted its project structure to use Maven. This document will explain the steps necessary to retrieve the Maven artifacts.

Prerequisites

You will need to be running Maven version 2.0.9, downloadable from http://maven.apache.org/download.html.

If you never installed Maven before, please follow the official Maven Installation Guide.

settings.xml

Here is a sample settings.xml that will allow you to automatically include Tellurium artifacts in your Maven project. This should go in your ~/.m2/settings.xml file:

<settings>
    <profiles>
        <profile>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                 <repository>  
                    <id>kungfuters-public-snapshots-repo</id>
                    <name>Kungfuters.org Public Snapshot Repository</name>
                    <releases>          
                        <enabled>false</enabled>
                    </releases>         
                    <snapshots>         
                        <enabled>true</enabled> 
                    </snapshots>        
                    <url>http://maven.kungfuters.org/content/repositories/snapshots</url>
                </repository>   
                <repository>    
                    <id>kungfuters-public-releases-repo</id>
                    <name>Kungfuters.org Public Releases Repository</name>
                    <releases>          
                        <enabled>true</enabled> 
                    </releases>         
                    <snapshots>         
                        <enabled>false</enabled>
                    </snapshots>        
                    <url>http://maven.kungfuters.org/content/repositories/releases</url>
                </repository>   
            </repositories>
        </profile>
    </profiles>
</settings>

Dependency

To include Tellurium as a dependency in your project, add the following to your pom.xml:

<dependencies>
    ...
    <dependency>
      <groupId>tellurium</groupId>
      <artifactId>tellurium-core</artifactId>
      <version>0.6.0</version>
      <scope>compile</scope>
    </dependency>
    ...
</dependencies>

Build Tellurium from Source

If you want to build Tellurium from source, you can check out the trunk code using subversion command,

svn checkout http://aost.googlecode.com/svn/trunk/ tellurium

or using mvn command,

mvn scm:checkout -DconnectionUrl=scm:svn:http://aost.googlecode.com/svn/trunk -DcheckoutDirectory=tellurium

Be aware that the Maven command calls the subversion client to do the job and you must have the client installed in your system.

If you want to build the whole project, just use

mvn clean install

and Maven will compile source code and resources, compile test code and test resources, run all tests, and then install all artifacts to your local repository under YOUR_HOME/.m2/repository.

Sometimes, tests may break and if you still want to proceed, please use the ignore flag

mvn clean install -Dmaven.test.failure.ignore=true

If you want to build an individual project, just go to that project directory and run the same command as above.

If you like to run the tests, use command

mvn test

The sub-projects under the tools directory include Tellurium Maven archetypes and trump code, you may not really want to build them by yourself. For trump, the artifacts include a .xpi file.

The assembly project just creates a set of tar files and you may not need to build it either.

Create a New Tellurium Test Project using Tellurium Maven Archetype

Tellurium provides two maven archetypes, i.e., tellurium-junit-archetype and tellurium-testng-archetype for Tellurium JUnit test project and Tellurium TestNG test project, respectively.

Run the following maven command to create a new JUnit project

mvn archetype:generate -DgroupId=your_group_id -DartifactId=your_artifact_id -DarchetypeArtifactId=tellurium-junit-archetype -DarchetypeGroupId=tellurium -DarchetypeVersion=0.6.0

Without adding the Tellurium Maven repository, you can specify it in the command line as

mvn archetype:generate -DgroupId=your_group_id -DartifactId=your_artifact_id -DarchetypeArtifactId=tellurium-junit-archetype -DarchetypeGroupId=tellurium -DarchetypeVersion=0.6.0 \
-DarchetypeRepository=http://maven.kungfuters.org/content/repositories/releases

For TestNG project, you should use a different archetype

mvn archetype:generate -DgroupId=your_group_id -DartifactId=your_artifact_id -DarchetypeArtifactId=tellurium-testng-archetype -DarchetypeGroupId=tellurium -DarchetypeVersion=0.6.0

If you want to see a detailed example on how to create a new Tellurium test project, you can read Ten Minutes to Tellurium

How to Create a Maven Archetype from an Existing Project

You can create a Maven archetype from scratch, for example, Tellurium Maven Archetypes are created in this way. But in some cases, your project may be pretty complicated and you want to create the Maven archetype from a template project. The guide on How to Create a Maven Archetype From an Existing Project walks you through all the steps to create a Maven Archetype from an existing project.

Build information

To find regular build information updates, see http://kungfuters.org/tellurium. There you will find information about the project as well as unit test and coverage reports.

Useful Maven Plugins and Commands

Maven Help Plugin

Maven Dependency Plugin

Maven Archetype Plugin

Maven IDE Configuration

Eclipse

Install Maven Plug-in

  1. Click the Add Site button.
  2. Enter the following URL: http://m2eclipse.sonatype.org/update/
  3. Click OK.
  4. Expand the Maven Integration for Eclipse Update Site node.
  5. Select the Maven Integration check box.
  6. Click the Install button and follow the wizard.
  7. Restart Eclipse.

Configure Maven Plug-in

  1. Click Window | Preferences.
  2. Expand the Maven node.
  3. Select the Installations node.
  4. Click the Add button.
  5. Navigate the the Maven 2.0.9 installation folder.
  6. Click OK.
  7. Click the check box next to the new Maven installation.

Import Projects

  1. Click File | Import.
  2. Type Maven in the filter text field.
  3. Under the General node, select the Maven Projects node.
  4. Click Next.
  5. Click the Browse button and navigate to the ide-settings folder.
  6. Click OK.
  7. Click Finish.

Netbeans

Install Maven Plugin

Netbeans does not come with automatic support for Maven, you will need to install the plugin.

  1. From the menu select Tools/Plugins
  2. In the plugins screen, click on the Installed tab and Click on the Reload Catalog tab to get the list of available plugins.
  3. Select the Available Plugins tab and scroll down until you see the Maven plugin in.
  4. Click on the check box next to this plug in and then select Install.
  5. Follow the instructions to install the plug in.

Configure Maven Plugin

  1. Bring up the preferences dialog.
  2. Select Miscellaneous and then click on the Maven tab.
  3. Tools=>Options for Windows users.
  4. Click on the Browse button next to the entry for External Maven Home. Navigate to the directory where you installed Maven and click Open.
  5. Update the frequency with which your local repository is indexed

Import Projects

  1. Click File | Open Project
  2. Navigate to the ide-settings folder.
  3. Choose the pom.xml file and click open.

IntelliJ

IntelliJ IDEA has Maven Plugin installed by default.

Configure Maven Plug-in

  1. Click File | Settings to bring up the IDE settings window.
  2. Click the Maven node.
  3. Click the Override check box next to the Maven Home Directory text field.
  4. Click the ... button.
  5. Navigate to the Maven 2.0.9 installation directory.
  6. Click OK.

Import Projects

  1. Click File | Open Project
  2. Choose the pom.xml file and click OK.

Subversion Clients

To check out code from google code SVN, you should use SVN client plugins in IDEs or you can use a standalone SVN client tools such as

  • SmartSVN: a good cross-platform client that supports Subversion up to 1.5
  • TortoiseSVN: a good Windows client that supports Subversion up to 1.5

Reference Material


Sign in to add a comment
Hosted by Google Code