Skip to content

Commit

Permalink
Shade and upgrade Guava
Browse files Browse the repository at this point in the history
Guava regularly bumps its major version and includes method removals in the process of doing so, which fits with Semantic Versioning, but which limits reuse of libraries that externally depend on it. This removes that obstacle by shading/removing Guava as an external dependency, so it can be upgraded locally without affecting others.

Also updates Apache Commons libraries (do not need shading as they have a much longer maintenance cycle), and Slf4J (Does not need shading as it has a very reputable history in terms of backwards compatibility). Logback is only used as a test dependency, so bumping to keep up with latest bug fixes, but no effect on downstream projects.

Fixes one removed method since Guava-18.0 by replacing it with a standard Java Collections API method.

Signed-off-by: Peter Ansell <[email protected]>
  • Loading branch information
ansell committed Aug 7, 2017
1 parent a7f756a commit 86fbd74
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ target/
.classpath
.project
.settings/

dependency-reduced-pom.xml
39 changes: 30 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
<jdkLevel>1.8</jdkLevel>

<commons-io.version>2.5</commons-io.version>
<commons-lang.version>3.4</commons-lang.version>
<commons-lang.version>3.6</commons-lang.version>
<commons-digester.version>3.2</commons-digester.version>
<dwc-api.version>1.17</dwc-api.version>
<freemarker.version>2.3.25-incubating</freemarker.version>
<gbif-common.version>0.35</gbif-common.version>
<gbif-registry-metadata.version>2.59</gbif-registry-metadata.version>
<guava.version>18.0</guava.version>
<guava.version>23.0</guava.version>
<junit.version>4.12</junit.version>
<logback.version>1.1.7</logback.version>
<mockito.version>2.8.9</mockito.version>
<slf4j.version>1.7.21</slf4j.version>
<logback.version>1.2.3</logback.version>
<mockito.version>2.8.47</mockito.version>
<slf4j.version>1.7.25</slf4j.version>
</properties>

<repositories>
Expand All @@ -55,10 +55,31 @@
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<!--
to build jar with all dependencies:
mvn assembly:single
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<artifactSet>
<includes>
<include>com.google.guava:guava</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>org.gbif.dwcaio.shaded.com.google.common</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/gbif/dwca/record/RecordIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.gbif.utils.file.csv.CSVReader;

import java.io.IOException;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;

Expand Down Expand Up @@ -58,7 +59,7 @@ public RecordIterator(ClosableIterator<String[]> recordSource, ArchiveField id,
this.replaceEntities = replaceEntities;
closable = recordSource;
if (closable == null) {
Iterator<String[]> empty = Iterators.emptyIterator();
Iterator<String[]> empty = Collections.emptyIterator();
iter = Iterators.peekingIterator(empty);
} else {
iter = Iterators.peekingIterator(closable);
Expand Down

0 comments on commit 86fbd74

Please sign in to comment.