Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 8 multiple lib upgrades #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.googlecode.jslint4java.ant;

import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.FileNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.googlecode.jslint4java.ant;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between the hamcrest assertThat and the JUnit assertThat?

(apologies I've not been in the Java ecosystem for some time)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


import java.io.ByteArrayOutputStream;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.googlecode.jslint4java.ant;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

import java.io.File;
import java.io.FileInputStream;
Expand Down
2 changes: 1 addition & 1 deletion jslint4java-ant/src/test/resources/antunit/issue6.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function info(str) {
// log somehow
// ...log somehow...
str = 'unused:' + str;
}

Expand Down
42 changes: 26 additions & 16 deletions jslint4java-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,34 @@
<name>jslint4java maven plugin</name>
<description>A plugin for validating JavaScript files using jslint4java.</description>
<prerequisites>
<maven>2.0.6</maven>
<maven>3.1.0</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.4</version>
<version>3.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>1.9.12</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand All @@ -31,27 +47,21 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.16</version>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.0</version>
<version>4.0.0-alpha-1</version>
<scope>test</scope>
</dependency>
<!--
I'd like to depend on the real guava directly. But sisu-guava is in the classpath ahead
of this. And if I enable real guava, there is a failure to look up mojos in my tests.
Really, sisu-guava should be package-renamed. Until then, I have to depend on it.
-->
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guava</artifactId>
<version>0.11.1</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -60,7 +70,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.0</version>
<version>3.9.0</version>
<executions>
<execution>
<id>default-descriptor</id>
Expand Down Expand Up @@ -93,7 +103,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5</version>
<version>3.9.0</version>
</plugin>
</plugins>
</reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.io.IOUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
Expand All @@ -23,7 +24,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Closeables;
import com.googlecode.jslint4java.JSLint;
import com.googlecode.jslint4java.JSLintBuilder;
import com.googlecode.jslint4java.JSLintResult;
Expand Down Expand Up @@ -263,7 +263,7 @@ private JSLintResult lintFile(JSLint jsLint, File file) throws MojoExecutionExce
} catch (IOException e) {
throw new MojoExecutionException("problem whilst linting " + file, e);
} finally {
Closeables.closeQuietly(reader);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the switch to apache commons? I don't mind, I'm just curious.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guava version was removed: google/guava#1118

IOUtils.closeQuietly(reader);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import java.util.Arrays;
import java.util.List;

import com.google.common.io.Closeables;
import com.googlecode.jslint4java.JSLintResult;
import org.apache.commons.io.IOUtils;


/**
* Allow writing the same result to multiple places at once.
Expand All @@ -23,7 +24,7 @@ public MultiReportWriter(ReportWriter... reportWriters) {
/** Close all contained ReportWriters. */
public void close() {
for (ReportWriter reportWriter : reportWriters) {
Closeables.closeQuietly(reportWriter);
IOUtils.closeQuietly(reportWriter);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import java.nio.charset.Charset;

import com.google.common.base.Throwables;
import com.google.common.io.Closeables;
import com.google.common.io.Files;
import com.googlecode.jslint4java.JSLintResult;
import com.googlecode.jslint4java.formatter.JSLintResultFormatter;
import org.apache.commons.io.IOUtils;


/**
* Write a report formatted by a {@link JSLintResultFormatter} to a file. You
Expand Down Expand Up @@ -45,7 +46,7 @@ public void close() {
} catch (IOException e) {
throw Throwables.propagate(e);
} finally {
Closeables.closeQuietly(writer);
IOUtils.closeQuietly(writer);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.googlecode.jslint4java.maven;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.googlecode.jslint4java.maven;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

import java.io.File;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -108,7 +108,7 @@ public void setUp() throws Exception {
super.setUp();
File pom = getResourceFile(POM_XML);
baseDir = pom.getParentFile();
mojo = (JSLintMojo) lookupMojo(GOAL, pom);
mojo = lookupMojo(GOAL, pom);
mojo.setLog(logger);
// We don't care about "use strict" for these tests.
mojo.addOption(Option.SLOPPY, "true");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.googlecode.jslint4java.maven;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;

import java.io.File;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.googlecode.jslint4java.maven;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.MatcherAssert.assertThat;

import java.io.File;
import java.io.IOException;
Expand Down
6 changes: 5 additions & 1 deletion jslint4java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -34,7 +38,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Loading