Skip to content

Commit

Permalink
MOD: maven publish
Browse files Browse the repository at this point in the history
  • Loading branch information
yuan committed Jan 27, 2019
1 parent 77cf68c commit 4666b00
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,63 @@ subprojects {

apply plugin: "maven-publish"
publishing {
String repoUrl = property("nexus.release.url")
String pubVersion = project.version
repositories {
maven {
name "nexus"
url repoUrl
name "oss"
def ossBaseUrl = "https://oss.sonatype.org/content/repositories"
url = project.hasProperty("release") ? "$ossBaseUrl/releases" : "$ossBaseUrl/snapshots"
credentials {
username property("nexus.username")
password property("nexus.password")
username property("maven2.username")
password property("maven2.password")
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java

if (project.hasProperty("release")) {
version = project.getVersion()
} else {
version = project.getVersion() + "-SNAPSHOT"
}

artifact sourcesJar
artifact protoZip

pom {
name = 'TensorFlow4j'
description = 'A Java Library for Protobuf in TensorFlow and TensorFlow-Serving'
url = 'https://github.com/YuanWenqing/tensorflow4j'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'yuanwq'
name = 'YuanWenqing'
email = 'ywq8876@163.com'
}
}
scm {
connection = 'scm:git:git://github.com:YuanWenqing/tensorflow4j.git'
developerConnection = 'scm:git:ssh://github.com:YuanWenqing/tensorflow4j.git'
url = 'https://github.com/YuanWenqing/tensorflow4j'
}
}
}
}
}
publish {
doLast {
def pub = publishing.publications.mavenJava
println "artifact: ${pub.groupId}:${pub.artifactId}:${pub.version}"
for (repo in publishing.repositories) {
println "upload to ${repo.url}"
}
}
}
publishToMavenLocal {
Expand Down

0 comments on commit 4666b00

Please sign in to comment.