-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from cognizone/ci/publish-to-nexus-and-maven-…
…central Ci/publish to nexus and maven central
- Loading branch information
Showing
2 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ subprojects { | |
apply plugin: "idea" | ||
apply plugin: "io.spring.dependency-management" | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
apply plugin: 'project-report' | ||
|
||
repositories { | ||
|
@@ -125,18 +126,26 @@ subprojects { | |
useJUnitPlatform() | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
description = 'Creates sources JAR.' | ||
archiveClassifier = 'sources' | ||
jar { | ||
from("${projectDir}") { | ||
include 'LICENSE' | ||
into '/' | ||
} | ||
from("${projectDir}") { | ||
include 'LICENSE' | ||
into 'META-INF' | ||
} | ||
} | ||
|
||
from sourceSets.main.allSource | ||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
versionMapping { | ||
usage('java-api') { | ||
fromResolutionOf('runtimeClasspath') | ||
|
@@ -145,19 +154,83 @@ subprojects { | |
fromResolutionResult() | ||
} | ||
} | ||
pom { | ||
name = 'asquare' | ||
packaging = 'jar' | ||
// optionally artifactId can be defined here | ||
description = 'Library for Semantic Development' | ||
url = 'https://github.com/cognizone/asquare' | ||
|
||
scm { | ||
connection = 'scm:git:[email protected]:cognizone/asquare.git' | ||
developerConnection = 'scm:git:[email protected]:cognizone/asquare.git' | ||
url = 'https://github.com/cognizone/asquare' | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'cognizone' | ||
name = 'Cognizone' | ||
email = '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
credentials { | ||
username = System.properties['archiva.user'] | ||
password = System.properties['archiva.password'] | ||
if (project.hasProperty("publishToCognizoneArchiva")) { | ||
maven { | ||
credentials { | ||
username = System.properties['archiva.username'] | ||
password = System.properties['archiva.password'] | ||
} | ||
name = 'public' | ||
url = System.properties['archiva.url'] | ||
} | ||
} | ||
if (project.hasProperty("publishToCognizoneNexus")) { | ||
maven { | ||
credentials { | ||
username = System.properties['nexus.username'] | ||
password = System.properties['nexus.password'] | ||
} | ||
def releasesRepoUrl = "${System.properties['nexus.url']}/repository/cognizone-release" | ||
def snapshotsRepoUrl = "${System.properties['nexus.url']}/repository/cognizone-snapshot" | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
allowInsecureProtocol(true) | ||
} | ||
} | ||
if (project.hasProperty("publishToMavenCentral")) { | ||
maven { | ||
credentials { | ||
username = System.properties['ossrh.username'] | ||
password = System.properties['ossrh.password'] | ||
} | ||
// We cannot directly release to Maven Central, we first need to publish on staging repo | ||
// then manually release through the UI in https://s01.oss.sonatype.org/ (login with JIRA) | ||
def stagingRepoUrl = "${System.properties['ossrh.url']}/content/groups/staging" | ||
def snapshotsRepoUrl = "${System.properties['ossrh.url']}/content/repositories/snapshots" | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : stagingRepoUrl | ||
} | ||
name = 'public' | ||
url = System.properties['archiva.url'] | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications.mavenJava | ||
} | ||
|
||
tasks.withType(Javadoc) { | ||
failOnError false | ||
} | ||
|
||
build.finalizedBy(tasks.publishToMavenLocal) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
systemProp.archiva.url=xxx | ||
systemProp.archiva.user=xx | ||
systemProp.archiva.username=xx | ||
systemProp.archiva.password=xx | ||
systemProp.nexus.username=xx | ||
systemProp.nexus.password=xx | ||
systemProp.nexus.url=xx |