maestrodev/puppet-maven

Name: puppet-maven

Owner: MaestroDev

Description: A puppet recipe for Apache Maven, to download artifacts from a Maven repository, install Maven, configure settings.xml,...

Created: 2011-03-04 02:17:46.0

Updated: 2018-01-07 18:17:25.0

Pushed: 2017-07-12 18:44:13.0

Homepage: http://www.maestrodev.com

Size: 212

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Puppet-Maven

A Puppet recipe for Apache Maven, to download artifacts from a Maven repository

Uses Apache Maven command line to download the artifacts.

Building and Installing the Module

To build the module for installing in your Puppet master:

install puppet-module
clone git://github.com/maestrodev/puppet-maven.git
uppet-maven
et module build
et module install pkg/maestrodev-maven-1.0.1.tar.gz

Of course, you can also clone the repository straight into /etc/puppet/modules/maven as well.

Developing and Testing the Module

If you are developing the module, it can be built using rake:

install bundler
le
 spec
Acceptance tests

Using Puppetlabs Beaker. To run the default Vagrant box in CentOS 6.5 just do

 beaker

To run any other box, check the definitions at spec/acceptance/nodesets. For instance to run the tests with Docker in CentOS 6.5

ER_set=centos-65-x64-docker rake beaker
Usage
ven { "/tmp/myfile":
id => "groupId:artifactId:version:packaging:classifier",
repos => ["id::layout::http://repo.acme.com","http://repo2.acme.com"],

or

ven { "/tmp/myfile":
groupid => "org.apache.maven",
artifactid => "maven-core",
version => "3.2.5",
packaging => "jar",
classifier => "sources",
repos => ["id::layout::http://repo.acme.com","http://repo2.acme.com"],

ensure

ensure may be one of two values:

MAVEN_OPTS Precedence

Values set in maven_opts will be prepended to any existing MAVEN_OPTS value. This ensures that those already specified will win over those added in mavenrc.

If you would prefer these options to win, instead use:

ven_opts        => "",
venrc_additions => 'MAVEN_OPTS="$MAVEN_OPTS -Xmx1024m"
Examples
Setup
entral = {
id => "myrepo",
username => "myuser",
password => "mypassword",
url => "http://repo.acme.com",
mirrorof => "external:*",      # if you want to use the repo as a mirror, see maven::settings below


roxy = {
active => true, #Defaults to true
protocol => 'http', #Defaults to 'http'
host => 'http://proxy.acme.com',
username => 'myuser', #Optional if proxy does not require
password => 'mypassword', #Optional if proxy does not require
nonProxyHosts => 'www.acme.com', #Optional, provides exceptions to the proxy


Install Maven
ass { "maven::maven":
version => "3.2.5", # version to install
# you can get Maven tarball from a Maven repository instead than from Apache servers, optionally with a user/password
repo => {
  #url => "http://repo.maven.apache.org/maven2",
  #username => "",
  #password => "",
}
->

Setup a .mavenrc file for the specified user
ven::environment { 'maven-env' : 
  user => 'root',
  # anything to add to MAVEN_OPTS in ~/.mavenrc
  maven_opts => '-Xmx1384m',       # anything to add to MAVEN_OPTS in ~/.mavenrc
  maven_path_additions => "",      # anything to add to the PATH in ~/.mavenrc

->

Create a settings.xml with the repo credentials
ven::settings { 'maven-user-settings' :
mirrors => [$central], # mirrors entry in settings.xml, uses id, url, mirrorof from the hash passed
servers => [$central], # servers entry in settings.xml, uses id, username, password from the hash passed, privateKey
proxies => [$proxy], # proxies entry in settings.xml, active, protocol, host, username, password, nonProxyHosts
user    => 'maven',


defaults for all maven{} declarations
ven {
user  => "maven", # you can make puppet run Maven as a specific user instead of root, useful to share Maven settings and local repository
group => "maven", # you can make puppet run Maven as a specific group
repos => "http://repo.maven.apache.org/maven2"

Downloading artifacts
ven { "/tmp/maven-core-3.2.5.jar":
id => "org.apache.maven:maven-core:3.2.5:jar",
repos => ["central::default::http://repo.maven.apache.org/maven2","http://mirrors.ibiblio.org/pub/mirrors/maven2"],


ven { "/tmp/maven-core-3.2.5-sources.jar":
groupid    => "org.apache.maven",
artifactid => "maven-core",
version    => "3.2.5",
classifier => "sources",

Buildr version

Initially there was an Apache Buildr version, but it required to have Buildr installed before running Puppet and you would need to enable pluginsync in both master and clients.

License
pyright 2011-2012 MaestroDev

censed under the Apache License, Version 2.0 (the "License");
u may not use this file except in compliance with the License.
u may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

less required by applicable law or agreed to in writing, software
stributed under the License is distributed on an "AS IS" BASIS,
THOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e the License for the specific language governing permissions and
mitations under the License.
Author

Carlos Sanchez csanchez@maestrodev.com MaestroDev 2010-03-01


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.