You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2020/06/03 10:00:22 UTC

[jackrabbit-filevault-package-maven-plugin] branch feature/report created (now ae6294b)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch feature/report
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git.


      at ae6294b  WIP for dedicated reporting mojo

This branch includes the following new commits:

     new 0a79e0b  Merge branch 'feature/JCRVLT-370_enhanced-filters-for-embeds' into trunk
     new db71b0a  trivial: fix prerequisites for building
     new ae6294b  WIP for dedicated reporting mojo

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[jackrabbit-filevault-package-maven-plugin] 01/03: Merge branch 'feature/JCRVLT-370_enhanced-filters-for-embeds' into trunk

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/report
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git

commit 0a79e0b40b4f1ec41cf87b697e20e95a002badcf
Merge: 5b7f189 99e677f
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Oct 24 08:05:15 2019 +0000

    Merge branch 'feature/JCRVLT-370_enhanced-filters-for-embeds' into trunk
    
    git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk@1868852 13f79535-47bb-0310-9956-ffa450edef68

 .../maven/packaging/GenerateMetadataMojo.java      | 132 ++++++++++++++-------
 .../filevault/maven/packaging/SimpleEmbedded.java  |  14 +++
 .../maven/packaging/GenerateMetadataMojoTest.java  |  30 ++++-
 3 files changed, 129 insertions(+), 47 deletions(-)



[jackrabbit-filevault-package-maven-plugin] 03/03: WIP for dedicated reporting mojo

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/report
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git

commit ae6294b209e3fdf2a65a83212d8f290d56e22e03
Author: Konrad Windszus <ko...@netcentric.biz>
AuthorDate: Fri Oct 25 12:32:29 2019 +0200

    WIP for dedicated reporting mojo
---
 pom.xml                                            | 205 ++++++++++++---------
 .../maven/packaging/AbstractValidateMojo.java      | 163 +++++++++++++++-
 .../maven/packaging/GenerateMetadataMojo.java      |  22 +--
 .../packaging/MavenBasedPackageDependency.java     |   1 +
 .../maven/packaging/SessionEndHookTrigger.java     |  53 ++++++
 .../maven/packaging/ValidateFilesMojo.java         |  54 +-----
 .../maven/packaging/ValidateReportMojo.java        | 149 +++++++++++++++
 .../maven/packaging/ValidationHelper.java          | 143 +++++++++-----
 8 files changed, 595 insertions(+), 195 deletions(-)

diff --git a/pom.xml b/pom.xml
index 67adefb..fc70f65 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,34 +1,35 @@
 <?xml version="1.0"?>
 <!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements. See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License. You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
     <modelVersion>4.0.0</modelVersion>
     <!-- ====================================================================== -->
-    <!-- P A R E N T  P R O J E C T  D E S C R I P T I O N                      -->
+    <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
     <!-- ====================================================================== -->
     <parent>
         <groupId>org.apache</groupId>
         <artifactId>apache</artifactId>
         <version>21</version>
-        <relativePath />
+        <relativePath/>
     </parent>
 
     <!-- ====================================================================== -->
-    <!-- P R O J E C T  D E S C R I P T I O N                                   -->
+    <!-- P R O J E C T D E S C R I P T I O N -->
     <!-- ====================================================================== -->
     <groupId>org.apache.jackrabbit</groupId>
     <artifactId>filevault-package-maven-plugin</artifactId>
@@ -58,7 +59,7 @@
     </scm>
 
     <!-- ====================================================================== -->
-    <!-- P R O J E C T  I N F O                                                 -->
+    <!-- P R O J E C T I N F O -->
     <!-- ====================================================================== -->
     <licenses>
         <license>
@@ -91,12 +92,12 @@
     </issueManagement>
 
     <!-- ====================================================================== -->
-    <!-- B U I L D   D E F I N I T I O N                                        -->
+    <!-- B U I L D D E F I N I T I O N -->
     <!-- ====================================================================== -->
     <build>
         <plugins>
             <!-- ====================================================================== -->
-            <!-- C O M P I L E R   P L U G I N                                          -->
+            <!-- C O M P I L E R P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -111,7 +112,7 @@
                 </configuration>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- M A V E N   P L U G I N                                                -->
+            <!-- M A V E N P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -132,7 +133,7 @@
                 </executions>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- I N S T A L L   P L U G I N                                            -->
+            <!-- I N S T A L L P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -142,7 +143,7 @@
                         <!--
                             make sure this plugin in installed in the local repository before the integration tests run
                             maybe switching back to a reactor project might be better again
-                         -->
+                        -->
                         <phase>pre-integration-test</phase>
                         <goals>
                             <goal>install</goal>
@@ -151,7 +152,7 @@
                 </executions>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- F A I L S A F E   P L U G I N                                          -->
+            <!-- F A I L S A F E P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -172,7 +173,7 @@
                 </executions>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- S U R E F I R E   P L U G I N                                          -->
+            <!-- S U R E F I R E P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -183,7 +184,7 @@
                 </configuration>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- S I T E   P L U G I N                                                  -->
+            <!-- S I T E P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -208,7 +209,7 @@
                 </dependencies>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- S C M   P U B L I S H   P L U G I N                                    -->
+            <!-- S C M P U B L I S H P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -232,7 +233,7 @@
                 </configuration>
             </plugin>
             <!-- ====================================================================== -->
-            <!-- R A T   P L U G I N                                                    -->
+            <!-- R A T P L U G I N -->
             <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.rat</groupId>
@@ -254,7 +255,7 @@
     </build>
 
     <!-- ====================================================================== -->
-    <!-- R E P O R T I N G                                                      -->
+    <!-- R E P O R T I N G -->
     <!-- ====================================================================== -->
     <reporting>
         <plugins>
@@ -276,7 +277,7 @@
     </reporting>
 
     <!-- ====================================================================== -->
