Skip to content

Commit

Permalink
Set publishing to use Maven Central instead of JCenter
Browse files Browse the repository at this point in the history
Fixes #35 JCenter shutting down
  • Loading branch information
amdelamar committed Feb 8, 2021
1 parent 99892dd commit 35f5bac
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 106 deletions.
19 changes: 2 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Jhash

[![Bintray](https://img.shields.io/bintray/v/amdelamar/mvn/jhash)](https://bintray.com/amdelamar/mvn/jhash/_latestVersion)
[![Maven Central](https://img.shields.io/maven-central/v/com.amdelamar/jhash.svg)](https://search.maven.org/search?q=a:jhash)
[![Javadoc](https://www.javadoc.io/badge/com.amdelamar/jhash.svg)](https://www.javadoc.io/doc/com.amdelamar/jhash)
[![Build](https://img.shields.io/drone/build/amdelamar/jhash.svg)](https://cloud.drone.io/amdelamar/jhash)
[![Codecov](https://img.shields.io/codecov/c/github/amdelamar/jhash.svg)](https://codecov.io/gh/amdelamar/jhash)
Expand All @@ -13,13 +13,6 @@ Password hashing utility in Java. It can hash passwords with PBKDF2 hmac SHA1/SH
Maven:

```xml
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>

<dependency>
<groupId>com.amdelamar</groupId>
<artifactId>jhash</artifactId>
Expand All @@ -30,10 +23,6 @@ Maven:
Gradle:

```gradle
repositories {
jcenter()
}
dependencies {
compile 'com.amdelamar:jhash:2.2.0'
}
Expand All @@ -42,16 +31,12 @@ dependencies {
SBT:

```scala
resolvers += {
Resolver.jcenterRepo
}

libraryDependencies ++= Seq(
"com.amdelamar" % "jhash" % "2.2.0"
)
```

Or Download the [latest release](https://github.com/amdelamar/jhash/releases). Published on [JCenter](https://bintray.com/amdelamar/mvn/jhash).
Or Download the [latest release](https://github.com/amdelamar/jhash/releases).


## Usage
Expand Down
112 changes: 50 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ plugins {
id 'java'
id 'java-library'
id 'jacoco'
id 'maven'
id 'maven-publish'
id 'com.jfrog.bintray' version '1.8.4'
id 'org.sonarqube' version '2.6.2'
id 'signing'
}

group = 'com.amdelamar'
Expand All @@ -14,9 +12,10 @@ description = 'Password hashing utility in Java. Supports PBKDF2 hmac SHA1/SHA25
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand All @@ -31,30 +30,9 @@ test {
}
}

jar {
baseName = 'jhash'
from sourceSets.main.allSource
}

javadoc {
source = sourceSets.main.allJava
classpath = configurations.compile
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}

artifacts {
archives jar
archives sourcesJar
archives javadocJar
java {
withJavadocJar()
withSourcesJar()
}

jacocoTestReport {
Expand All @@ -65,44 +43,54 @@ jacocoTestReport {
}

publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact (sourcesJar) {
classifier = "sources"
}
artifact (javadocJar) {
classifier = "javadoc"
repositories {
maven {
def releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
url = isReleaseVersion ? releaseRepo : snapshotRepo
credentials {
username = project.hasProperty('sonatypeUsername') ? sonatypeUsername : System.getenv('SONATYPE_USERNAME')
password = project.hasProperty('sonatypePassword') ? sonatypePassword : System.getenv('SONATYPE_PASSWORD')
}
version this.version
groupId this.group
artifactId 'jhash'
}
}
}

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['MyPublication']
publish = true
override = true
pkg {
repo = 'mvn'
name = 'jhash'
desc = this.description
licenses = ['Apache-2.0']
websiteUrl = 'https://amdelamar.com/jhash/'
issueTrackerUrl = 'https://github.com/amdelamar/jhash/issues'
vcsUrl = 'git://github.com/amdelamar/jhash.git'
version {
name = this.version
desc = this.description
released = new Date()
publications {
mavenJava(MavenPublication) {
pom {
name = 'jhash'
artifactId = 'jhash'
groupId = this.group
version = this.version
description = this.description
url = 'https://amdelamar.com/jhash/'
from components.java
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = "amdelamar"
name = "Austin Delamar"
email = "[email protected]"
}
}
scm {
connection = 'scm:git:[email protected]:amdelamar/jhash.git'
developerConnection = 'scm:git:[email protected]:amdelamar/jhash.git'
url = 'https://github.com/amdelamar/jhash/'
}
}
}
githubRepo = 'amdelamar/jhash' // Optional Github repository
githubReleaseNotesFile = 'README.md' // Optional Github release notes
labels = ['password', 'hash', 'pbkdf2', 'hmac' ,'sha' ,'sha256' ,'bcrypt' ,'scrypt']
publicDownloadNumbers = true
}
}

signing {
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
23 changes: 4 additions & 19 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,40 +70,25 @@ <h3>Download</h3>
</p>

<p>Maven:</p>
<pre><code class="xml">&lt;repositories&gt;
&lt;repository&gt;
&lt;id&gt;jcenter&lt;/id&gt;
&lt;url&gt;https://jcenter.bintray.com/&lt;/url&gt;
&lt;/repository&gt;
&lt;/repositories&gt;

&lt;dependency&gt;
<pre><code class="xml">&lt;dependency&gt;
&lt;groupId&gt;com.amdelamar&lt;/groupId&gt;
&lt;artifactId&gt;jhash&lt;/artifactId&gt;
&lt;version&gt;2.2.0&lt;/version&gt;
&lt;/dependency&gt;</code></pre>

<p>Gradle:</p>
<pre><code class="groovy">repositories {
jcenter()
}

dependencies {
<pre><code class="groovy">dependencies {
compile 'com.amdelamar:jhash:2.2.0'
}
</code></pre>

<p>SBT:</p>
<pre><code class="scala">resolvers += {
Resolver.jcenterRepo
}

libraryDependencies ++= Seq(
<pre><code class="scala">libraryDependencies ++= Seq(
"com.amdelamar" % "jhash" % "2.2.0"
)
</code></pre>

<p>Or Download the <a href="https://github.com/amdelamar/jhash/releases">latest release</a>. Published on <a href="https://bintray.com/amdelamar/mvn/jhash">JCenter</a>.</p>
<p>Or Download the <a href="https://github.com/amdelamar/jhash/releases">latest release</a>.

<br>
<h3>Usage</h3>
Expand Down
8 changes: 0 additions & 8 deletions pom.xml

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'jhash'

0 comments on commit 35f5bac

Please sign in to comment.