2022-01-15 20:47:23 +00:00
|
|
|
plugins {
|
|
|
|
// Apply the java-library plugin to add support for Java Library
|
|
|
|
id 'java-library'
|
2022-04-03 13:12:24 +00:00
|
|
|
id 'maven-publish'
|
2022-01-15 20:47:23 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 08:01:11 +00:00
|
|
|
// Set version of programm //
|
2022-01-15 20:47:23 +00:00
|
|
|
|
2022-04-03 13:12:24 +00:00
|
|
|
version = "1.0.1"
|
|
|
|
def version = "1.0.1"
|
2022-01-15 20:47:23 +00:00
|
|
|
|
2022-04-02 08:01:11 +00:00
|
|
|
group = "de.rpjosh"
|
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
// ----- //
|
|
|
|
|
|
|
|
|
|
|
|
sourceCompatibility = 11
|
|
|
|
targetCompatibility = 11
|
|
|
|
|
2022-04-02 08:01:11 +00:00
|
|
|
// create a single .jar with all dependencies //
|
2022-01-15 20:47:23 +00:00
|
|
|
task fatJar(type: Jar) {
|
2022-04-03 13:12:24 +00:00
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
classifier = ''
|
2022-04-03 13:12:24 +00:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
manifest {
|
|
|
|
attributes( 'Implementation-Title': 'installer',
|
|
|
|
'Implementation-Version': version,
|
|
|
|
'Implementation-Group': project.group, )
|
|
|
|
}
|
|
|
|
|
|
|
|
archivesBaseName = "installer"
|
|
|
|
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
|
|
{
|
|
|
|
exclude "META-INF/*.SF"
|
|
|
|
exclude "META-INF/*.DSA"
|
|
|
|
exclude "META-INF/*.RSA"
|
|
|
|
}
|
|
|
|
with jar
|
2022-04-03 13:12:24 +00:00
|
|
|
destinationDirectory.set(layout.buildDirectory.dir("dist"))
|
2022-01-15 20:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
2022-04-03 13:12:24 +00:00
|
|
|
//sourceSets.main.resources { srcDirs = ["src/main/java"]; exclude "**/*.java" }
|
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
|
|
manifest {
|
|
|
|
attributes( 'Implementation-Title': 'installer',
|
|
|
|
'Implementation-Version': version,
|
|
|
|
'Implementation-Group': project.group, )
|
|
|
|
}
|
|
|
|
classifier = 'javadoc'
|
|
|
|
from javadoc.destinationDir
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives fatJar
|
|
|
|
archives sourcesJar
|
|
|
|
archives javadocJar
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-02 08:01:11 +00:00
|
|
|
// the created jar file will be copied automatically into the release directory
|
2022-01-15 20:47:23 +00:00
|
|
|
task copyJar(type: Copy) {
|
2022-04-03 13:12:24 +00:00
|
|
|
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/dist/installer-" + version + "-javadoc.jar"), file("$buildDir/dist/installer-" + version + "-sources.jar")
|
2022-04-02 08:01:11 +00:00
|
|
|
into file("$buildDir/../release")
|
2022-01-15 20:47:23 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 08:01:11 +00:00
|
|
|
// build the maven repo file structure -> Javadoc can be used easily in eclipse
|
2022-01-15 20:47:23 +00:00
|
|
|
task copyJarToMaven (type: Copy) {
|
2022-04-03 13:12:24 +00:00
|
|
|
from file("$buildDir/dist/installer-" + version + ".jar"), file("$buildDir/dist/installer-" + version + "-javadoc.jar"), file("$buildDir/dist/installer-" + version + "-sources.jar")
|
2022-04-02 08:01:11 +00:00
|
|
|
into file("$buildDir/../release/mavenRepo/de/rpjosh/installer/" + version)
|
2022-01-15 20:47:23 +00:00
|
|
|
}
|
|
|
|
|
2022-04-03 13:12:24 +00:00
|
|
|
// publish to local maven repo
|
|
|
|
|
|
|
|
java {
|
|
|
|
withJavadocJar()
|
|
|
|
withSourcesJar()
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
artifactId = 'installer'
|
|
|
|
from components.java
|
|
|
|
pom {
|
|
|
|
name = 'Java-Installer'
|
|
|
|
description = 'A simple installation routine for your Java application'
|
|
|
|
url = 'https://git.rpjosh.de/RPJosh/Java-Installer'
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name = 'The GNU General Public License, Version 3'
|
|
|
|
url = 'https://www.gnu.org/licenses/gpl-3.0.html'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id = 'RPJosh'
|
|
|
|
name = 'RPJosh'
|
|
|
|
email = 'RPjosh@rpjosh.de'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
build.finalizedBy copyJar
|
|
|
|
build.finalizedBy copyJarToMaven
|
|
|
|
|
|
|
|
repositories {
|
2022-04-02 08:01:11 +00:00
|
|
|
mavenCentral()
|
2022-01-15 20:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2022-04-02 08:01:11 +00:00
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
// Use JUnit test framework
|
|
|
|
testImplementation 'junit:junit:4.12'
|
|
|
|
|
|
|
|
// https://mvnrepository.com/artifact/com.github.vatbub/mslinks
|
2022-04-02 08:01:11 +00:00
|
|
|
api group: 'com.github.vatbub', name: 'mslinks', version: '1.0.6.2'
|
|
|
|
|
2022-01-15 20:47:23 +00:00
|
|
|
|
|
|
|
// https://mvnrepository.com/artifact/commons-io/commons-io
|
|
|
|
api group: 'commons-io', name: 'commons-io', version: '2.10.0'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named('jar') {
|
|
|
|
manifest {
|
|
|
|
attributes( 'Implementation-Title': 'installer',
|
|
|
|
'Implementation-Version': version,
|
2022-04-02 08:01:11 +00:00
|
|
|
'Implementation-Group': 'de.rpjosh', )
|
2022-01-15 20:47:23 +00:00
|
|
|
}
|
|
|
|
}
|