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

WHISKER-18: Migrate to log4j2 #215

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 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
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
# Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
#
# Java 17 disabled, because we are running into https://bugs.openjdk.java.net/browse/JDK-8270866
java: [8, 11, 16, 21]
java: [8, 11, 17, 21]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand All @@ -59,7 +59,7 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: ./mvnw -e -B -V -ntp clean package site
run: ./mvnw -e -B -V -ntp clean install site

# as of 20220505: Invalid workflow file
# The workflow is not valid. .github/workflows/maven.yml (Line: 55, Col: 1): Unexpected value 'notifications'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum LicenseConfiguration {
/**
* Default to include source URLs.
*/
public static LicenseConfiguration DEFAULT_LICENSE_CONFIGURATION = INCLUDE_SOURCE_URLS;
public static final LicenseConfiguration DEFAULT_LICENSE_CONFIGURATION = INCLUDE_SOURCE_URLS;

/**
* Replaces null with DEFAULT_LICENSE_CONFIGURATION.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,8 @@ public boolean equals(final Object obj) {
return false;
}
if (resource == null) {
if (other.resource != null) {
return false;
}
} else if (!resource.equals(other.resource)) {
return false;
}
return true;
return other.resource == null;
} else return resource.equals(other.resource);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public WriteResultsIntoDirectoryFactory(
public Writer writerFor(final Result result)
throws IOException {
return new BufferedWriter(
new FileWriterWithEncoding(
result.within(directory), encoding));
FileWriterWithEncoding.builder()
.setFile(result.within(directory))
.setCharset(encoding)
.get());
}
}
4 changes: 2 additions & 2 deletions apache-whisker-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public Whisker configure(final String[] args) throws ParseException {
*/
private Whisker configure(
final CommandLine commandLine) throws MissingOptionException {
whisker.setEngine(new VelocityEngine(new SystemLog()));
whisker.setEngine(new VelocityEngine());
whisker.setSource(CommandLineOption.SOURCE.getOptionValue(commandLine));
whisker.setLicenseDescriptor(
new StreamableResourceFactory().streamFromResource(
Expand Down

This file was deleted.

13 changes: 11 additions & 2 deletions apache-whisker-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -127,6 +135,7 @@
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<goal>-X</goal>

Choose a reason for hiding this comment

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

Sorry. this should be in the goals section around line 151

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Claudenw Unfortunately changing line 151 to

-              <goal>run</goal>
+              <goal>-X run</goal>

does not work and fails the build :(

Copy link
Contributor Author

@ottlinger ottlinger Dec 29, 2024

Choose a reason for hiding this comment

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

Unfortunately adding invoker properties does not solve the problem as the build.log's contents is not shown in the console/logs :(

<addTestClassPath>true</addTestClassPath>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static org.apache.creadur.whisker.it.Helpers.*

results = results();
results = results()

if (noticeIsMissing(basedir)) {
results.fail("NOTICE is missing")
Expand All @@ -29,7 +29,7 @@ if (licenseIsMissing(basedir)) {
}

if (results.hasFailed()) {
return results.report();
return results.report()
} else {
license = licenseIn(basedir)
license.expectThat(aLineContainsCDDL1())
Expand Down
4 changes: 2 additions & 2 deletions apache-whisker-maven-plugin/src/it/in-5/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
assert !new File(basedir, "target/NOTICE").exists()

def license = new File(basedir, "target/LICENSE")
assert license.exists()
assert license.exists()

def reader = new BufferedReader(new InputStreamReader(new FileInputStream(license), "UTF-8"))

Expand Down Expand Up @@ -90,4 +90,4 @@ assert !six
assert seven
assert eight

return true;
return true
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ assert alv2
assert substituted
assert thirdParty

return true;
return true
6 changes: 3 additions & 3 deletions apache-whisker-maven-plugin/src/it/minimal/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

File license = new File(basedir, "target/LICENSE");
File notice = new File(basedir, "target/NOTICE");
File license = new File(basedir, "target/LICENSE")
File notice = new File(basedir, "target/NOTICE")

assert license.exists()
assert !notice.exists()
Expand All @@ -37,4 +37,4 @@ while (line != null) {
assert copyright


return true;
return true
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ assert dependent
assert resource


return true;
return true
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ assert apache
assert foundation


return true;
return true
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ assert apache
assert group


return true;
return true
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ assert apache
assert samSmith


return true;
return true
Loading
Loading