-    <!-- D I S T R I B U T I O N   M A N A G E M E N T                          -->
+    <!-- D I S T R I B U T I O N M A N A G E M E N T -->
     <!-- ====================================================================== -->
     <distributionManagement>
         <site>
@@ -286,7 +287,7 @@
     </distributionManagement>
 
     <!-- ====================================================================== -->
-    <!-- D E P E N D E N C I E S                                                -->
+    <!-- D E P E N D E N C I E S -->
     <!-- ====================================================================== -->
     <dependencies>
         <dependency>
@@ -351,6 +352,24 @@
             <version>${maven.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.maven.reporting</groupId>
+            <artifactId>maven-reporting-api</artifactId>
+            <version>3.0</version>
+        </dependency>
+        <!-- Doxia -->
+        <dependency>
+            <groupId>org.apache.maven.doxia</groupId>
+            <artifactId>doxia-sink-api</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+        <!-- Doxia-sitetools -->
+        <dependency>
+            <groupId>org.apache.maven.doxia</groupId>
+            <artifactId>doxia-site-renderer</artifactId>
+            <version>1.9.1</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-archiver</artifactId>
             <version>3.4.0</version>
@@ -424,9 +443,9 @@
 
         <!-- incremental build support (http://www.eclipse.org/m2e/documentation/m2e-making-maven-plugins-compat.html) -->
         <dependency>
-           <groupId>org.sonatype.plexus</groupId>
-           <artifactId>plexus-build-api</artifactId>
-           <version>0.0.7</version>
+            <groupId>org.sonatype.plexus</groupId>
+            <artifactId>plexus-build-api</artifactId>
+            <version>0.0.7</version>
         </dependency>
 
         <!-- testing -->
@@ -499,7 +518,7 @@
     </dependencies>
 
     <!-- ====================================================================== -->
-    <!-- P R O F I L E S                                                        -->
+    <!-- P R O F I L E S -->
     <!-- ====================================================================== -->
     <profiles>
         <profile>
@@ -507,7 +526,7 @@
             <properties>
                 <username>${user.name}</username>
                 <keyfile>${user.home}/.ssh/id_rsa</keyfile>
-                <passphrase />
+                <passphrase/>
             </properties>
             <build>
                 <plugins>
@@ -538,79 +557,95 @@
                                 <phase>deploy</phase>
                                 <configuration>
                                     <tasks>
-                                        <mkdir dir="${basedir}/target/${project.version}" />
+                                        <mkdir dir="${basedir}/target/${project.version}"/>
                                         <copy todir="${basedir}/target/${project.version}" flatten="true">
                                             <fileset dir="${basedir}">
-                                                <include name="RELEASE-NOTES.md" />
-                                                <include name="target/*-source-release.zip*" />
+                                                <include name="RELEASE-NOTES.md"/>
+                                                <include name="target/*-source-release.zip*"/>
                                             </fileset>
                                         </copy>
                                         <checksum algorithm="MD5" fileext=".md5">
                                             <fileset dir="${basedir}/target/${project.version}">
-                                                <include name="*.zip" />
+                                                <include name="*.zip"/>
                                             </fileset>
                                         </checksum>
                                         <checksum algorithm="SHA-512" fileext=".sha512">
                                             <fileset dir="${basedir}/target/${project.version}">
-                                                <include name="*.zip" />
+                                                <include name="*.zip"/>
                                             </fileset>
                                         </checksum>
                                         <checksum algorithm="SHA" fileext=".sha1">
                                             <fileset dir="${basedir}/target/${project.version}">
-                                                <include name="*.zip" />
+                                                <include name="*.zip"/>
                                             </fileset>
                                         </checksum>
-                                        <checksum file="${basedir}/target/${project.version}/filevault-package-maven-plugin-${project.version}-source-release.zip" algorithm="SHA1" property="checksum" />
+                                        <checksum
+                                            file="${basedir}/target/${project.version}/filevault-package-maven-plugin-${project.version}-source-release.zip"
+                                            algorithm="SHA1" property="checksum"/>
                                         <echo file="${basedir}/target/vote.txt">
-From: ${username}@apache.org
-To: dev@jackrabbit.apache.org
-Subject: [VOTE] Release Apache Jackrabbit Filevault Package Maven Plugin ${project.version}
-
-Hello,
-
-A candidate for the Jackrabbit Filevault Package Maven Plugin ${project.version} release is available at:
-https://dist.apache.org/repos/dist/dev/jackrabbit/filevault-package-maven-plugin/${project.version}/
-
-The release candidate is a zip archive of the sources in:
-https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/tags/filevault-package-maven-plugin-${project.version}/
-
-The SHA1 checksum of the archive is
-${checksum}
-
-The command for running automated checks against this release candidate is:
-$ sh check-release.sh filevault-plugin ${project.version} ${checksum}
-
-A staged Maven repository is available for review at:
-https://repository.apache.org/
-
-Please vote on releasing this package as Apache Jackrabbit Filevault Package Maven Plugin ${project.version}.
-The vote is open for a minimum of 72 hours during business days and passes
-if a majority of at least three +1 Jackrabbit PMC votes are cast.
-The vote fails if not enough votes are cast after 1 week (5 business days).
-
-[ ] +1 Release this package as Apache Jackrabbit Filevault Package Maven Plugin ${project.version}
-[ ] -1 Do not release this package because...${line.separator}
+                                            From: ${username}@apache.org
+                                            To: dev@jackrabbit.apache.org
+                                            Subject: [VOTE] Release
+                                            Apache Jackrabbit Filevault Package Maven Plugin ${project.version}
+
+                                            Hello,
+
+                                            A candidate for the
+                                            Jackrabbit Filevault Package Maven Plugin ${project.version} release is available at:
+                                            https://dist.apache.org/repos/dist/dev/jackrabbit/filevault-package-maven-plugin/${project.version}/
+
+                                            The release candidate is a zip archive of the sources in:
+                                            https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/tags/filevault-package-maven-plugin-${project.version}/
+
+                                            The SHA1 checksum of the archive is
+                                            ${checksum}
+
+                                            The command for running automated checks against
+                                            this release candidate is:
+                                            $ sh check-release.sh filevault-plugin ${project.version} ${checksum}
+
+                                            A staged Maven repository is available for review at:
+                                            https://repository.apache.org/
+
+                                            Please vote
+                                            on releasing this package as Apache Jackrabbit Filevault Package Maven Plugin
+                                            ${project.version}.
+                                            The vote is open for a minimum of 72 hours during business days and passes
+                                            if
+                                            a majority of at least three +1 Jackrabbit PMC votes are cast.
+                                            The vote fails if not enough votes
+                                            are cast after 1 week (5 business days).
+
+                                            [ ] +1 Release this package as Apache Jackrabbit
+                                            Filevault Package Maven Plugin ${project.version}
+                                            [ ] -1 Do not release this package
+                                            because...${line.separator}
                                         </echo>
 
                                         <echo>
-    The release candidate has been prepared in:
+                                            The release candidate has been prepared in:
 
-    ${basedir}/target/${project.version}
+                                            ${basedir}/target/${project.version}
 
-    Please deploy it to
-    https://dist.apache.org/repos/dist/dev/jackrabbit/filevault-package-maven-plugin:
+                                            Please deploy
+                                            it to
+                                            https://dist.apache.org/repos/dist/dev/jackrabbit/filevault-package-maven-plugin:
 
-    cd /path/to/jackrabbit-dev/filevault-package-maven-plugin
-    mv ${basedir}/target/${project.version} ${project.version}
-    svn add ${project.version}
-    svn commit -m 'Apache Jackrabbit Filevault Package Maven Plugin
-    ${project.version} release candidate' ${project.version}
+                                            cd
+                                            /path/to/jackrabbit-dev/filevault-package-maven-plugin
+                                            mv ${basedir}/target/${project.version}
+                                            ${project.version}
+                                            svn add ${project.version}
+                                            svn commit -m 'Apache Jackrabbit Filevault Package
+                                            Maven Plugin
+                                            ${project.version} release candidate' ${project.version}
 
-    A release vote template has been generated for you:
+                                            A release vote template has
+                                            been generated for you:
 
-    file://${basedir}/target/vote.txt
+                                            file://${basedir}/target/vote.txt
                                         </echo>
-                                        <echo />
+                                        <echo/>
                                     </tasks>
                                 </configuration>
                             </execution>
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java
index 018cb95..d7c229f 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java
@@ -16,11 +16,20 @@
  */
 package org.apache.jackrabbit.filevault.maven.packaging;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.stream.Collectors;
 
 import org.apache.commons.lang.StringUtils;
@@ -29,6 +38,7 @@ import org.apache.jackrabbit.vault.fs.api.PathFilterSet;
 import org.apache.jackrabbit.vault.packaging.Dependency;
 import org.apache.jackrabbit.vault.packaging.PackageInfo;
 import org.apache.jackrabbit.vault.validation.ValidationExecutorFactory;
+import org.apache.jackrabbit.vault.validation.ValidationViolation;
 import org.apache.jackrabbit.vault.validation.spi.ValidationMessageSeverity;
 import org.apache.jackrabbit.vault.validation.spi.impl.AdvancedFilterValidatorFactory;
 import org.apache.jackrabbit.vault.validation.spi.impl.DependencyValidatorFactory;
@@ -37,10 +47,22 @@ import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
 import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.lifecycle.LifecycleNotFoundException;
+import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
 import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
@@ -91,6 +113,16 @@ public abstract class AbstractValidateMojo extends AbstractMojo {
     @Parameter(defaultValue = "${session}", readonly = true, required = false)
     protected MavenSession session;
 
+    /** If set to {@code true} will generate a validation report in CSV format at the end of the reactor build */
+    @Parameter(property = "vault.generateValidationReport", defaultValue = "false")
+    protected boolean generateReport;
+
+    /**
+     * If a report is generated (with {@link #generateReport}), it is created in the directory given here.
+     */
+    @Parameter(property = "vault.validationReportDirectory", defaultValue = "${session.executionRootDirectory}/target")
+    protected File reportDirectory;
+
     /** If set to {@code true} will lead to all validation errors or warnings failing the build, otherwise only validation errors lead to a
      * build failure */
     @Parameter(property = "vault.failOnValidationWarning", defaultValue = "false")
@@ -113,6 +145,7 @@ public abstract class AbstractValidateMojo extends AbstractMojo {
      * &lt;dependency&gt;
      *     &lt;groupId&gt;theGroup&lt;/groupId&gt;
      *     &lt;artifactId&gt;theName&lt;/artifactId&gt;
+     *     &lt;classifier&gt;theOptionalClassifier&lt;/classifier&gt;
      * &lt;/dependency&gt;
      * </pre>
      * <p>
@@ -149,16 +182,23 @@ public abstract class AbstractValidateMojo extends AbstractMojo {
     @Component
     protected BuildContext buildContext;
 
+    @Component
+    protected LifecycleExecutor lifecycleExecutor;
+
     protected final ValidationExecutorFactory validationExecutorFactory;
 
-    protected final ValidationHelper validationHelper;
+    protected ValidationHelper validationHelper;
 
     protected DependencyResolver resolver;
 
+    private static final String PLUGIN_KEY = "org.apache.jackrabbit:filevault-package-maven-plugin";
+
+    private static final String CONTEXT_ATTRIBUTE_ALL_VIOLATIONS = "allViolations";
+
     public AbstractValidateMojo() {
         super();
         this.validationExecutorFactory = new ValidationExecutorFactory(this.getClass().getClassLoader());
-        this.validationHelper = new ValidationHelper();
+        
     }
 
     static Map<Dependency, Artifact> resolveMap(Collection<String> mapPackageDependencyToMavenGa) {
@@ -168,8 +208,10 @@ public abstract class AbstractValidateMojo extends AbstractMojo {
                 .peek((p) -> { if(p.length != 2) { throw new IllegalArgumentException("Could not parse value"); } })
                 .collect(Collectors.toMap(a -> Dependency.fromString(a[0]), a -> { String[] mavenGA = a[1].split(":", 2); if(mavenGA.length != 2) { throw new IllegalArgumentException("Could not parse Maven group Id and artifact Id (must be separated by ':')"); } return new DefaultArtifact(mavenGA[0], mavenGA[1], "", "", "", "", null);} ));
     }
+
     @Override 
     public void execute() throws MojoExecutionException, MojoFailureException {
+        this.validationHelper = new ValidationHelper(getSharedViolationsForReport());
         translateLegacyParametersToValidatorParameters();
         final Collection<PackageInfo> resolvedDependencies = new LinkedList<>();
         if (project != null) {
@@ -249,5 +291,122 @@ public abstract class AbstractValidateMojo extends AbstractMojo {
         }
     }
 
+    @SuppressWarnings("unchecked")
+    Collection<ValidationViolation> getSharedViolationsForReport() {
+        if (!generateReport) {
+            return null;
+        }
+        // atomic
+        Collection<ValidationViolation> violations = (Collection<ValidationViolation>) getPluginContext().putIfAbsent(CONTEXT_ATTRIBUTE_ALL_VIOLATIONS,
+                new ConcurrentLinkedDeque<ValidationViolation>());
+        if (violations == null) {
+            violations = (Collection<ValidationViolation>) getPluginContext().get(CONTEXT_ATTRIBUTE_ALL_VIOLATIONS);
+            getLog().warn("Registering shutdown hook to write CSV report");
+            SessionEndHookTrigger.registerShutdownHook(new CsvShutdownHook(violations, reportDirectory));
+        }
+        return violations;
+    }
+
+    // how to get one global context object which is shared among multiple modules of a reactor
+    protected Map getGlobalPluginContext() {
+        return new MavenPluginContext(session);
+    }
+
     public abstract void doExecute() throws MojoExecutionException, MojoFailureException;
+
+    /**
+     * Checks if a certain goal is executed at some point in time in the same Maven Session
+     * @param mojoGoal
+     * @param goals
+     * @return
+     * @throws PluginNotFoundException
+     * @throws PluginResolutionException
+     * @throws PluginDescriptorParsingException
+     * @throws MojoNotFoundException
+     * @throws NoPluginFoundForPrefixException
+     * @throws InvalidPluginDescriptorException
+     * @throws PluginVersionResolutionException
+     * @throws LifecyclePhaseNotFoundException
+     * @throws LifecycleNotFoundException
+     * @throws PluginManagerException
+     * @see <a href=https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java">DefaultLifecycleExecutor</a>
+     */
+    protected boolean isMojoGoalExecuted(String mojoGoal) throws PluginNotFoundException, PluginResolutionException,
+            PluginDescriptorParsingException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+            PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginManagerException {
+        final List<String> allGoals;
+        if (session != null) {
+            allGoals = session.getGoals();
+            getLog().debug("Following goals are detected: " + StringUtils.join(allGoals, ", "));
+        } else {
+            getLog().debug("MavenSession not available. Maybe executed by m2e.");
+            return false;
+        }
+        MavenExecutionPlan executionPlan = lifecycleExecutor.calculateExecutionPlan(session, allGoals.toArray(new String[] {}));
+        for (MojoExecution mojoExecution : executionPlan.getMojoExecutions()) {
+            if (PLUGIN_KEY.equals(mojoExecution.getPlugin().getKey()) && mojoGoal.equals(mojoExecution.getGoal())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static final class CsvShutdownHook implements Runnable {
+        private final Collection<ValidationViolation> violations;
+        private final File baseDir;
+
+        private CsvShutdownHook(Collection<ValidationViolation> violations, File baseDir) {
+            this.violations = violations;
+            this.baseDir = baseDir;
+        }
+
+        @Override
+        public void run() {
+            File csvFile = new File(baseDir,
+                    "validation-report-" + new SimpleDateFormat("yyyy-MM-dd_HHmmss").format(new Date()) + ".csv");
+            try {
+                File parentFolder = csvFile.getParentFile();
+                if (parentFolder != null) {
+                    parentFolder.mkdirs();
+                }
+                try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(csvFile))) {
+                    String csvHeader = "\"Validator ID\",\"Severity\",\"Message\",\"File\",\"Line\",\"Column\",\"Node Path\"";
+                    // tell Excel that we really use a comma as separator
+                    // (http://superuser.com/questions/407082/easiest-way-to-open-csv-with-commas-in-excel)
+                    printWriter.println("sep=,");
+                    printWriter.println(csvHeader);
+    
+                    for (ValidationViolation violation : violations) {
+                        if (violation.getSeverity().ordinal() >= ValidationMessageSeverity.WARN.ordinal()) {
+                            printViolationAsCSVRow(printWriter, violation);
+                        }
+                    }
+                }
+                System.out
+                        .println("Created CSV File '" + csvFile.getAbsolutePath() + "' with " + violations.size() + " violations");
+            } catch (FileNotFoundException e) {
+                throw new IllegalStateException("Could not write CSV File '" + csvFile.getAbsolutePath() + "' with " + violations.size()
+                        + " violations, e=" + e);
+            }
+        }
+
+        private static void printViolationAsCSVRow(PrintWriter writer, ValidationViolation violation) {
+            writer.print(violation.getValidatorId());
+            writer.print(',');
+            writer.print(violation.getSeverity());
+            writer.print(',');
+            writer.print(violation.getMessage());
+            writer.print(',');
+            writer.print(violation.getFilePath());
+            writer.print(',');
+            writer.print(violation.getLine());
+            writer.print(',');
+            writer.print(violation.getColumn());
+            writer.print(',');
+            writer.print(violation.getNodePath());
+            writer.print(',');
+            writer.println();
+        }
+    }
+
 }
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java
index 132e58e..2ad76f4 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java
@@ -94,6 +94,7 @@ import aQute.bnd.osgi.Processor;
         defaultPhase = LifecyclePhase.PROCESS_CLASSES,
         requiresDependencyResolution = ResolutionScope.COMPILE,
         threadSafe = true
+        
 )
 public class GenerateMetadataMojo extends AbstractMetadataPackageMojo {
 
@@ -195,10 +196,9 @@ public class GenerateMetadataMojo extends AbstractMetadataPackageMojo {
     @Parameter
     private final Properties properties = new Properties();
 
-    /**
-     * Defines the list of dependencies
-     * A dependency is declared as a {@code <dependency>} element of a list
-     * style {@code <dependencies>} element:
+    /** Defines the list of dependencies A dependency is declared as a {@code <dependency>} element of a list style {@code <dependencies>}
+     * element:
+     * 
      * <pre>
      * &lt;dependency&gt;
      *     &lt;group&gt;theGroup&lt;/group&gt;
@@ -207,21 +207,19 @@ public class GenerateMetadataMojo extends AbstractMetadataPackageMojo {
      * &lt;/dependency&gt;
      * </pre>
      * <p>
-     * The dependency can also reference a maven project dependency, this is preferred
-     * as it yields to more robust builds.
+     * The dependency can also reference a maven project dependency, this is preferred as it yields to more robust builds.
+     * 
      * <pre>
      * &lt;dependency&gt;
      *     &lt;groupId&gt;theGroup&lt;/groupId&gt;
      *     &lt;artifactId&gt;theName&lt;/artifactId&gt;
+     *     &lt;classifier&gt;theOptionalClassifier&lt;/classifier&gt;
      * &lt;/dependency&gt;
      * </pre>
      * <p>
-     * The {@code versionRange} may be indicated as a single version, in which
-     * case the version range has no upper bound and defines the minimal version
-     * accepted. Otherwise, the version range defines a lower and upper bound of
-     * accepted versions, where the bounds are either included using parentheses
-     * {@code ()} or excluded using brackets {@code []}
-     */
+     * The {@code versionRange} may be indicated as a single version, in which case the version range has no upper bound and defines the
+     * minimal version accepted. Otherwise, the version range defines a lower and upper bound of accepted versions, where the bounds are
+     * either included using parentheses {@code ()} or excluded using brackets {@code []} */
     @Parameter(property = "vault.dependencies")
     private Collection<MavenBasedPackageDependency> dependencies = new LinkedList<>();
 
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/MavenBasedPackageDependency.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/MavenBasedPackageDependency.java
index 4d8a471..5335907 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/MavenBasedPackageDependency.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/MavenBasedPackageDependency.java
@@ -57,6 +57,7 @@ import org.codehaus.plexus.util.StringUtils;
  * &lt;dependency&gt;
  * 	   &lt;groupId&gt;theGroup&lt;/groupId&gt;
  * 	   &lt;artifactId&gt;theName&lt;/artifactId&gt;
+ *     &lt;classifier&gt;theOptionalClassifier&lt;/classifier&gt;
  * &lt;/dependency&gt;
  * </pre>
  * <p>
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/SessionEndHookTrigger.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/SessionEndHookTrigger.java
new file mode 100644
index 0000000..faf921a
--- /dev/null
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/SessionEndHookTrigger.java
@@ -0,0 +1,53 @@
+package org.apache.jackrabbit.filevault.maven.packaging;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.AbstractMavenLifecycleParticipant;
+import org.apache.maven.MavenExecutionException;
+import org.apache.maven.execution.MavenSession;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Registers an {@link AbstractMavenLifecycleParticipant} to be able to trigger actions at the end of the build.
+ *
+ * @see <a href="https://maven.apache.org/examples/maven-3-lifecycle-extensions.html">Maven 3 lifecycle extension</a>
+ * @see <a href="https://brettporter.wordpress.com/2010/10/05/creating-a-custom-build-extension-for-maven-3-0/">Build Extension For Maven
+ *      3.0</a>
+ * @see <a href="http://www.mail-archive.com/users@maven.apache.org/msg138649.html">Maven Users Mailing List Thread</a>
+ */
+@Named
+@Singleton
+public class SessionEndHookTrigger extends AbstractMavenLifecycleParticipant {
+    private Logger logger;
+
+    private static Collection<Runnable> HOOKS = Collections.synchronizedList(new LinkedList<>());
+
+    @Inject
+    public SessionEndHookTrigger(Logger logger) {
+        this.logger = logger;
+    }
+
+    public static void registerShutdownHook(Runnable hook) {
+        HOOKS.add(hook);
+    }
+    
+    @Override
+    public void afterSessionEnd(MavenSession session) throws MavenExecutionException {
+        // get the threads to be executed at the end from the session
+        logger.debug("Triggering all registered hooks...");
+        for (Runnable hook : HOOKS) {
+            try {
+                hook.run();
+            } catch (Throwable t) {
+                logger.error("Error executing shutdown hook" + hook.getClass(), t);
+            }
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateFilesMojo.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateFilesMojo.java
index 09dbc83..e5ab7d6 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateFilesMojo.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateFilesMojo.java
@@ -23,11 +23,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Paths;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.jackrabbit.filevault.maven.packaging.validator.impl.context.DirectoryValidationContext;
 import org.apache.jackrabbit.vault.fs.config.ConfigurationException;
 import org.apache.jackrabbit.vault.util.Constants;
@@ -35,12 +32,9 @@ import org.apache.jackrabbit.vault.validation.ValidationExecutor;
 import org.apache.jackrabbit.vault.validation.ValidationViolation;
 import org.apache.jackrabbit.vault.validation.spi.ValidationContext;
 import org.apache.jackrabbit.vault.validation.spi.impl.AdvancedFilterValidatorFactory;
-import org.apache.maven.lifecycle.LifecycleExecutor;
 import org.apache.maven.lifecycle.LifecycleNotFoundException;
 import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
-import org.apache.maven.lifecycle.MavenExecutionPlan;
 import org.apache.maven.plugin.InvalidPluginDescriptorException;
-import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.MojoNotFoundException;
@@ -50,7 +44,6 @@ import org.apache.maven.plugin.PluginNotFoundException;
 import org.apache.maven.plugin.PluginResolutionException;
 import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
-import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -133,11 +126,6 @@ public class ValidateFilesMojo extends AbstractValidateMojo {
     // End: Copied from AbstractSourceAndMetadataPackageMojo
     // -----
 
-    @Component
-    protected LifecycleExecutor lifecycleExecutor;
-
-    private static final String PLUGIN_KEY = "org.apache.jackrabbit:filevault-package-maven-plugin";
-
     public ValidateFilesMojo() {
     }
 
@@ -158,17 +146,10 @@ public class ValidateFilesMojo extends AbstractValidateMojo {
 
     @Override
     public void doExecute() throws MojoExecutionException, MojoFailureException {
-        final List<String> allGoals;
-        if (session != null) {
-            allGoals = session.getGoals();
-            getLog().debug("Following goals are detected: " + StringUtils.join(allGoals, ", "));
-        } else {
-            getLog().debug("MavenSession not available. Maybe executed by m2e.");
-            allGoals = Collections.emptyList();
-        }
+        
         // is another mojo from this plugin called in this maven session later on?
         try {
-            if (!buildContext.isIncremental() && isMojoGoalExecuted(lifecycleExecutor, "validate-package", allGoals.toArray(new String[0]))) { // how to detect that "install" contains "package"? how to resolve the given goals?
+            if (!buildContext.isIncremental() && isMojoGoalExecuted("validate-package")) { // how to detect that "install" contains "package"? how to resolve the given goals?
                 getLog().info("Skip this mojo as this is not an incremental build and 'validate-package' is executed later on!");
                 return;
             }
@@ -233,35 +214,4 @@ public class ValidateFilesMojo extends AbstractValidateMojo {
             }
         }
     }
-
-    /**
-     * Checks if a certain goal is executed at some point in time in the same Maven Session
-     * @param lifecycleExecutor
-     * @param mojoGoal
-     * @param goals
-     * @return
-     * @throws PluginNotFoundException
-     * @throws PluginResolutionException
-     * @throws PluginDescriptorParsingException
-     * @throws MojoNotFoundException
-     * @throws NoPluginFoundForPrefixException
-     * @throws InvalidPluginDescriptorException
-     * @throws PluginVersionResolutionException
-     * @throws LifecyclePhaseNotFoundException
-     * @throws LifecycleNotFoundException
-     * @throws PluginManagerException
-     * @see <a href=https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java">DefaultLifecycleExecutor</a>
-     */
-    private boolean isMojoGoalExecuted(LifecycleExecutor lifecycleExecutor, String mojoGoal, String... goals) throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginManagerException {
-        if (goals.length == 0) {
-            return false;
-        }
-        MavenExecutionPlan executionPlan = lifecycleExecutor.calculateExecutionPlan(session, goals);
-        for (MojoExecution mojoExecution : executionPlan.getMojoExecutions()) {
-            if (PLUGIN_KEY.equals(mojoExecution.getPlugin().getKey()) && mojoGoal.equals(mojoExecution.getGoal())) {
-                return true;
-            }
-        }
-        return false;
-    }
 }
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateReportMojo.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateReportMojo.java
new file mode 100644
index 0000000..4294034
--- /dev/null
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateReportMojo.java
@@ -0,0 +1,149 @@
+package org.apache.jackrabbit.filevault.maven.packaging;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.jackrabbit.vault.validation.ValidationViolation;
+import org.apache.jackrabbit.vault.validation.spi.ValidationMessageSeverity;
+import org.apache.maven.doxia.siterenderer.RenderingContext;
+import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.MavenReport;
+import org.apache.maven.reporting.MavenReportException;
+
+
+@Mojo(aggregator = true, name = "validation-report")
+public class ValidateReportMojo extends AbstractMojo implements MavenReport {
+
+    /**
+     * If a report is generated (with {@link #generateReport}), it is created in the directory given here.
+     */
+    protected File reportDirectory;
+    
+    /**
+     * The projects in the reactor for aggregation report.
+     */
+    @Parameter( defaultValue = "${reactorProjects}", readonly = true )
+    private List<MavenProject> reactorProjects;
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        
+        if ( skip )
+        {
+            getLog().info( "Skipping javadoc generation" );
+            return;
+        }
+
+        try
+        {
+            RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" );
+            SiteRendererSink sink = new SiteRendererSink( context );
+            Locale locale = Locale.getDefault();
+            generate( sink, locale );
+        }
+        catch ( MavenReportException | RuntimeException e )
+        {
+            MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );
+        }
+        
+    }
+
+    @Override
+    public void generate(org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException {
+        // TODO Auto-generated method stub
+        // generate some html
+
+        // go over all child projects
+        for (MavenProject subProject : reactorProjects) {
+            // from where to extract the report?
+            String buildDir = subProject.getBuild().getDirectory();
+            return new File( buildDir + "/validation-reports" );
+            
+        }
+        
+        // how to get validations from prior executions of the other mojos?
+        Collection<ValidationViolation> violations;
+        File csvFile = new File(reportDirectory,
+                "validation-report-" + new SimpleDateFormat("yyyy-MM-dd_HHmmss").format(new Date()) + ".csv");
+        try {
+            File parentFolder = csvFile.getParentFile();
+            if (parentFolder != null) {
+                parentFolder.mkdirs();
+            }
+            try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(csvFile))) {
+                String csvHeader = "\"Validator ID\",\"Severity\",\"Message\",\"File\",\"Line\",\"Column\",\"Node Path\"";
+                // tell Excel that we really use a comma as separator
+                // (http://superuser.com/questions/407082/easiest-way-to-open-csv-with-commas-in-excel)
+                printWriter.println("sep=,");
+                printWriter.println(csvHeader);
+
+                for (ValidationViolation violation : violations) {
+                    if (violation.getSeverity().ordinal() >= ValidationMessageSeverity.WARN.ordinal()) {
+                        printViolationAsCSVRow(printWriter, violation);
+                    }
+                }
+            }
+            // TODO: count violations
+            getLog().info("Created CSV File '" + csvFile.getAbsolutePath() + "' with " + violations.size() + " violations");
+        } catch (FileNotFoundException e) {
+            throw new MojoExecutionException("Could not write CSV File '" + csvFile.getAbsolutePath() + "' with " + violations.size()
+                    + " violations, e=" + e);
+        }
+    }
+
+    @Override
+    public String getOutputName() {
+        return "validationReport";
+    }
+
+    @Override
+    public String getCategoryName() {
+        return CATEGORY_PROJECT_REPORTS;
+    }
+
+    @Override
+    public String getName(Locale locale) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getDescription(Locale locale) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setReportOutputDirectory(File outputDirectory) {
+        reportDirectory = outputDirectory;
+    }
+
+    @Override
+    public File getReportOutputDirectory() {
+        return reportDirectory;
+    }
+
+    @Override
+    public boolean isExternalReport() {
+        return false;
+    }
+
+    @Override
+    public boolean canGenerateReport() {
+        return true;
+    }
+
+}
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidationHelper.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidationHelper.java
index 4906745..e0aac5e 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidationHelper.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidationHelper.java
@@ -17,14 +17,20 @@
 package org.apache.jackrabbit.filevault.maven.packaging;
 
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
 import java.nio.file.Path;
+import java.text.SimpleDateFormat;
 import java.util.Collection;
+import java.util.Date;
 import java.util.Map;
+import java.util.concurrent.ConcurrentLinkedDeque;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.jackrabbit.vault.validation.ValidationExecutor;
 import org.apache.jackrabbit.vault.validation.ValidationViolation;
 import org.apache.jackrabbit.vault.validation.spi.ValidationContext;
+import org.apache.jackrabbit.vault.validation.spi.ValidationMessageSeverity;
 import org.apache.jackrabbit.vault.validation.spi.Validator;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
@@ -33,55 +39,50 @@ import org.sonatype.plexus.build.incremental.DefaultBuildContext;
 
 public class ValidationHelper {
 
-    /**
-     * Set to {@code true} if at least one {@link ValidationViolation} has been given out
-     */
+    /** Set to {@code true} if at least one {@link ValidationViolation} has been given out */
     private int noOfEmittedValidationMessagesWithLevelWarn = 0;
-    
-    /**
-     * Set to {@code true} if at least one validation violation with severity {@link ValidationMessageSeverity#ERROR} has been given out
-     */
+
+    /** Set to {@code true} if at least one validation violation with severity {@link ValidationMessageSeverity#ERROR} has been given out */
     private int noOfEmittedValidationMessagesWithLevelError = 0;
 
-    protected ValidationHelper() {
-    }
+    private final Collection<ValidationViolation> allViolations;
 
+    protected ValidationHelper(Collection<ValidationViolation> allViolations) {
+        this.allViolations = allViolations;
+    }
 
-    /**
-     * 
-     * @param violations
+    /** @param violations
      * @param log
      * @param buildContext
-     * @param baseDirectory the directory to which all absolute paths should be made relative (i.e. the Maven basedir)
-     */
+     * @param baseDirectory the directory to which all absolute paths should be made relative (i.e. the Maven basedir) */
     public void printMessages(Collection<ValidationViolation> violations, Log log, BuildContext buildContext, Path baseDirectory) {
         for (ValidationViolation violation : violations) {
             final int buildContextSeverity;
-                switch (violation.getSeverity()) {
-                    case ERROR:
-                        log.error(getDetailMessage(violation, baseDirectory));
-                        if (violation.getThrowable() != null) {
-                            log.debug(violation.getThrowable());
-                        }
-                        buildContextSeverity = BuildContext.SEVERITY_ERROR;
-                        noOfEmittedValidationMessagesWithLevelError++;
-                        break;
-                    case WARN:
-                        log.warn(getDetailMessage(violation, baseDirectory));
-                        if (violation.getThrowable() != null) {
-                            log.debug(violation.getThrowable());
-                        }
-                        noOfEmittedValidationMessagesWithLevelWarn++;
-                        buildContextSeverity = BuildContext.SEVERITY_WARNING;
-                        break;
-                    case INFO:
-                        log.info(getDetailMessage(violation, baseDirectory));
-                        buildContextSeverity = -1;
-                        break;
-                    default:
-                        log.debug(getDetailMessage(violation, baseDirectory));
-                        buildContextSeverity = -1;
-                        break;
+            switch (violation.getSeverity()) {
+            case ERROR:
+                log.error(getDetailMessage(violation, baseDirectory));
+                if (violation.getThrowable() != null) {
+                    log.debug(violation.getThrowable());
+                }
+                buildContextSeverity = BuildContext.SEVERITY_ERROR;
+                noOfEmittedValidationMessagesWithLevelError++;
+                break;
+            case WARN:
+                log.warn(getDetailMessage(violation, baseDirectory));
+                if (violation.getThrowable() != null) {
+                    log.debug(violation.getThrowable());
+                }
+                noOfEmittedValidationMessagesWithLevelWarn++;
+                buildContextSeverity = BuildContext.SEVERITY_WARNING;
+                break;
+            case INFO:
+                log.info(getDetailMessage(violation, baseDirectory));
+                buildContextSeverity = -1;
+                break;
+            default:
+                log.debug(getDetailMessage(violation, baseDirectory));
+                buildContextSeverity = -1;
+                break;
             }
             // only emit via build context inside eclipse, otherwise log from above is better!
             if (buildContextSeverity > 0 && !(buildContext instanceof DefaultBuildContext)) {
@@ -92,9 +93,58 @@ public class ValidationHelper {
                     // take the base path
                     file = baseDirectory.toFile();
                 }
-                buildContext.addMessage(file, violation.getLine(), violation.getColumn(), getMessage(violation), buildContextSeverity, violation.getThrowable());
+                buildContext.addMessage(file, violation.getLine(), violation.getColumn(), getMessage(violation), buildContextSeverity,
+                        violation.getThrowable());
             }
         }
+        // add to all violations (for generating the report)
+        if (allViolations != null) {
+            // collect violation in context
+            allViolations.addAll(violations);
+        }
+    }
+
+    public void printCSVReportFile(Collection<ValidationViolation> violations, Log log) {
+        // how to get validations from prior executions of the other mojos?
+        File csvFile = new File(reportDirectory,
+                "validation-report-" + new SimpleDateFormat("yyyy-MM-dd_HHmmss").format(new Date()) + ".csv");
+        File parentFolder = csvFile.getParentFile();
+        if (parentFolder != null) {
+            parentFolder.mkdirs();
+        }
+        try (PrintWriter printWriter = new PrintWriter(new FileOutputStream(csvFile))) {
+            String csvHeader = "\"Validator ID\",\"Severity\",\"Message\",\"File\",\"Line\",\"Column\",\"Node Path\"";
+            // tell Excel that we really use a comma as separator
+            // (http://superuser.com/questions/407082/easiest-way-to-open-csv-with-commas-in-excel)
+            printWriter.println("sep=,");
+            printWriter.println(csvHeader);
+
+            for (ValidationViolation violation : violations) {
+                if (violation.getSeverity().ordinal() >= ValidationMessageSeverity.WARN.ordinal()) {
+                    printViolationAsCSVRow(printWriter, violation);
+                }
+            }
+        }
+        // TODO: count violations
+        log.info("Created CSV File '" + csvFile.getAbsolutePath() + "' with " + violations.size() + " violations");
+    }
+
+    private static void printViolationAsCSVRow(PrintWriter writer, ValidationViolation violation) {
+        writer.print(violation.getValidatorId());
+        writer.print(',');
+        writer.print(violation.getSeverity());
+        writer.print(',');
+        writer.print(violation.getMessage());
+        writer.print(',');
+        writer.print(violation.getFilePath());
+        writer.print(',');
+        writer.print(violation.getLine());
+        writer.print(',');
+        writer.print(violation.getColumn());
+        writer.print(',');
+        writer.print(violation.getNodePath());
+        writer.print(',');
+        writer.println();
     }
 
     private static String getMessage(ValidationViolation violation) {
@@ -107,11 +157,13 @@ public class ValidationHelper {
     }
 
     public void printUsedValidators(Log log, ValidationExecutor executor, ValidationContext context, boolean printUnusedValidators) {
-        log.info("Using " + executor.getAllValidatorsById().entrySet().size() + " validators for package of type " + context.getPackageType() + ": " + ValidationHelper.getValidatorNames(executor, ", "));
+        log.info("Using " + executor.getAllValidatorsById().entrySet().size() + " validators for package of type "
+                + context.getPackageType() + ": " + ValidationHelper.getValidatorNames(executor, ", "));
         if (printUnusedValidators) {
             Map<String, Validator> unusedValidatorsById = executor.getUnusedValidatorsById();
             if (!unusedValidatorsById.isEmpty()) {
-                log.warn("There are unused validators among those which are not executed: " + StringUtils.join(unusedValidatorsById.keySet(), "."));
+                log.warn("There are unused validators among those which are not executed: "
+                        + StringUtils.join(unusedValidatorsById.keySet(), "."));
             }
         }
     }
@@ -154,9 +206,12 @@ public class ValidationHelper {
 
     protected void failBuildInCaseOfViolations(boolean failForWarning) throws MojoFailureException {
         if (failForWarning && (noOfEmittedValidationMessagesWithLevelWarn > 0 || noOfEmittedValidationMessagesWithLevelError > 0)) {
-            throw new MojoFailureException("Found " +noOfEmittedValidationMessagesWithLevelWarn+noOfEmittedValidationMessagesWithLevelError + " violation(s) (either ERROR or WARN). Check above warnings/errors for details");
+            throw new MojoFailureException(
+                    "Found " + noOfEmittedValidationMessagesWithLevelWarn + noOfEmittedValidationMessagesWithLevelError
+                            + " violation(s) (either ERROR or WARN). Check above warnings/errors for details");
         } else if (noOfEmittedValidationMessagesWithLevelError > 0) {
-            throw new MojoFailureException("Found " + noOfEmittedValidationMessagesWithLevelError + " violation(s) (with severity=ERROR). Check above errors for details");
+            throw new MojoFailureException("Found " + noOfEmittedValidationMessagesWithLevelError
+                    + " violation(s) (with severity=ERROR). Check above errors for details");
         }
     }
 }


[jackrabbit-filevault-package-maven-plugin] 02/03: trivial: fix prerequisites for building

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/report
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git

commit db71b0ab409e0bd07fb3797faeba179591ba3857
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Oct 24 08:07:59 2019 +0000

    trivial: fix prerequisites for building
    
    git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk@1868853 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index bc643ef..d964985 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ You can build the plugin like this:
 
     mvn clean install
 
-You need Maven 3.2.5 (or higher) with Java 7 (or higher) for the build.
+You need Maven 3.3.9 (or higher) with Java 8 (or higher) for the build.
 For more instructions, please see the documentation at:
 
    http://jackrabbit.apache.org/building-jackrabbit.html