-
Notifications
You must be signed in to change notification settings - Fork 17
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 #112 from nsacyber/maven-conf
Configure deployment to maven central
- Loading branch information
Showing
23 changed files
with
368 additions
and
136 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 |
---|---|---|
|
@@ -9,8 +9,6 @@ allprojects { | |
} | ||
|
||
tasks.withType(Test) { | ||
useTestNG() { | ||
} | ||
afterSuite { desc, result -> | ||
if (desc.parent == null) { | ||
logger.lifecycle("${result.successfulTestCount}/${result.testCount} tests passed") | ||
|
@@ -22,15 +20,15 @@ allprojects { | |
// here to ensure that all projects are using the same versions of common | ||
// dependencies: | ||
ext.libs = [ | ||
bouncycastle: ['org.bouncycastle:bcpkix-jdk15on:1.55', // Bouncy Castle license | ||
'org.bouncycastle:bcprov-ext-jdk15on:1.55'], | ||
jackson: ['com.fasterxml.jackson.core:jackson-core:2.9.4', // Apache 2.0 | ||
'com.fasterxml.jackson.core:jackson-annotations:2.9.4', | ||
'com.fasterxml.jackson.core:jackson-databind:2.9.4'], | ||
jcommander: 'com.beust:jcommander:1.72', // cli and required by testng, Apache 2.0 | ||
powermock: ['org.powermock:powermock-module-testng:1.6.5', // Apache 2.0 | ||
'org.powermock:powermock-api-mockito:1.6.5'], | ||
testng: 'org.testng:testng:6.13.1', // Apache 2.0 | ||
bouncycastle: ['org.bouncycastle:bcpkix-jdk15on:1.67', // Bouncy Castle license | ||
'org.bouncycastle:bcprov-ext-jdk15on:1.67'], | ||
jackson: ['com.fasterxml.jackson.core:jackson-core:2.15.2', // Apache 2.0 | ||
'com.fasterxml.jackson.core:jackson-annotations:2.15.2', | ||
'com.fasterxml.jackson.core:jackson-databind:2.15.2'], | ||
jcommander: 'com.beust:jcommander:1.72', // Apache 2.0 | ||
junit: 'junit:junit:4.13.2', // EPL 1.0 | ||
powermock: ['org.powermock:powermock-module-junit4:1.6.5', // Apache 2.0 | ||
'org.powermock:powermock-api-mockito:1.6.5'] | ||
] | ||
} | ||
|
||
|
@@ -55,6 +53,8 @@ apply plugin: 'eclipse' | |
apply plugin: 'java' | ||
apply plugin: 'application' | ||
apply plugin: 'nebula.ospackage' | ||
apply plugin: 'maven' | ||
apply plugin: 'signing' | ||
|
||
ext.refsDir = new File(projectDir, 'refs') | ||
|
||
|
@@ -65,10 +65,84 @@ dependencies { | |
implementation libs.jackson | ||
implementation libs.jcommander | ||
|
||
testImplementation libs.testng | ||
testImplementation libs.junit | ||
testImplementation libs.powermock | ||
} | ||
|
||
// Maven packaging and signing | ||
group = 'io.github.nsacyber.paccor' | ||
version = '1.1.4r11' | ||
project.gradle.taskGraph.whenReady { graph -> | ||
project.tasks.findAll().forEach { task -> | ||
if (task.name.contains("signArchives") || task.name.contains("uploadArchives")) { | ||
// If this is set to true, the signing and maven | ||
// properties in gradle.properties must be set. | ||
task.enabled = false | ||
} | ||
} | ||
} | ||
task javadocJar(type: Jar) { | ||
classifier = 'javadoc' | ||
from javadoc | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
artifacts { | ||
archives javadocJar, sourcesJar | ||
} | ||
|
||
signing { | ||
sign configurations.archives | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
pom.project { | ||
name 'paccor' | ||
packaging 'jar' | ||
// optionally artifactId can be defined here | ||
description 'The Platform Attribute Certificate Creator can gather component details, create, sign, and validate the TCG-defined Platform Credential. #nsacyber' | ||
url 'https://github.com/nsacyber/paccor' | ||
|
||
scm { | ||
connection 'scm:git:git://github.com:nsacyber/paccor.git' | ||
developerConnection 'scm:git:git://github.com:nsacyber/paccor.git' | ||
url 'https://github.com/nsacyber/paccor' | ||
} | ||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id 'iadgovuser29' | ||
name 'iadgovuser29' | ||
email '[email protected]' | ||
organization 'NSA Cybersecurity Directorate' | ||
organizationUrl 'https://github.com/nsacyber' | ||
} | ||
} | ||
} | ||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
|
||
repository(url: "https://${sonatypeDomain}/service/local/staging/deploy/maven2/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
snapshotRepository(url: "https://${sonatypeDomain}/content/repositories/snapshots/") { | ||
authentication(userName: ossrhUsername, password: ossrhPassword) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Application packaging into a zip file | ||
def createScript(project, mainClass, name) { | ||
project.tasks.create(name: name, type: CreateStartScripts) { | ||
|
@@ -116,7 +190,7 @@ ospackage { | |
packageName='paccor' | ||
os=LINUX | ||
version='1.1.4' | ||
release='8' | ||
release='11' | ||
|
||
into '/opt/paccor' | ||
user 'root' | ||
|
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
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
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
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
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
Oops, something went wrong.