Publish to Maven Central and add upgrade gradle to v8.1
Gitea/Java-Installer/pipeline/head There was a failure building this commit Details

snapshot
Jonas Letzbor 2023-05-19 14:01:14 +02:00
parent 5a198decb4
commit b683978039
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
5 changed files with 60 additions and 10 deletions

1
.gitignore vendored
View File

@ -68,6 +68,7 @@ local.properties
# Gradle # Gradle
.gradle .gradle
/gradle.properties
# Space for private notes # Space for private notes
/notes /notes

12
Jenkinsfile vendored
View File

@ -8,7 +8,17 @@ pipeline {
stages { stages {
stage('Build') { stage('Build') {
steps { steps {
sh './gradlew build publishToMavenLocal --warning-mode all' script {
withCredentials([
file(credentialsId: 'MAVEN_PUBLISH_SONATYPE_GRADLE_PROPERTIES', variable: 'SONATYPE_CREDENTIALS')
]) {
// Build and publish
sh 'cp \${SONATYPE_CREDENTIALS} ./gradle.properties'
sh './gradlew --no-build-cache build publishToMavenLocal publishToSonatype closeAndReleaseSonatypeStagingRepository --warning-mode all'
sh 'rm ./gradle.properties'
}
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
# Purpose # Purpose
This project provides a simple installation tool for installing your java application under the operation systems *windows* and *linux*. This project provides a simple installation tool for installing your java application under the operating systems *windows* and *linux*.
If you want to use a simple installer instead of the installation method the operating systems ships with (like *msi* or *dpkg packages*) feel free to use this installer. If you want to use a simple installer instead of the installation method the operating systems ships with (like *msi* or *dpkg packages*) feel free to use this installer.
This installer can be used for a **single jar file** with a few dependencies. This installer can be used for a **single jar file** with a few dependencies.
@ -16,11 +16,12 @@ Basic auth for downloading the executable is supported
* install the program *portable* in a single folder * install the program *portable* in a single folder
* creating a **desktop** and a **start menu** entry with a custom icon * creating a **desktop** and a **start menu** entry with a custom icon
* a **launch script** for opening the application will be provided * a **launch script** for opening the application will be provided
* put your application into the autostart folder of the operating system *(for GUI applications)*
### Windows ### Windows
* besides the removal via the launch script an **uninstall** entry in the *contol center* will also be created * besides the removal via the launch script an **uninstall** entry in the *contol center* will also be created
* install the programm only for the current **user** -> no need of administrator rights * install the programm only for the current **user** no need of administrator rights
### Linux ### Linux
@ -28,6 +29,12 @@ Basic auth for downloading the executable is supported
# Getting started # Getting started
## How to get
You can build the library by yourself or use the provided version in the [Maven Central Repository](https://central.sonatype.com/artifact/de.rpjosh/installer/1.1.0).
## Usage
The usage of the library is very simple. See the below code snippet for a short example. The usage of the library is very simple. See the below code snippet for a short example.
``` ```
@ -45,13 +52,14 @@ conf.setDownloadURLForProgramm(URL, BASIC_AUTH_USER, BASIC_AUTH_PASSWORD);
Installer installer = new Installer(conf); Installer installer = new Installer(conf);
installer.installProgramm(args); installer.installProgramm(args);
// whether the installation was successful (0) or erroneous (<0) // whether the installation was successful (0) or erroneous (>0)
System.out.println(installer.getResponseCode()); System.out.println(installer.getResponseCode());
``` ```
___ ___
For a real life example you can take a look at the installer of [RPdb](https://git.rpjosh.de/RPJosh/RPdb/src/branch/master/Program/Java/tk.rpjosh.rpdb.installer). For a real life example you can take a look at the installer of [RPdb](https://git.rpjosh.de/RPJosh/RPdb/src/branch/master/Program/Java/tk.rpjosh.rpdb.installer).
# License # License
This project is licensed under the GPLv3. Please see the [LICENSE](LICENSE) file for an full license. This project is licensed under the GPLv3. Please see the [LICENSE](LICENSE) file for an full license.

View File

@ -2,6 +2,8 @@ plugins {
// Apply the java-library plugin to add support for Java Library // Apply the java-library plugin to add support for Java Library
id 'java-library' id 'java-library'
id 'maven-publish' id 'maven-publish'
id 'signing'
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
} }
// Set version of programm // // Set version of programm //
@ -25,7 +27,7 @@ targetCompatibility = 11
// create a single .jar with all dependencies // // create a single .jar with all dependencies //
task fatJar(type: Jar) { task fatJar(type: Jar) {
classifier = '' archiveClassifier = ''
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { manifest {
@ -46,7 +48,7 @@ task fatJar(type: Jar) {
} }
task sourcesJar(type: Jar, dependsOn: classes) { task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources' archiveClassifier = 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
} }
@ -59,7 +61,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
'Implementation-Version': version, 'Implementation-Version': version,
'Implementation-Group': project.group, ) 'Implementation-Group': project.group, )
} }
classifier = 'javadoc' archiveClassifier = 'javadoc'
from javadoc.destinationDir from javadoc.destinationDir
} }
@ -89,11 +91,25 @@ java {
withSourcesJar() withSourcesJar()
} }
nexusPublishing {
repositories {
sonatype{
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
// Or use System.getenv?
username=project.property("maven.sonatype.user")
password=project.property("maven.sonatype.password")
}
}
}
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { javaPubl(MavenPublication) {
artifactId = 'installer' artifactId = 'installer'
from components.java from components.java
pom { pom {
name = 'Java-Installer' name = 'Java-Installer'
description = 'A simple installation routine for your Java application' description = 'A simple installation routine for your Java application'
@ -107,15 +123,30 @@ publishing {
developers { developers {
developer { developer {
id = 'RPJosh' id = 'RPJosh'
name = 'RPJosh' name = 'Jonas Letzbor'
email = 'RPjosh@rpjosh.de' email = 'RPjosh@rpjosh.de'
} }
} }
scm {
connection = 'scm:git:https://git.rpjosh.de/RPJosh/Java-Installer.git'
developerConnection = 'scm:git:https://git.rpjosh.de/RPJosh/Java-Installer.git'
url = 'https://git.rpjosh.de/RPJosh/Java-Installer'
}
} }
} }
} }
} }
signing {
def signingKey = project.property("maven.sonatype.signing.key")
def signingPassword = project.property("maven.sonatype.signing.password")
useInMemoryPgpKeys(signingKey, signingPassword)
// Only sign the publication
sign publishing.publications.javaPubl
}
build.finalizedBy copyJar build.finalizedBy copyJar

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists