Skip to content

Instantly share code, notes, and snippets.

@w4tson
Created October 18, 2013 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w4tson/7039070 to your computer and use it in GitHub Desktop.
Save w4tson/7039070 to your computer and use it in GitHub Desktop.
Using the redline stuff to create an RPM of a jar for Redhat
import static org.freecompany.redline.payload.Directive.NONE;
apply plugin: 'java'
apply plugin: 'rpm'
buildscript {
repositories {
mavenLocal()
maven { url = mavenServer+mavenRepo }
}
dependencies {
classpath 'com.trigonic:gradle-rpm-plugin:1.4-SNAPSHOT'
}
}
configurations
{
rpmRpm
}
jar {
manifest { attributes("Main-Class": 'com.foo.MainClass') }
}
task buildRpm(type: Rpm, dependsOn: jar) {
packageName = 'myPackage'
version = 1.0
release = 2
arch X86_64
os = LINUX
def artifactName = "foo"
project.getArtifacts().add('rpmRpm', file("${project.buildDir}/distributions/${archiveName}")) {
name artifactName
type 'rpm'
}
preInstall = file('rpm_scripts/preInstall.sh')
postInstall = file('rpm_scripts/preInstall.sh')
preUninstall = file('rpm_scripts/preInstall.sh')
postUninstall = file('rpm_scripts/preInstall.sh')
from(jar.archivePath) {
into '/opt/foo'
fileMode = 0744
user = 'foo'
group = 'foo'
fileType = NONE
}
from(configurations.compile) {
into '/opt/foo/lib'
fileMode = 0744
user = 'foo'
group = 'foo'
}
link('/opt/foo/foo.jar', "./${jar.archiveName}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment