This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new e372245 SLING-12397 : If multiple scans are configured for an
Analysis, only the result of the last scan is reported Clean up PR
e372245 is described below
commit e372245ffce0f26aec23becb07bfbea87692c407
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Aug 2 07:10:33 2024 +0200
SLING-12397 : If multiple scans are configured for an Analysis, only the
result of the last scan is reported
Clean up PR
---
.../sling/feature/maven/mojos/AbstractFeatureMojo.java | 2 +-
.../sling/feature/maven/mojos/AnalyseFeaturesMojo.java | 13 +++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git
a/src/main/java/org/apache/sling/feature/maven/mojos/AbstractFeatureMojo.java
b/src/main/java/org/apache/sling/feature/maven/mojos/AbstractFeatureMojo.java
index f536aa4..3e35575 100644
---
a/src/main/java/org/apache/sling/feature/maven/mojos/AbstractFeatureMojo.java
+++
b/src/main/java/org/apache/sling/feature/maven/mojos/AbstractFeatureMojo.java
@@ -377,7 +377,7 @@ public abstract class AbstractFeatureMojo extends
AbstractMojo {
.getOrResolveArtifact(project, mavenSession,
artifactHandlerManager, repoSystem, id)
.getFile().toURI().toURL();
} catch (Exception e) {
- getLog().warn("Artifact " + id.toMvnId() + " not found");
+ getLog().debug("Artifact " + id.toMvnId() + " not found");
return null;
}
}
diff --git
a/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
b/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
index e60d670..1cab2fe 100644
---
a/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
+++
b/src/main/java/org/apache/sling/feature/maven/mojos/AnalyseFeaturesMojo.java
@@ -145,17 +145,14 @@ public class AnalyseFeaturesMojo extends
AbstractIncludingFeatureMojo {
}
final AnalyserResult result = analyser.analyse(f,
ProjectHelper.toArtifactId(fwk), featureProvider);
- if (!results.containsKey(f)) {
- results.put(f, new ArrayList<>());
- }
- results.get(f).add(result);
- } catch (Exception t) {
+ results.computeIfAbsent(f, (key) -> new
ArrayList<>()).add(result);
+ } catch (final Exception t) {
throw new MojoFailureException(
"Exception during analysing feature " +
f.getId().toMvnId() + " : " + t.getMessage(),
t);
}
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new MojoExecutionException(
"A fatal error occurred while setting up the analyzer,
see error cause:", e);
} finally {
@@ -167,8 +164,8 @@ public class AnalyseFeaturesMojo extends
AbstractIncludingFeatureMojo {
final Feature f = entry.getKey();
final List<AnalyserResult> result = entry.getValue();
- List<String> warnings = result.stream().flatMap(r ->
r.getWarnings().stream()).collect(Collectors.toList());
- List<String> errors = result.stream().flatMap(r ->
r.getErrors().stream()).collect(Collectors.toList());
+ final List<String> warnings = result.stream().flatMap(r ->
r.getWarnings().stream()).collect(Collectors.toList());
+ final List<String> errors = result.stream().flatMap(r ->
r.getErrors().stream()).collect(Collectors.toList());
if ( (warnings.isEmpty() || !logWarnings) && errors.isEmpty() ) {
getLog().debug(MessageUtils.buffer().a("feature
").project(f.getId().toMvnId())