Skip to content

Commit

Permalink
Merge pull request #765 from seadowg/gradle
Browse files Browse the repository at this point in the history
Use Maven plugin for local publish
  • Loading branch information
seadowg authored Jun 3, 2024
2 parents 9408533 + 09d2c7b commit c546305
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ out
# mvn
target
secrets.xml
pom-local.xml

# logging
logback.xml
Expand Down
39 changes: 13 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down Expand Up @@ -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('<version>') && !changedVersion) {
writer.write('<version>local</version>')
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
Expand Down Expand Up @@ -130,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'
Expand Down

0 comments on commit c546305

Please sign in to comment.