From 25b4e10940287765d6f5be730815bd7a2ec1c2ad Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Tue, 28 May 2024 09:29:45 +0100 Subject: [PATCH 1/2] Use Maven plugin for local publish --- .gitignore | 1 - build.gradle | 39 +++++++++++++-------------------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 5986e2684..421045d79 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ out # mvn target secrets.xml -pom-local.xml # logging logback.xml diff --git a/build.gradle b/build.gradle index 62430f65a..8a029521d 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,7 @@ if (!project.hasProperty("android")) { apply plugin: 'checkstyle' apply plugin: 'jacoco' apply plugin: 'me.champeau.jmh' + apply plugin: 'maven-publish' } else { apply plugin: 'com.android.library' } @@ -51,32 +52,6 @@ compileTestJava { targetCompatibility = '1.8' sourceCompatibility = '1.8' -tasks.register('installLocal') { - def lines = [] - new File('pom.xml').withReader { reader -> - reader.eachLine { - lines.add(it) - } - } - - def changedVersion = false - new File('pom-local.xml').withWriter { writer -> - lines.forEach { - if (it.trim().startsWith('') && !changedVersion) { - writer.write('local') - changedVersion = true - } else { - writer.write(it) - } - } - } - - exec { - executable 'mvn' - args '-f', 'pom-local.xml', '-Dgpg.skip', 'install' - } -} - if (!project.hasProperty("android")) { jar { // Be sure to update version in pom.xml to match @@ -155,6 +130,18 @@ if (!project.hasProperty("android")) { } } +publishing { + publications { + mavenJava(MavenPublication) { + groupId = 'org.getodk' + artifactId = 'javarosa' + version = 'local' + + from components.java + } + } +} + dependencies { // Be sure to update dependencies in pom.xml to match implementation 'joda-time:joda-time:2.10.13' From 09d2c7bdf67780b285017dd932095abca6fc6f69 Mon Sep 17 00:00:00 2001 From: Callum Stott Date: Tue, 28 May 2024 13:12:41 +0100 Subject: [PATCH 2/2] Move publishing block to java library block --- build.gradle | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 8a029521d..7c450c724 100644 --- a/build.gradle +++ b/build.gradle @@ -105,6 +105,18 @@ if (!project.hasProperty("android")) { duplicateClassesStrategy = DuplicatesStrategy.WARN } + + publishing { + publications { + mavenJava(MavenPublication) { + groupId = 'org.getodk' + artifactId = 'javarosa' + version = 'local' + + from components.java + } + } + } } else { android { namespace 'com.example' @@ -130,18 +142,6 @@ if (!project.hasProperty("android")) { } } -publishing { - publications { - mavenJava(MavenPublication) { - groupId = 'org.getodk' - artifactId = 'javarosa' - version = 'local' - - from components.java - } - } -} - dependencies { // Be sure to update dependencies in pom.xml to match implementation 'joda-time:joda-time:2.10.13'