Skip to content

Commit

Permalink
Create two separate templates
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Jun 10, 2013
1 parent d0ffe01 commit 4a6e77c
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 111 deletions.
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
# Rundeck Java plugin build template
# Rundeck Java plugin build templates

This directory contains a skeleton project to create a Rundeck Plugin.
This directory contains some skeleton projects to create a Rundeck Plugin.

View the [Rundeck Development Guide - Plugin Development - Java Plugin Development](http://rundeck.org/docs/developer/plugin-development.html#java-plugin-development) for more information about developing Rundeck Plugins in Java.

See also: [Rundeck Development Guide](http://rundeck.org/docs/developer/) for more information about plugin development in general.

## Choose a template

1. `java-no-dependencies` is a java project without the need to embed any third-party jar dependencies
2. `java-with-dependencies` can bundle jar dependencies into the built plugin jar

## Customizing

1. Add java code to the `src/main/java` directory, implementing one of the Rundeck plugin interfaces. Don't forget to *annotate* your plugin class with the `@Plugin` annotation at least, and provide a `service` and `name` value.
2. Modify the `build.gradle` file, and add the class names to those used for your plugin(s) to the `ext.pluginClassNames` value.
1. Copy the directory and rename it
2. Add java code to the `src/main/java` directory, implementing one of the Rundeck plugin interfaces. Don't forget to *annotate* your plugin class with the `@Plugin` annotation at least, and provide a `service` and `name` value.
3. Modify the `build.gradle` file, and add the class names to those used for your plugin(s) to the `ext.pluginClassNames` value.
4. Modify the `build.gradle` to specify any jar dependencies

## Building

Run:

gradle clean build


## Maven support

You can generate a `pom.xml`:

1. Modify the `build.gradle` file, and change all of the `ext.mavenPom*` values:

ext.mavenPomGroupId='com.example'
ext.mavenPomArtifactId='my-rundeck-plugin'
ext.mavenPomTitle='My Plugin'

2. Run this to generate a `pom.xml:

gradle createPom
gradle clean build
91 changes: 0 additions & 91 deletions build.gradle

This file was deleted.

37 changes: 37 additions & 0 deletions java-no-dependencies/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version = '1.5.4-SNAPSHOT'
defaultTasks 'clean','build'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.5
ext.rundeckPluginVersion= '1.1'

/**
* Set this to a comma-separated list of full classnames of your implemented Rundeck
* plugins.
*/
ext.pluginClassNames='com.example.rundeck.plugin.MyExamplePlugin'

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
compile( [group: 'org.rundeck', name: 'rundeck-core', version: version,ext:'jar'])
testCompile(
//[group: 'junit', name: 'junit', version: '3.8.1',ext:'jar']
)
}


jar {
manifest {
attributes 'Rundeck-Plugin-Classnames': pluginClassNames
attributes 'Rundeck-Plugin-File-Version': version
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true'
}
}

task wrapper(type: Wrapper) {
gradleVersion = '1.3'
}
68 changes: 68 additions & 0 deletions java-with-dependencies/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version = '1.5.4-SNAPSHOT'
defaultTasks 'clean','build'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.5
ext.rundeckPluginVersion= '1.1'

/**
* Set this to a comma-separated list of full classnames of your implemented Rundeck
* plugins.
*/
ext.pluginClassNames='com.example.rundeck.plugin.MyExamplePlugin'


repositories {
mavenLocal()
mavenCentral()

//use the local third-party directory for included pre-built jars
add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
name = 'thirdparty'
addArtifactPattern "$projectDir/third-party/[module]-[revision]/[module]-[revision](-[classifier]).[ext]"
descriptor = 'optional'
checkmodified = true
}
}

configurations{
//declare custom pluginLibs configuration to include only libs for this plugin
pluginLibs

//declare compile to extend from pluginLibs so it inherits the dependencies
compile{
extendsFrom pluginLibs
}
}

dependencies {
// add any third-party jar dependencies you wish to include in the plugin
// using the `pluginLibs` configuration as shown here:

//pluginLibs group: 'commons-httpclient', name: 'commons-httpclient', version: '3.0.1'

//the compile dependency won't add the rundeck-core jar to the plugin contents
compile group: 'org.rundeck', name: 'rundeck-core', version: '1.5'
}

// task to copy plugin libs to output/lib dir
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.pluginLibs
}


jar {
from "$buildDir/output"
manifest {
def libList = configurations.pluginLibs.collect{'lib/'+it.name}.join(' ')
attributes 'Rundeck-Plugin-Classnames': pluginClassNames
attributes 'Rundeck-Plugin-File-Version': version
attributes 'Rundeck-Plugin-Version': rundeckPluginVersion, 'Rundeck-Plugin-Archive': 'true'
attributes 'Rundeck-Plugin-Libs': "${libList}"
}
}

task wrapper(type: Wrapper) {
gradleVersion = '1.3'
}

0 comments on commit 4a6e77c

Please sign in to comment.