我是Java 8 java.time JSP tags库的mantainer。我自己发布图书馆的经验很少。对于这个图书馆的出版物,我做了一些研究,并以Gradle构建脚本that you can check in GitHub结束。这个过程有点笨重,但最终还是有效的。如何迁移gradle发布脚本以将OSS库发布到Bintray的JCenter而不是Sonatype的Maven Central
似乎有一个普遍的认识,jcenter()
存储库正在获得很多关注。可能是因为android。无论如何,我看到an encouraging blog post,并决定尝试并将该库迁移到Maven Central的JCenter发布。应该很容易。
这不是,对我来说至少。可能是我的错,因为我对Maven,文物以及所有这些东西的了解都很差。无论如何,我给了它几个小时的研究,并提出一个新的gradle构建发布到我的Bintray maven仓库。如果我没有错,这是向JCenter发布的第一步。
这是我到目前为止有:
plugins {
id "com.jfrog.bintray" version "1.6"
}
apply plugin: 'java'
apply plugin: 'maven-publish'
group = 'net.sargue'
version = '1.1.2'
sourceCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'
repositories {
jcenter()
}
configurations {
testCompile.extendsFrom compileOnly
}
dependencies {
compileOnly 'javax.servlet:javax.servlet-api:3.0.1'
compileOnly 'javax.servlet.jsp:javax.servlet.jsp-api:2.2.1'
compileOnly 'javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1'
testCompile 'junit:junit:4.12'
testCompile 'org.springframework:spring-test:4.1.7.RELEASE'
}
jar {
manifest {
attributes 'Implementation-Title': 'Java 8 java.time JSP tags',
'Implementation-Version': version
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
artifactId 'java-time-jsptags'
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'Java 8 java.time JSP tags'
description 'JSP tag support for Java 8 java.time (JSR-310)'
url 'https://github.com/sargue/java-time-jsptags'
scm {
connection 'scm:git:[email protected]:sargue/java-time-jsptags.git'
developerConnection 'scm:git:[email protected]:sargue/java-time-jsptags.git'
url '[email protected]:sargue/java-time-jsptags.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'sargue'
name 'Sergi Baila'
email '[email protected]'
}
}
}
}
}
}
}
bintray {
user = BINTRAY_USER
key = BINTRAY_KEY
publications = ['MyPublication']
pkg {
repo = 'maven'
name = 'java-time-jsptags'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/sargue/java-time-jsptags.git'
version {
name = project.version
desc = 'Java 8 java.time JSP tags'
gpg {
sign = true
passphrase = BINTRAY_GPG
}
}
}
}
你可以找到my public Bintray maven repository最新公布的结果。您可以将其与the same version currently available on Maven Central的文件进行比较。
恭喜你是否阅读过这篇文章,因为我还没有提出任何问题。对于那个很抱歉。
我的问题:
的是的gradle构建脚本正确和适当/规范的方法?鉴于该库非常简单,我发现构建脚本庞大笨重。它应该更容易,它甚至有一个gradle插件。但新的脚本是较长的比maven中央一个。
怎么样*.md5
和*.sha1
文件?将由JCenter,Maven Central生成,同步处理...还是应该这样做?
考虑到存储库上没有未发布的功能,有没有一种方法可以测试所有这些,而不必发布实际版本的库? (有一个很好的理由,呃?任何人都可以?)。