1 import static org.gradle.api.JavaVersion.VERSION_1_7 2 3 apply plugin: 'java' 4 apply plugin: 'maven' 5 apply plugin: 'signing' 6 7 sourceCompatibility = VERSION_1_7 8 targetCompatibility = VERSION_1_7 9 archivesBaseName = "java-hamcrest" 10 11 group = "org.hamcrest" 12 version = "2.0.0.0" 13 14 15 repositories { 16 mavenCentral() 17 } 18 19 dependencies { 20 testCompile(group: 'junit', name: 'junit', version: '4.12') { 21 transitive = false 22 } 23 } 24 25 sourceSets { 26 main { 27 java { 28 srcDirs 'hamcrest-core/src/main/java', 'hamcrest-library/src/main/java' 29 } 30 31 } 32 test { 33 java { 34 srcDirs 'hamcrest-core/src/test/java', 'hamcrest-library/src/test/java' 35 } 36 } 37 } 38 39 jar { 40 manifest { 41 attributes 'Implementation-Title': 'hamcrest-all', 42 'Implementation-Vendor': 'hamcrest.org', 43 'Implementation-Version': version 44 } 45 } 46 47 task sourcesJar(type: Jar) { 48 classifier = 'sources' 49 from sourceSets.main.allSource 50 } 51 52 task javadocJar(type: Jar) { 53 classifier = 'javadoc' 54 from javadoc 55 } 56 57 artifacts { 58 archives sourcesJar, javadocJar 59 } 60 61 signing { 62 required { gradle.taskGraph.hasTask("uploadArchives") } 63 sign configurations.archives 64 } 65 66 uploadArchives { 67 if (hasProperty('ossrhUsername') && hasProperty('ossrhPassword')) { 68 repositories { 69 mavenDeployer { 70 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 71 72 repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { 73 authentication(userName: ossrhUsername, password: ossrhPassword) 74 } 75 76 snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { 77 authentication(userName: ossrhUsername, password: ossrhPassword) 78 } 79 80 pom.project { 81 name 'Java Hamcrest' 82 packaging 'jar' 83 description 'Hamcrest matcher library for Java' 84 url 'http://hamcrest.org/JavaHamcrest/' 85 86 scm { 87 connection 'git (a] github.com:hamcrest/JavaHamcrest.git' 88 url 'https://github.com/hamcrest/JavaHamcrest' 89 } 90 91 licenses { 92 license { 93 name 'BSD Licence 3' 94 url 'http://opensource.org/licenses/BSD-3-Clause' 95 } 96 } 97 98 developers { 99 developer { 100 id 'joewalnes' 101 name 'Joe Walnes' 102 } 103 developer { 104 id 'npryce' 105 name 'Nat Pryce' 106 } 107 developer { 108 id 'sf105' 109 name 'Steve Freeman' 110 } 111 } 112 } 113 } 114 } 115 } 116 } 117