Skip to content

Commit

Permalink
Drop dependency on Commons IO (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Nov 30, 2022
1 parent b771c33 commit cd86c49
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/stapler/LocalizerMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void execute() throws MojoExecutionException {
throw new Error(e); // impossible
}

for( Resource res : (List<Resource>)project.getResources() ) {
for (Resource res : project.getResources()) {
File dir = new File(res.getDirectory());
processDirectory(dir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class LocalizerProgressMojo extends AbstractMojo {
@Override
public void execute() {
L10nProgress r = new L10nProgress();
for( Resource root : (Collection<Resource>)project.getResources() ) {
for (Resource root : project.getResources()) {
r.parseRecursively(new File(root.getDirectory()));
}
System.out.println(r.toHatena());
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/kohsuke/stapler/TaglibDocMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import com.sun.xml.txw2.TXW;
import com.sun.xml.txw2.output.StreamSerializer;
import org.apache.commons.io.FileUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.execution.MavenSession;
Expand Down Expand Up @@ -58,6 +57,9 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -156,7 +158,7 @@ private void writeTaglibXml() throws MojoExecutionException {
File taglibsXml = new File(project.getBasedir(), "target/taglib.xml");
taglibsXml.getParentFile().mkdirs();
Tags tags = TXW.create(Tags.class,new StreamSerializer(new FileOutputStream(taglibsXml)));
for (Resource res : (List<Resource>) project.getResources()) {
for (Resource res : project.getResources()) {
scanTagLibs(new File(res.getDirectory()),"",tags);
}
tags.commit();
Expand Down Expand Up @@ -195,7 +197,8 @@ private void scanTagLibs(File dir, String uri, Tags tags) throws IOException {
private void parseTagLib(File dir, String uri, Library lib) throws IOException {
getLog().info("Processing "+dir);

List<String> markerFile = FileUtils.readLines(new File(dir, "taglib"));
List<String> markerFile = new ArrayList<>(
Files.readAllLines(dir.toPath().resolve("taglib"), StandardCharsets.UTF_8));
if (markerFile.size() == 0) {
markerFile.add(uri);
}
Expand Down

0 comments on commit cd86c49

Please sign in to comment.