Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit a0f8fbe

Browse files
authored
Java 11 & Gradle πŸš€ (#106)
* Use java.util.Base64 when encoding basic auth * gradle 5 and java 11 w/ tests working * travis 11 * explicit build * include gradle * update wrapper * use findProperty for user/pass in auth * skip signing unless uploading * fix warnings * remove unnncessary warning suppression * v5.0.0 * add project level gradle.properties * update docs * correction to readme * update license year * move version, other properties to gradle.properties * fix function that was clearly broken according to linter
1 parent e2796fd commit a0f8fbe

21 files changed

+419
-234
lines changed

β€Ž.gitignoreβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ web.properties
88
.classpath
99
src/test/webapp
1010
.idea/
11-
*.iml
11+
*.iml
12+
.gradle/
13+
build/
14+
bin/
15+
.vscode/

β€Ž.travis.ymlβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
language: java
22

33
jdk:
4-
- openjdk8
4+
- openjdk11
5+
6+
script:
7+
- ./gradlew build

β€ŽLICENSEβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (C) 2019 hellosign.com
3+
Copyright (C) 2020 hellosign.com
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

β€ŽREADME.mdβ€Ž

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,31 @@ SDK releases are published to Maven's [Central repository](https://repo1.maven.o
1212
<groupId>com.hellosign</groupId>
1313
<artifactId>hellosign-java-sdk</artifactId>
1414
<version>RELEASE</version>
15-
<classifier>jar-with-dependencies</classifier>
1615
</dependency>
1716
```
1817

18+
Releases can also be consumed using other build tools that support Maven Central.
19+
20+
Gradle for example:
21+
```groovy
22+
repositories {
23+
mavenCentral()
24+
}
25+
26+
dependencies {
27+
compile group: 'com.hellosign', name: 'hellosign-java-sdk', version:'RELEASE'
28+
}
29+
```
30+
1931
Alternatively, you can build the JAR yourself:
2032

21-
mvn clean package
33+
./gradlew jar
34+
35+
or a fatJar with all dependencies if you'd like:
36+
37+
./gradlew fatJar
2238

23-
Place `target/hellosign-java-sdk-<VERSION>.jar` on your project classpath.
39+
Place `build/libs/hellosign-java-sdk-<VERSION>.jar` on your project classpath.
2440

2541
## Usage
2642

@@ -51,7 +67,7 @@ Document doc = new Document();
5167
doc.setFile(new File("/path/to/myfile.pdf")));
5268

5369
FormField textField = new FormField();
54-
textField.setType(FieldType.text);
70+
textField.setType(FieldType.TEXT);
5571
textField.setName("First Name"); // Displayed to the signer as the "Field Label"
5672
textField.setValidationType(ValidationType.letters_only);
5773
textField.setSigner(0); // Signer indexes are zero-based
@@ -124,7 +140,7 @@ if (response.isComplete()) {
124140
```
125141
The MIT License (MIT)
126142
127-
Copyright (C) 2019 hellosign.com
143+
Copyright (C) 2020 hellosign.com
128144
129145
Permission is hereby granted, free of charge, to any person obtaining a copy
130146
of this software and associated documentation files (the "Software"), to deal

β€Žbuild.gradleβ€Ž

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
apply plugin: 'java'
2+
apply plugin: 'maven'
3+
apply plugin: 'signing'
4+
5+
tasks.withType(JavaCompile) {
6+
options.encoding = 'UTF-8'
7+
}
8+
9+
task javadocJar(type: Jar) {
10+
classifier = 'javadoc'
11+
from javadoc
12+
}
13+
14+
task sourcesJar(type: Jar) {
15+
classifier = 'sources'
16+
from sourceSets.main.allSource
17+
}
18+
19+
artifacts {
20+
archives javadocJar, sourcesJar
21+
}
22+
23+
signing {
24+
required { gradle.taskGraph.hasTask("uploadArchives") }
25+
sign configurations.archives
26+
}
27+
28+
uploadArchives {
29+
repositories {
30+
mavenDeployer {
31+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
32+
33+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
34+
authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword'))
35+
}
36+
37+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
38+
authentication(userName: findProperty('ossrhUsername'), password: findProperty('ossrhPassword'))
39+
}
40+
41+
pom.project {
42+
name 'HelloSign'
43+
packaging 'jar'
44+
// optionally artifactId can be defined here
45+
description 'Use the HelloSign Java SDK to connect your Java app to HelloSign\'s service in microseconds!'
46+
url 'https://www.hellosign.com/'
47+
48+
scm {
49+
connection 'scm:git:git://github.com/hellosign/hellosign-java-sdk.git'
50+
developerConnection 'scm:git:git@github.com:hellosign/hellosign-java-sdk.git'
51+
url 'https://github.com/hellosign/hellosign-java-sdk'
52+
}
53+
54+
licenses {
55+
license {
56+
name 'MIT License'
57+
url 'http://www.opensource.org/licenses/mit-license.php'
58+
}
59+
}
60+
61+
developers {
62+
developer {
63+
id 'jspaetzel'
64+
name 'John Spaetzel'
65+
email 'john.spaetzel@hellosign.com'
66+
url 'https://www.hellosign.com'
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
73+
74+
task fatJar(type: Jar) {
75+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
76+
with jar
77+
}
78+
79+
repositories {
80+
mavenCentral()
81+
}
82+
83+
dependencies {
84+
compile group: 'org.json', name: 'json', version:'20190722'
85+
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.30'
86+
testCompile group: 'junit', name: 'junit', version:'4.13'
87+
testCompile group: 'org.slf4j', name: 'slf4j-simple', version:'1.7.30'
88+
testCompile group: 'org.mockito', name: 'mockito-core', version:'2.28.2'
89+
}

β€Žgradle.propertiesβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
group = com.hellosign
2+
archivesBaseName = hellosign-java-sdk
3+
version = 5.0.0
4+
description = HelloSign Java SDK
5+
6+
sourceCompatibility = 11
7+
targetCompatibility = 11
54.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Thu Apr 23 20:28:49 PDT 2020
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
3+
distributionBase=GRADLE_USER_HOME
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

β€Žgradlewβ€Ž

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)