diff --git a/HISTORY.md b/HISTORY.md index a19cb27..4deed73 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,15 @@ # createsend-java history +## v8.0.0 - 4 March 2022 + +* Migrated from deprecated gradle plugin 'Maven' to 'Maven-publish' +* Set sourceComptability to Java 1.9 +* Updated sourceComptability syntax +* Replaced gradle compile dependency with 'implementation' +* Replaced all instances of deprecated ``$buildDir`` with ``layout.buildDirectory`` +* Replaced ``uploadArchives`` with new ``publishing`` method +* Updated ``writePom`` + ## v7.0.1 - 2 December 2022 * Added support for rate limiting errors diff --git a/build.gradle b/build.gradle index f416679..d65298e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' apply plugin: 'eclipse' apply plugin: 'idea' -install.dependsOn ':build' -defaultTasks 'clean', 'install' - -sourceCompatibility = 1.7 -version = '7.0.1' +java { + sourceCompatibility = JavaVersion.VERSION_1_9 +} +version = '8.0.0-SNAPSHOT' group = 'com.createsend' def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath @@ -17,14 +16,14 @@ repositories { } dependencies { - compile group: 'com.sun.jersey', name: 'jersey-client', version: '1.17.1' - compile group: 'com.sun.jersey', name: 'jersey-json', version: '1.17.1' - compile group: 'com.sun.jersey', 'name': 'jersey-core', version: '1.17.1' - compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.2' - compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.10.2' - compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.2' - compile group: 'commons-codec', name: 'commons-codec', version: '1.10' - compile group: 'commons-io', name: 'commons-io', version: '2.7' + implementation group: 'com.sun.jersey', name: 'jersey-client', version: '1.17.1' + implementation group: 'com.sun.jersey', name: 'jersey-json', version: '1.17.1' + implementation group: 'com.sun.jersey', 'name': 'jersey-core', version: '1.17.1' + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.2' + implementation group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.10.2' + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.2' + implementation group: 'commons-codec', name: 'commons-codec', version: '1.10' + implementation group: 'commons-io', name: 'commons-io', version: '2.7' } sourceSets { @@ -44,63 +43,82 @@ sourceSets { } task copyToLib(type: Copy) { - into "$buildDir/libs" - from configurations.runtime + into layout.buildDirectory.dir("libs") + from configurations.runtimeClasspath } task doc(type: Javadoc) { - source = sourceSets.main.allJava - title = "createsend-java $version" - classpath = sourceSets.main.compileClasspath - destinationDir = new File(new File(buildDir, 'doc'), version) - options.version = true + source = sourceSets.main.allJava + title = "createsend-java $version" + classpath = sourceSets.main.compileClasspath + destinationDir = layout.buildDirectory.dir("doc/$version").get().asFile + options.version = true } -uploadArchives { - repositories { - mavenDeployer { - snapshotRepository( - url: 'https://oss.sonatype.org/content/repositories/snapshots', - id: 'sonatype-nexus-snapshots') { - authentication(getAuth('sonatype-nexus-snapshots')) - } - repository( - url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/', - id: 'sonatype-nexus-staging') { - authentication(getAuth('sonatype-nexus-staging')) - } - pom { - project { - name 'createsend-java' - description 'A Java library which implements the complete functionality of the Campaign Monitor API.' - url 'http://campaignmonitor.github.io/createsend-java/' - licenses { - license { - name 'The MIT License' - url 'https://raw.github.com/campaignmonitor/createsend-java/master/LICENSE' - distribution 'repo' +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + pom { + name = 'createsend-java' + description = 'A Java library which implements the complete functionality of the Campaign Monitor API.' + url = 'http://campaignmonitor.github.io/createsend-java/' + licenses { + license { + name = 'The MIT License' + url = 'https://raw.github.com/campaignmonitor/createsend-java/master/LICENSE' + distribution = 'repo' + } + } + withXml { + def pomInclude = new XmlParser().parse(new File("pom-include.xml")) + pomInclude.children().each { child -> + asNode().append(child) + } + } } - } } - withXml { xml -> - new XmlParser().parse(new File("pom-include.xml")).children().each { kid -> xml.asNode().append(kid) } + } + + repositories { + maven { + name = "sonatypeSnapshots" + url = "https://oss.sonatype.org/content/repositories/snapshots" + credentials { + username = getAuth('sonatype-nexus-snapshots').userName ?: "" + password = getAuth('sonatype-nexus-snapshots').password ?: "" + } } - } + + maven { + name = "sonatypeStaging" + url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username = getAuth('sonatype-nexus-staging').userName ?: "" + password = getAuth('sonatype-nexus-staging').password ?: "" + } + } + mavenLocal() } - } } -task writePom << { - uploadArchives.repositories.mavenDeployer().getPom().writeTo("pom.xml") +def getAuth(repo_id) { + def m2_settings = new File("${System.getProperty('user.home')}/.m2/settings.xml") + if (m2_settings.exists()) { + def settings = new XmlSlurper().parse(m2_settings) + def repo = settings.servers.server.find { it.id.text() == repo_id } + if (repo != null) return [userName: repo.username.text(), password: repo.password.text()] + } + [:] } -def getAuth(repo_id) { - def m2_settings = new File("${System.getProperty('user.home')}/.m2/settings.xml") - if (m2_settings.exists()) { - def settings = new XmlSlurper().parse(m2_settings) - def repo = settings.servers.server.find { it.id.text() == repo_id } - if (repo != null) return [userName: repo.username.text(), password: repo.password.text()] - } - [:] +task writePom(dependsOn: generatePomFileForMavenJavaPublication) { + doLast { + copy { + from layout.buildDirectory.file("generated-pom.xml") + into projectDir + rename { String fileName -> "pom.xml" } + } + } } diff --git a/pom.xml b/pom.xml index c0c3d26..a94faff 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,14 @@ - + + + + + + 4.0.0 com.createsend createsend-java - 7.0.2-SNAPSHOT + 8.0.0-SNAPSHOT createsend-java A Java library which implements the complete functionality of the Campaign Monitor API. http://campaignmonitor.github.io/createsend-java/ @@ -14,63 +19,61 @@ repo - com.sun.jersey - jersey-json + jersey-client 1.17.1 - compile + runtime com.sun.jersey - jersey-client + jersey-json 1.17.1 - compile + runtime com.sun.jersey jersey-core 1.17.1 - compile + runtime com.fasterxml.jackson.core jackson-annotations 2.10.2 - compile + runtime com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider 2.10.2 - compile + runtime com.fasterxml.jackson.core jackson-databind - 2.10.5.1 - compile + 2.13.4.2 + runtime commons-codec commons-codec 1.10 + runtime commons-io commons-io 2.7 + runtime - - scm:git:git@github.com:campaignmonitor/createsend-java.git - scm:git:git@github.com:campaignmonitor/createsend-java.git + scm:git:https://github.com/campaignmonitor/createsend-java.git + scm:git:https://github.com/campaignmonitor/createsend-java.git https://github.com/campaignmonitor/createsend-java.git - HEAD - jdennes @@ -83,14 +86,12 @@ tobio85@gmail.com - sonatype-nexus-staging https://oss.sonatype.org/service/local/staging/deploy/maven2/ - src @@ -106,29 +107,16 @@ org.apache.maven.plugins maven-compiler-plugin 2.3 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - false - maven-release-plugin - 2.5.3 + 2.1 deploy - release-sign-artifacts @@ -143,7 +131,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 1.1 install @@ -157,5 +145,4 @@ - diff --git a/src/com/createsend/Clients.java b/src/com/createsend/Clients.java index 69c63e1..2b1e7aa 100644 --- a/src/com/createsend/Clients.java +++ b/src/com/createsend/Clients.java @@ -159,10 +159,10 @@ public PagedResult sentCampaigns( /** * Gets a paged list of campaigns sent by the current client - * @param sentFromDate Campaigns sent on or after the sentFromDate/code> value specified will be returned. + * @param sentFromDate Campaigns sent on or after the sentFromDate value specified will be returned. * Must be in the format YYYY-MM-DD. If not provided, results will go back to the beginning of the client’s history. * Use null for the default - * @param sentToDate Campaigns sent on or before the sentToDate/code> value specified will be returned. + * @param sentToDate Campaigns sent on or before the sentToDate value specified will be returned. * Must be in the format YYYY-MM-DD. If not provided, results will include the most recent sent campaigns. * Use null for the default * @param tags An array of tags to filter sent campaigns.