ppkarwasz commented on code in PR #134:
URL:
https://github.com/apache/logging-log4j-transform/pull/134#discussion_r1801793050
##########
log4j-transform-maven-plugin/src/main/java/org/apache/logging/log4j/transform/maven/LocationMojo.java:
##########
@@ -189,11 +192,17 @@ private WrappedIOException(IOException cause) {
}
}
- private void validateLog4jVersion() throws MojoExecutionException {
- Artifact log4jApi = project.getArtifacts().stream()
+ private boolean validateLog4jVersion() throws MojoExecutionException {
Review Comment:
This method should probably either throw or return a `boolean`. Can you
replace the `throw` statements with log + return?
##########
log4j-transform-maven-plugin/src/main/java/org/apache/logging/log4j/transform/maven/LocationMojo.java:
##########
@@ -189,11 +192,17 @@ private WrappedIOException(IOException cause) {
}
}
- private void validateLog4jVersion() throws MojoExecutionException {
- Artifact log4jApi = project.getArtifacts().stream()
+ private boolean validateLog4jVersion() throws MojoExecutionException {
+ Optional<Artifact> artifact = project.getArtifacts().stream()
.filter(a -> LOG4J_GROUP_ID.equals(a.getGroupId()) &&
LOG4J_API_ARTIFACT_ID.equals(a.getArtifactId()))
- .findAny()
- .orElseThrow(() -> new MojoExecutionException("Missing
`log4j-api` dependency."));
+ .findAny();
+ Artifact log4jApi;
+ if (artifact.isPresent()) {
+ log4jApi = artifact.get();
+ } else {
+ getLog().info("Skipping project. Log4j is not being used.");
Review Comment:
I would call it "Log4j API" instead of "Log4j", so users don't think it only
works with "Log4j Core".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]