From 7fd4cf510e6a643882ce408b7572027016a48a01 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Wed, 22 Apr 2015 15:20:56 -0400 Subject: [PATCH 01/12] Added publishing to Maven repository. --- build.gradle | 146 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 128 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index c447072..918e6f0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, The MITRE Corporation. All rights reserved. + * Copyright (c) 2015, The MITRE Corporation. All rights reserved. * See LICENSE for complete terms. * * Java-TAXII Gradle Buildscript @@ -10,19 +10,26 @@ * * gradle * - * from the commnand-line. + * from the commnand-line will default to "gradle jar". * * Jar will be built to * * build/libs/java-taxii-${version}.jar */ -defaultTasks 'test' - apply plugin: 'java' apply plugin: 'eclipse' +apply plugin: 'maven' +apply plugin: 'signing' + +defaultTasks 'jar' -version = 1.1 +version = "1.1-SNAPSHOT" +group = "org.mitre.taxii" +archivesBaseName = "taxii" + +def isReleaseVersion = !version.endsWith("SNAPSHOT") +def taxiiSchemaVersion = "1.0 & 1.1" String srcGeneratedDir = 'src/generated' String srcGeneratedJavaDir = srcGeneratedDir + '/java' @@ -88,27 +95,27 @@ task retrieveSchemas << { println "Retrieving TAXII schemas from reference sources." ant.mkdir(dir:schemasDir) -/* - * TODO: - * As of this writing, the official schemas on the TAXII web site do not include the Schematron rules, so - * get the schemas from a local directory. Once the official schemas have been modified, the below should be - * pointed at the official schemas. - * - * NOTE: The patch files will ned to be updated once new versions are posted to the web site. - */ + /* + * TODO: + * As of this writing, the official schemas on the TAXII web site do not include the Schematron rules, so + * get the schemas from a local directory. Once the official schemas have been modified, the below should be + * pointed at the official schemas. + * + * NOTE: The patch files will ned to be updated once new versions are posted to the web site. + */ // Get the TAXII 1.1 Schema. def schemaSource = new File(project.rootDir.absolutePath + "/" + "schemas" + "/TAXII_XMLMessageBinding_Schema-1.1-with-sch.xsd") -// URL schemaSource = new URL("https://raw.githubusercontent.com/TAXIIProject/TAXII-Specifications/1.1/TAXII_XMLMessageBinding_Schema.xsd") + // URL schemaSource = new URL("https://raw.githubusercontent.com/TAXIIProject/TAXII-Specifications/1.1/TAXII_XMLMessageBinding_Schema.xsd") File outFile = new File(project.rootDir.absolutePath + "/" + schemasDir + "/TAXII_XMLMessageBinding-1.1.xsd") outFile.write(schemaSource.getText()) // Get the TAXII 1.0 Schema. schemaSource = new File(project.rootDir.absolutePath + "/" + "schemas" + "/TAXII_XMLMessageBinding_Schema-1.0-with-sch.xsd") -// taxiiUrl = new URL("https://raw.githubusercontent.com/TAXIIProject/TAXII-Specifications/1.0/TAXII_XMLMessageBinding_Schema.xsd") + // taxiiUrl = new URL("https://raw.githubusercontent.com/TAXIIProject/TAXII-Specifications/1.0/TAXII_XMLMessageBinding_Schema.xsd") outFile = new File(project.rootDir.absolutePath + "/" + schemasDir + "/TAXII_XMLMessageBinding-1.0.xsd") outFile.write(schemaSource.getText()) -// TODO: The following two schemas are already in a form we can pull from their web site. + // TODO: The following two schemas are already in a form we can pull from their web site. // Get the DefaultQuery Schema. schemaSource = new URL("https://raw.githubusercontent.com/TAXIIProject/TAXII-Specifications/1.1/TAXII_DefaultQuery_Schema.xsd") @@ -158,7 +165,7 @@ task generate << { ant.mkdir(dir: srcGeneratedJavaDir) ant.xjc(destdir: srcGeneratedJavaDir, header: false, readonly: true, - extension: true, classpath: configurations.xjc.asPath) { + extension: true, classpath: configurations.xjc.asPath) { arg(line: '-Xequals -XhashCode -Xfluent-api -Xvalue-constructor -Xdefault-value -Xnamespace-prefix') binding(dir: bindingDir, includes: '*.xjb') @@ -171,14 +178,117 @@ task cleanGenerated << { ant.delete(dir: srcGeneratedDir) } +jar { + manifest { + attributes 'Specification-Title': 'Trusted Automated Exchange of Indicator Information (TAXII)', + 'Specification-Version': '1.0 & 1.1', + 'Implementation-Title': 'Java-TAXII', + 'Implementation-Version': version, + 'Implementation-Vendor': 'The MITRE Corporation' + } + from 'LICENSE' +} + +if (JavaVersion.current().isJava8Compatible()) { + tasks.withType(Javadoc) { + // disable strict doclint in Java 8 + options.addStringOption('Xdoclint:none', '-quiet') + } +} + javadoc { options.overview = "src/main/java/overview.html" + options.showAll() + options.encoding("UTF-8") + options.setUse(true) + options.author(true) + options.version(true) + options.windowTitle("java-taxii v." + version) + options.docTitle("java-taxii v." + version) + options.footer("Copyright (c) 2015, The MITRE Corporation. All rights reserved.") + + doFirst { + javadoc.title = "java-taxii v." + version + javadoc.options.docTitle = javadoc.title + } +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from 'LICENSE' + from javadoc +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from 'LICENSE' + from 'README.md' + from sourceSets.main.allSource +} + +artifacts { + archives jar, sourcesJar, javadocJar +} + +signing { + sign configurations.archives +} + +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> + signing.signPom(deployment) + } + +// repository(url: "file://${project.projectDir}/build/artifacts/") { + repository(url: "https://oss.sonatype.org/service/local/staging/deployment/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + +// snapshotRepository(url: "file://${project.projectDir}/build/artifacts/snapshots/") { + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { + name 'taxii' + packaging 'jar' + // version "${project.version}" - version handled automatically. + // optionally artifactId can be defined here + description "The JAXB Bindings for TAXII v." + version + url "https://github.com/TAXIIProject/java-taxii" + + scm { + connection "https://github.com/TAXIIProject/java-taxii.git" + developerConnection "https://github.com/TAXIIProject/java-taxii.git" + url "https://github.com/TAXIIProject/" + } + + licenses { + license { + name "The BSD 3-Clause License" + url "https://raw.githubusercontent.com/TAXIIProject/java-taxii/master/LICENSE.txt" + } + } + + developers { + developer { + id 'taxii' + name 'TAXII Team' + email 'taxii[ASCII character number 64]mitre.org' + } + } + } // pom.project + + } + } } task dist << { ant.zip(destfile: "build/java-taxii.zip") { fileset(dir: ".", includes: "README.txt, LICENSE.txt") - fileset(dir: "build/libs", includes: "java-taxii-${version}.jar") + fileset(dir: "build/libs", includes: "taxii-${version}.jar") } } From eb5684fb6834fa2ce1ad68b31c3b58ca74a36ef0 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Wed, 22 Apr 2015 16:14:55 -0400 Subject: [PATCH 02/12] Account for maven repository account & password not existing. --- build.gradle | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 918e6f0..968dfeb 100644 --- a/build.gradle +++ b/build.gradle @@ -25,10 +25,11 @@ apply plugin: 'signing' defaultTasks 'jar' version = "1.1-SNAPSHOT" +// version = "0.1" group = "org.mitre.taxii" archivesBaseName = "taxii" -def isReleaseVersion = !version.endsWith("SNAPSHOT") +// def isReleaseVersion = !version.endsWith("SNAPSHOT") def taxiiSchemaVersion = "1.0 & 1.1" String srcGeneratedDir = 'src/generated' @@ -241,15 +242,19 @@ uploadArchives { signing.signPom(deployment) } -// repository(url: "file://${project.projectDir}/build/artifacts/") { - repository(url: "https://oss.sonatype.org/service/local/staging/deployment/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) + if (hasProperty('ossrhUsername') && hasProperty('ossrhPassword')) { + repository(url: "https://oss.sonatype.org/service/local/staging/deployment/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + } else { + repository(url: "file://${project.projectDir}/build/artifacts/") + snapshotRepository(url: "file://${project.projectDir}/build/artifacts/snapshots/") } -// snapshotRepository(url: "file://${project.projectDir}/build/artifacts/snapshots/") { - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } pom.project { name 'taxii' From d55b9c19bd075e34990b99fb3aa025a38504b5f8 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Thu, 30 Apr 2015 09:17:57 -0400 Subject: [PATCH 03/12] Try to keep Travis from trying to sign archives. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8d0548b..5d0406c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,5 @@ jdk: notifications: email: - taxii-commits-list@lists.mitre.org + +script: “gradle test” From 5b93258a2a3c62eaced152e0e54b37aa56ef33be Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Thu, 30 Apr 2015 09:20:42 -0400 Subject: [PATCH 04/12] Don't use fancy quotes. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5d0406c..5e98313 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,4 @@ notifications: email: - taxii-commits-list@lists.mitre.org -script: “gradle test” +script: "gradle test" From 4243be51aa0c3533b5590d60b7670845c4f2d9c3 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Thu, 30 Apr 2015 09:25:36 -0400 Subject: [PATCH 05/12] Another attempt to fix Travis. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5e98313..1849cd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,4 +7,5 @@ notifications: email: - taxii-commits-list@lists.mitre.org -script: "gradle test" +script: + - ./gradle test \ No newline at end of file From 23bf7759f97f2c6a993a3d0732c49a2e9f39e5a7 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Thu, 30 Apr 2015 09:34:20 -0400 Subject: [PATCH 06/12] Another attempt to fix Travis. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1849cd6..8566def 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,8 @@ jdk: - oraclejdk8 - oraclejdk7 +script: gradle test + notifications: email: - taxii-commits-list@lists.mitre.org - -script: - - ./gradle test \ No newline at end of file From 01141b090d343a8269e023d4cb5804a165b4aba7 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Thu, 30 Apr 2015 09:43:02 -0400 Subject: [PATCH 07/12] Another attempt to fix Travis. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8566def..527deff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ jdk: - oraclejdk8 - oraclejdk7 +install: /bin/true script: gradle test notifications: From a4dbef5fa0a2e476d6456ea853a79919c6874b01 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Thu, 30 Apr 2015 09:53:24 -0400 Subject: [PATCH 08/12] Another attempt to fix Travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 527deff..bdc5e51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ jdk: - oraclejdk7 install: /bin/true -script: gradle test +script: "gradle test" notifications: email: From d3636bfcc5eab80821024db1a9512b0588dfe414 Mon Sep 17 00:00:00 2001 From: Jasen Jacobsen Date: Mon, 11 May 2015 13:09:54 -0400 Subject: [PATCH 09/12] Update README.md Add Travis status badge. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92e0f62..2dc25fc 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ A Java library for handling TAXII Messages and invoking TAXII Services. For more information, see http://taxii.mitre.org/. +[![Build Status](https://travis-ci.org/TAXIIProject/java-taxii.svg)](https://travis-ci.org/TAXIIProject/java-taxii) + + ## Overview A primary goal of java-taxii is to remain faithful to both the TAXII @@ -54,4 +57,4 @@ systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost You are encouraged to provide feedback by commenting on open issues or signing up for the [TAXII discussion list](http://taxii.mitre.org/community/registration.html) -and posting your questions. \ No newline at end of file +and posting your questions. From 8841ba348628517700df6c0117592235b5959f7e Mon Sep 17 00:00:00 2001 From: Jasen Jacobsen Date: Mon, 11 May 2015 13:30:38 -0400 Subject: [PATCH 10/12] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 2dc25fc..d3ee436 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ A Java library for handling TAXII Messages and invoking TAXII Services. For more information, see http://taxii.mitre.org/. -[![Build Status](https://travis-ci.org/TAXIIProject/java-taxii.svg)](https://travis-ci.org/TAXIIProject/java-taxii) - +[![Build Status](https://travis-ci.org/TAXIIProject/java-taxii.svg?branch=master)](https://travis-ci.org/TAXIIProject/java-taxii) ## Overview From 3b27754505e8b8b65ac150ca04bc881212b765a1 Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Tue, 12 May 2015 09:08:57 -0400 Subject: [PATCH 11/12] Handle project properties a bit better. --- build.gradle | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 968dfeb..bc1319a 100644 --- a/build.gradle +++ b/build.gradle @@ -235,20 +235,25 @@ signing { sign configurations.archives } + uploadArchives { + repositories { mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - if (hasProperty('ossrhUsername') && hasProperty('ossrhPassword')) { + + def username = project.hasProperty('ossrhUsername') ? ossrhUsername : false + def password = project.hasProperty('ossrhPassword') ? ossrhPassword : false + + if (username && password) { repository(url: "https://oss.sonatype.org/service/local/staging/deployment/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) + authentication(userName: username, password: password) } snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) + authentication(userName: username, password: password) } } else { repository(url: "file://${project.projectDir}/build/artifacts/") From 61d4109f9dacb239e35dcfab285c8554b03432dc Mon Sep 17 00:00:00 2001 From: jasenj1 Date: Tue, 12 May 2015 09:18:44 -0400 Subject: [PATCH 12/12] Added a comment. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bdc5e51..1ab27d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ jdk: - oraclejdk8 - oraclejdk7 -install: /bin/true +install: /bin/true # this keeps 'gradle assemble' from being called which tries to sign the jars. script: "gradle test" notifications: