Merge pull request #1 from apache/feature/TENTACLES-12
TENTACLES-12: Update to latest log4j2 and update dependencies and plugins
diff --git a/.gitignore b/.gitignore
index b2c01ef..6227b0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@
.idea/*
*/.idea
/target/
+*.log
diff --git a/README.md b/README.md
index 04e87f6..0368600 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,10 @@
[![ASF Build Status](https://ci-builds.apache.org/job/Creadur/job/Creadur-Tentacles/badge/icon)](https://ci-builds.apache.org/job/Creadur/job/Creadur-Tentacles/)
[![Travis Build Status](https://app.travis-ci.com/apache/creadur-tentacles.svg?branch=master)](https://app.travis-ci.com/apache/creadur-tentacles)
-# Running
+# Running with at least JDK8
The tool will download all the archives from a staging repo, unpack
-them and create a little report of what is there.
+them and create a little report of what is there.
java -ea -jar apache-tentacles-0.1-SNAPSHOT.jar https://repository.apache.org/content/repositories/orgapacheopenejb-090
diff --git a/pom.xml b/pom.xml
index 8f72cd4..869908e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
<dependency>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
- <version>1.9</version>
+ <version>1.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.rat</groupId>
@@ -47,12 +47,17 @@
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
- <version>2.4.2</version>
+ <version>2.13.1</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>2.17.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
@@ -60,6 +65,11 @@
<version>1.7</version>
</dependency>
<dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.swizzle</groupId>
<artifactId>swizzle-stream</artifactId>
<version>1.6.2</version>
@@ -102,11 +112,12 @@
</mailingList>
</mailingLists>
<build>
- <defaultGoal>clean install</defaultGoal>
+ <defaultGoal>clean versions:display-dependency-updates versions:display-plugin-updates enforcer:display-info install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
@@ -115,6 +126,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
+ <version>3.0.0</version>
<executions>
<execution>
<!-- This checks the bytecode version of the dependencies transitively -->
@@ -127,6 +139,9 @@
<enforceBytecodeVersion>
<maxJdkVersion>${javaVersion}</maxJdkVersion>
</enforceBytecodeVersion>
+ <requireMavenVersion>
+ <version>3.0.5</version>
+ </requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
@@ -136,7 +151,7 @@
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
- <version>1.0-beta-5</version>
+ <version>1.5.1</version>
</dependency>
</dependencies>
</plugin>
diff --git a/src/main/java/org/apache/creadur/tentacles/IOSystem.java b/src/main/java/org/apache/creadur/tentacles/IOSystem.java
index 4232b93..a242892 100644
--- a/src/main/java/org/apache/creadur/tentacles/IOSystem.java
+++ b/src/main/java/org/apache/creadur/tentacles/IOSystem.java
@@ -16,117 +16,109 @@
*/
package org.apache.creadur.tentacles;
-import org.apache.log4j.Logger;
-
+import org.apache.logging.log4j.*;
import java.io.*;
import java.net.URL;
import java.util.zip.ZipInputStream;
-/**
- * @version $Rev$ $Date$
- */
public class IOSystem {
- private static final Logger LOG = Logger.getLogger(IOSystem.class);
+ private static final Logger LOG = LogManager.getLogger(IOSystem.class);
- public String slurp(final File file) throws IOException {
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
- copy(file, out);
- return new String(out.toByteArray());
- }
+ public String slurp(final File file) throws IOException {
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ copy(file, out);
+ return new String(out.toByteArray());
+ }
- public String slurp(final URL url) throws IOException {
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
- copy(url.openStream(), out);
- return new String(out.toByteArray());
- }
+ public String slurp(final URL url) throws IOException {
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ copy(url.openStream(), out);
+ return new String(out.toByteArray());
+ }
- public void writeString(final File file, final String string)
- throws IOException {
- final FileWriter out = new FileWriter(file);
- try {
- final BufferedWriter bufferedWriter = new BufferedWriter(out);
- try {
- bufferedWriter.write(string);
- bufferedWriter.newLine();
- } finally {
- close(bufferedWriter);
- }
- } finally {
- close(out);
- }
- }
+ public void writeString(final File file, final String string) throws IOException {
+ final FileWriter out = new FileWriter(file);
+ try {
+ final BufferedWriter bufferedWriter = new BufferedWriter(out);
+ try {
+ bufferedWriter.write(string);
+ bufferedWriter.newLine();
+ } finally {
+ close(bufferedWriter);
+ }
+ } finally {
+ close(out);
+ }
+ }
- private void copy(final File from, final OutputStream to)
- throws IOException {
- final InputStream read = read(from);
- try {
- copy(read, to);
- } finally {
- close(read);
- }
- }
+ private void copy(final File from, final OutputStream to) throws IOException {
+ final InputStream read = read(from);
+ try {
+ copy(read, to);
+ } finally {
+ close(read);
+ }
+ }
- public void copy(final InputStream from, final File to) throws IOException {
- final OutputStream write = write(to);
- try {
- copy(from, write);
- } finally {
- close(write);
- }
- }
+ public void copy(final InputStream from, final File to) throws IOException {
+ final OutputStream write = write(to);
+ try {
+ copy(from, write);
+ } finally {
+ close(write);
+ }
+ }
- private void copy(final InputStream from, final OutputStream to)
- throws IOException {
- final byte[] buffer = new byte[1024];
- int length = 0;
- while ((length = from.read(buffer)) != -1) {
- to.write(buffer, 0, length);
- }
- to.flush();
- }
+ private void copy(final InputStream from, final OutputStream to) throws IOException {
+ final byte[] buffer = new byte[1024];
+ int length = 0;
+ while ((length = from.read(buffer)) != -1) {
+ to.write(buffer, 0, length);
+ }
+ to.flush();
+ }
- public void copy(final byte[] from, final File to) throws IOException {
- copy(new ByteArrayInputStream(from), to);
- }
+ public void copy(final byte[] from, final File to) throws IOException {
+ copy(new ByteArrayInputStream(from), to);
+ }
- public ZipInputStream unzip(final File file) throws IOException {
- final InputStream read = read(file);
- return new ZipInputStream(read);
- }
+ public ZipInputStream unzip(final File file) throws IOException {
+ final InputStream read = read(file);
+ return new ZipInputStream(read);
+ }
- public void close(final Closeable closeable) throws IOException {
- if (closeable == null) {
- return;
- }
- try {
- if (closeable instanceof Flushable) {
- ((Flushable) closeable).flush();
- }
- } catch (final IOException e) {
- LOG.trace("Error when trying to flush before closing " + closeable, e);
- }
- try {
- closeable.close();
- } catch (final IOException e) {
- LOG.trace("Error when trying to close " + closeable, e);
- }
- }
+ public void close(final Closeable closeable) throws IOException {
+ if (closeable == null) {
+ return;
+ }
+ try {
+ if (closeable instanceof Flushable) {
+ ((Flushable) closeable).flush();
+ }
+ } catch (final IOException e) {
+ LOG.trace("Error when trying to flush before closing " + closeable, e);
+ }
+ try {
+ closeable.close();
+ } catch (final IOException e) {
+ LOG.trace("Error when trying to close " + closeable, e);
+ }
+ }
- public OutputStream write(final File destination)
- throws FileNotFoundException {
- final OutputStream out = new FileOutputStream(destination);
- return new BufferedOutputStream(out, 32768);
- }
+ public OutputStream write(final File destination) throws FileNotFoundException {
+ final OutputStream out = new FileOutputStream(destination);
+ return new BufferedOutputStream(out, 32768);
+ }
- public InputStream read(final File source) throws FileNotFoundException {
- final InputStream in = new FileInputStream(source);
- return new BufferedInputStream(in, 32768);
- }
+ public InputStream read(final File source) throws FileNotFoundException {
+ final InputStream in = new FileInputStream(source);
+ return new BufferedInputStream(in, 32768);
+ }
- public byte[] read(final InputStream in) throws IOException {
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
- copy(in, out);
- out.close();
- return out.toByteArray();
- }
+ public byte[] read(final InputStream in) throws IOException {
+ final ByteArrayOutputStream out = new ByteArrayOutputStream();
+ copy(in, out);
+ out.close();
+ return out.toByteArray();
+ }
}
diff --git a/src/main/java/org/apache/creadur/tentacles/Main.java b/src/main/java/org/apache/creadur/tentacles/Main.java
index 0fa4844..6d3a739 100644
--- a/src/main/java/org/apache/creadur/tentacles/Main.java
+++ b/src/main/java/org/apache/creadur/tentacles/Main.java
@@ -34,25 +34,20 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
+import org.apache.logging.log4j.*;
-/**
- * @version $Rev$ $Date$
- */
public class Main {
static {
- final Logger root = Logger.getRootLogger();
-
+/* TENTACLES-12: disabled root logger configuration
+ final Logger root = LogManager.getRootLogger();
root.addAppender(new ConsoleAppender(new PatternLayout(
PatternLayout.TTCC_CONVERSION_PATTERN)));
root.setLevel(Level.INFO);
+ */
}
- private static final Logger log = Logger.getLogger(Main.class);
+ private static final Logger log = LogManager.getLogger(Main.class);
private static final String CRAWL_PATTERN = ".*\\.(jar|zip|war|ear|rar|tar.gz)";
private final Reports reports;
diff --git a/src/main/java/org/apache/creadur/tentacles/NexusClient.java b/src/main/java/org/apache/creadur/tentacles/NexusClient.java
index 87683cf..e0d19de 100644
--- a/src/main/java/org/apache/creadur/tentacles/NexusClient.java
+++ b/src/main/java/org/apache/creadur/tentacles/NexusClient.java
@@ -24,7 +24,7 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.*;
import org.codehaus.swizzle.stream.StreamLexer;
import java.io.File;
@@ -36,7 +36,7 @@
public class NexusClient {
- private static final Logger log = Logger.getLogger(NexusClient.class);
+ private static final Logger log = LogManager.getLogger(NexusClient.class);
private static final String SLASH = "/";
private static final String ONE_UP = "../";
private static final String USER_AGENT_CONTENTS = "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13";
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..d2a6c7a
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="WARN">
+ <Appenders>
+ <Console name="Console" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="Console"/>
+ </Root>
+ </Loggers>
+</Configuration>
+