Created
October 18, 2013 09:35
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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