Integration of Maven Components

From Gcube Wiki
Revision as of 14:31, 3 April 2012 by Gabriele.giammatteo (Talk | contribs) (Maven Proxy)

Jump to: navigation, search

Introduction

This guide is meant to provide gCube's Developers with all information needed to properly configure a Maven-based gCube component in ETICS to succesfully integrate with other components in the system.

Glossary

  • gCube maven component: a gCube component which uses Maven ad building tool
  • gCube legacy component: a gCube component (most probably developed before iMarine project) which uses the classical building system based on ant


Maven Reposiotries

  • gCube Snapshots
  • gCube Releases
  • gCube Externals


Maven Proxy

Actions:

  • set settings.xml file and path for maven local repository
  • check that pom and ETICS versions are coherent
  • run versions plugin replacing dependencies' versions forcing usage of ones stored in the local repository
  • set -Dmaven.deploy.skip properly

Mavenizer

Mavenizer is a tool created with the intent of making gCube legacy components compatible with new maven components. It is able to generate a pom.xml on-the-fly from information available on component's profile.xml and ETICS configuration and upload artifacts on gCube repositories. It is meant to be used by ETICS during its builds to mavenize legacy components with a twofold benefit:

  • being able to have those components in gCube Maven Repositories
  • make legacy components available for Maven components in the local Maven repository for compile-time dependency resolution purposes

The snippet below shows the input parameters accepted by mavenize script.

[gabriele@gabriele-work maven-builder]$ bin/mavenize --help
USAGE: bin/mavenize [flags]
flags:
  -g,--groupId:  the groupId to use in the mvn commandline (default: 'org.gcube')
  -k,--packaging:  the type of the artifact. Default is 'jar'. (default: 'jar')
  -n,--artifactId:  the artifactId to use in the mvn commandline. If not specified, it will be the etics module's name (default: '')
  -v,--version:  the version to use in the mvn commandline. If not specified, it will be the etics module version (default: '')
  -f,--file:  artifact file to mavenize. If not specified, a search will be done in the etics module home trying to find a suitable artifact (default: '')
  -d,--[no]forcedeploy:  force deployment of artifact on remote repository (default: false)
  -s,--[no]dryrun:  no act. Perform just a simulation (default: false)
  -l,--loglevel:  log level. Accepted values are 0, 1, 2 (default: 1)
  -h,--[no]help:  show this help (default: false)


All parameters are optional; if a parameter is not provided, the mavenizer tries to guess the value searching the information in component's profile.xml and/or ETICS configuration (depending on the type fo parameter).


To trigger execution of mavenizer on a given legacy component, it is enough - in most of cases - to have an invocation to mavenize in the component's ETICS build configuration in target postpublish (as shown in figure below).

Mavenizer, example of build configuration

Note: call to mavenize should be already present in all legacy components since it has been added automatically by ETICS administrators.