plugins { // Apply the java-library plugin for API and implementation separation. id 'java-library' id 'maven-publish' } // Set version of programm def version = "1.1.0" group = "com.wind.meditor.ManifestEditorMain" sourceCompatibility = 11 targetCompatibility = 11 // Set correct encoding compileJava.options.encoding = 'UTF-8' tasks.withType(Javadoc) { options.encoding = 'UTF-8' } // create a single .jar with all dependencies // task fatJar(type: Jar) { archiveClassifier = '' duplicatesStrategy = DuplicatesStrategy.EXCLUDE manifest { attributes( 'Main-Class': 'com.wind.meditor.ManifestEditorMain', 'Implementation-Version': version ) } manifest { attributes( 'Implementation-Title': 'ManifestEditor', 'Implementation-Version': version, 'Implementation-Group': project.group, ) } archivesBaseName = "ManifestEditor" from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } { exclude "META-INF/*.SF" exclude "META-INF/*.DSA" exclude "META-INF/*.RSA" } with jar destinationDirectory.set(layout.buildDirectory.dir("dist")) } task sourcesJar(type: Jar, dependsOn: classes) { archiveClassifier = 'sources' from sourceSets.main.allSource destinationDirectory.set(layout.buildDirectory.dir("dist")) } task javadocJar(type: Jar, dependsOn: javadoc) { manifest { attributes( 'Implementation-Title': 'ManifestEditor', 'Implementation-Version': version, 'Implementation-Group': project.group, ) } archiveClassifier = 'javadoc' from javadoc.destinationDir destinationDirectory.set(layout.buildDirectory.dir("dist")) } artifacts { archives sourcesJar archives javadocJar archives fatJar } // publish to local maven repo // java { withJavadocJar() withSourcesJar() } publishing { publications { mavenJava(MavenPublication) { artifactId = 'ManifestEditor' from components.java pom { name = 'Manifest Editor' description = 'A manifest editor for android' url = 'https://git.rpjosh.de/RPJosh/RPdb' licenses { license { name = 'The GNU AFFERO GENERAL PUBLIC LICENSE, Version 3' url = 'https://www.gnu.org/licenses/agpl-3.0.html' } } developers { developer { id = 'RPJosh' name = 'RPJosh' email = 'RPjosh@rpjosh.de' } } } } } } repositories { mavenCentral() } dependencies { // Logging library implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.3.0-alpha16' // Rest service implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.9.0' implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.9.0' // Configuration file (.ini) implementation group: 'org.ini4j', name: 'ini4j', version: '0.5.4' } tasks.named('jar') { manifest { attributes( 'Implementation-Title': 'ManifestEditor', 'Implementation-Version': version, 'Implementation-Group': 'com.wind.meditor.ManifestEditorMain', ) } }