jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r1868139 [1/3] - in /jackrabbit/commons/filevault-package-maven-plugin/trunk: ./ src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ src/main/java/org/apache/jac...
Date Tue, 08 Oct 2019 15:22:04 GMT
Author: kwin
Date: Tue Oct  8 15:22:03 2019
New Revision: 1868139

URL: http://svn.apache.org/viewvc?rev=1868139&view=rev
Log:
JCRVLT-345 dedicated goals for validation

leverage validation framework

Added:
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractMetadataPackageMojo.java
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractPackageMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractSourceAndMetadataPackageMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/MavenBasedPackageDependency.java
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Dependency.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidateFilesMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidatePackageMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidationHelper.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ValidatorSettings.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/util/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/util/EnhancedBufferedInputStream.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/util/EnhancedBufferedOutputStream.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/context/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/context/ArchiveValidationContextImpl.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/context/DependencyResolver.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/context/DirectoryValidationContext.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/context/SubPackageValidationContext.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/resources/filter.xsd
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/site/markdown/validators.md
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojoTest.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/ValidateFilesIT.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/ValidatePackageIT.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/maven/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/maven/packaging/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/maven/packaging/validator/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/maven/packaging/validator/impl/filter.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/org/apache/jackrabbit/filevault/maven/packaging/validator/mojo-configuration1.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/invalid-package/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/invalid-package/META-INF/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/invalid-package/META-INF/vault/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/invalid-package/META-INF/vault/filter-non-matching-regex.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/invalid-package/META-INF/vault/filter.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/invalid-package/META-INF/vault/properties.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/META-INF/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/META-INF/vault/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/META-INF/vault/filter.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/META-INF/vault/genericfile.txt
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/META-INF/vault/properties.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/.content.xml   (contents, props changed)
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/child1.xml   (contents, props changed)
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/child2/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/child2/.content.xml   (contents, props changed)
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/child2/child1.xml   (contents, props changed)
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/genericfile.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/invalid/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/simple-package/jcr_root/apps/invalid/wrongtype.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/expected-log-lines.txt
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/pom.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/generic-empty-directories/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/src/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/src/main/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/src/main/content/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/src/main/content/META-INF/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/src/main/content/META-INF/vault/
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validator-projects/invalid-project/src/main/content/META-INF/vault/filter.xml
      - copied, changed from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
Removed:
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractPackageMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Dependency.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DependencyValidator.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/FileValidator.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageDependency.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageInfo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/impl/FileValidatorTest.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/impl/PackageInfoTest.java
Modified:
    jackrabbit/commons/filevault-package-maven-plugin/trunk/.ratignore
    jackrabbit/commons/filevault-package-maven-plugin/trunk/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FormatDocviewXmlMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/SimpleEmbedded.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/VaultMojo.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/resources/META-INF/plexus/components.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/site/markdown/index.md
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/site/site.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/ProjectBuilder.java
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-content/test-package-exclude.zip
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/check-signature/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/generic-empty-directories/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/generic-with-metainf/expected-manifest.txt
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/generic-with-metainf/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/generic/expected-manifest.txt
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/generic/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/htl-validation/expected-manifest.txt
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/htl-validation/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/default-test-projects/resource-empty-directories/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/filter-tests/inline-filter-twice/pom1.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/filter-tests/inline-filter-twice/pom2.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/filter-tests/inline-filter/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/filter-tests/merge-inline-filter-metainf/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/filter-tests/merge-inline-filter/pom.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/package-type-auto/application-sourced/filter.xml
    jackrabbit/commons/filevault-package-maven-plugin/trunk/src/test/resources/test-projects/validate-deps-projects/no-errors/pom.xml

Modified: jackrabbit/commons/filevault-package-maven-plugin/trunk/.ratignore
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/.ratignore?rev=1868139&r1=1868138&r2=1868139&view=diff
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/.ratignore (original)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/.ratignore Tue Oct  8 15:22:03 2019
@@ -5,4 +5,5 @@ src/test/resources/test-projects/**/.vlt
 src/test/resources/test-projects/**/.vltignore
 src/test/resources/test-projects/**/.dummy
 src/test/resources/test-projects/**/*.lst
-src/test/resources/test-projects/**/*.MF
\ No newline at end of file
+src/test/resources/test-projects/**/*.MF
+.mvn/**
\ No newline at end of file

Modified: jackrabbit/commons/filevault-package-maven-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/pom.xml?rev=1868139&r1=1868138&r2=1868139&view=diff
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/pom.xml (original)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/pom.xml Tue Oct  8 15:22:03 2019
@@ -40,13 +40,15 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <mavenVersion>3.3.9</mavenVersion> <!-- required for https://issues.apache.org/jira/browse/MNG-5440 -->
+        <maven.version>3.3.9</maven.version> <!-- required for https://issues.apache.org/jira/browse/MNG-5440 -->
         <aether.version>1.0.2.v20150114</aether.version>
         <slf4j.version>1.7.5</slf4j.version>
+        <jackrabbit.version>2.18.3</jackrabbit.version>
+        <oak.version>1.16.0</oak.version>
     </properties>
 
     <prerequisites>
-        <maven>3.2.5</maven>
+        <maven>${maven.version}</maven>
     </prerequisites>
 
     <scm>
@@ -100,8 +102,8 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
+                    <source>1.8</source>
+                    <target>1.8</target>
                     <debug>true</debug>
                     <showDeprecation>false</showDeprecation>
                     <showWarnings>true</showWarnings>
@@ -290,24 +292,43 @@
         <dependency>
             <groupId>org.apache.jackrabbit.vault</groupId>
             <artifactId>org.apache.jackrabbit.vault</artifactId>
-            <version>3.2.0</version>
+            <version>3.4.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit.vault</groupId>
+            <artifactId>vault-validation</artifactId>
+            <version>3.4.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>javax.jcr</groupId>
             <artifactId>jcr</artifactId>
             <version>2.0</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-commons</artifactId>
+            <version>${jackrabbit.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-spi-commons</artifactId>
+            <version>${jackrabbit.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-core</artifactId>
+            <version>${oak.version}</version>
+        </dependency>
         <!-- Maven Plugin stuff -->
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-core</artifactId>
-            <version>${mavenVersion}</version>
+            <version>${maven.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-plugin-api</artifactId>
-            <version>${mavenVersion}</version>
+            <version>${maven.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven.plugin-tools</groupId>
@@ -317,17 +338,17 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-artifact</artifactId>
-            <version>${mavenVersion}</version>
+            <version>${maven.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-compat</artifactId>
-            <version>${mavenVersion}</version>
+            <version>${maven.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-model</artifactId>
-            <version>${mavenVersion}</version>
+            <version>${maven.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
@@ -352,7 +373,7 @@
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <version>2.5</version>
+            <version>2.6</version>
         </dependency>
         <dependency>
             <groupId>com.google.code.findbugs</groupId>
@@ -429,6 +450,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>2.28.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <version>${slf4j.version}</version>
@@ -455,7 +482,7 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-aether-provider</artifactId>
-            <version>${mavenVersion}</version>
+            <version>${maven.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -476,12 +503,6 @@
             <version>3.2.0</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-jcr-commons</artifactId>
-            <version>2.17.1</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <!-- ====================================================================== -->

Copied: jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractMetadataPackageMojo.java (from r1863646, jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractPackageMojo.java)
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractMetadataPackageMojo.java?p2=jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractMetadataPackageMojo.java&p1=jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractPackageMojo.java&r1=1863646&r2=1868139&rev=1868139&view=diff
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractPackageMojo.java (original)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractMetadataPackageMojo.java Tue Oct  8 15:22:03 2019
@@ -20,25 +20,30 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
+import java.util.jar.JarFile;
 
 import org.apache.jackrabbit.vault.fs.config.ConfigurationException;
-import org.apache.jackrabbit.vault.packaging.PackageType;
+import org.apache.jackrabbit.vault.util.Constants;
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 
-public abstract class AbstractPackageMojo extends AbstractMojo {
-
-    static final String JCR_ROOT = "jcr_root/";
+/**
+ * Common ancestor of all mojos dealing with package metadata.
+ */
+public abstract class AbstractMetadataPackageMojo extends AbstractMojo {
 
     private static final String PROPERTIES_EMBEDDEDFILESMAP_KEY = "embeddedfiles.map";
 
-    private static final String VAULT_DIR = "META-INF/vault";
-
-    public static final String PROPERTIES_FILE = VAULT_DIR + "/properties.xml";
-
-    public static final String FILTER_FILE = VAULT_DIR + "/filter.xml";
+    protected static File getFirstExistingDirectory(File[] directories) {
+        for (File dir: directories) {
+            if (dir.exists() && dir.isDirectory()) {
+                return dir;
+            }
+        }
+        return null;
+    }
 
     /**
      * The Maven project.
@@ -46,30 +51,6 @@ public abstract class AbstractPackageMoj
     @Parameter(property = "project", readonly = true, required = true)
     protected MavenProject project;
 
-    /**
-     * Adds a path prefix to all resources useful for shallower source trees.
-     * This does not apply to files in {@link #workDirectory}.
-     */
-    @Parameter(property = "vault.prefix")
-    String prefix = "";
-    
-    public void setPrefix(String prefix) {
-        if (prefix == null) {
-            prefix = "";
-        } else if (!prefix.endsWith("/")) {
-            prefix += "/";
-        }
-        this.prefix = prefix;
-    }
-
-    /**
-     * The directory containing the metadata to be packaged up into the content package.
-     * Basically containing all files/folders being generated by goal "generate-metadata".
-     */
-    @Parameter(
-            defaultValue = "${project.build.directory}/vault-work",
-            required = true)
-    File workDirectory;
 
     /**
      * The directory that contains the META-INF/vault. Multiple directories can be specified as a comma separated list,
@@ -80,61 +61,38 @@ public abstract class AbstractPackageMoj
      * if this directory contains a {@code properties.xml} it will not be overwritten by the generated one. A special
      * case is the {@code filter.xml} which will be merged with inline filters if present.
      */
-    @Parameter(
-            property = "vault.metaInfVaultDirectory",
-            required = true,
-            defaultValue =
-                    "${project.basedir}/META-INF/vault," +
-                    "${project.basedir}/src/main/META-INF/vault," +
-                    "${project.basedir}/src/main/content/META-INF/vault," +
-                    "${project.basedir}/src/content/META-INF/vault"
-    )
+    @Parameter(property = "vault.metaInfVaultDirectory", required = true, defaultValue = "${project.basedir}/META-INF/vault,"
+            + "${project.basedir}/src/main/META-INF/vault," + "${project.basedir}/src/main/content/META-INF/vault,"
+            + "${project.basedir}/src/content/META-INF/vault")
     File[] metaInfVaultDirectory;
 
     /**
-     * Defines whether the package is allowed to contain index definitions. This will become the
-     * {@code allowIndexDefinitions} property of the properties.xml file.
+     * The directory containing the metadata to be packaged up into the content package.
+     * Basically containing all files/folders being generated by goal "generate-metadata".
      */
     @Parameter(
-            property = "vault.allowIndexDefinitions",
-            defaultValue="false",
+            defaultValue = "${project.build.directory}/vault-work",
             required = true)
-    boolean allowIndexDefinitions;
+    File workDirectory;
 
     /**
-     * Defines the content package type. this is either 'application', 'content', 'container' or 'mixed'.
-     * If omitted, it is calculated automatically based on filter definitions. certain package types imply restrictions,
-     * for example, 'application' and 'content' packages are not allowed to contain sub packages or embedded bundles.<br>
-     * Possible values:
-     * <ul>
-     *   <li>{@code application}: An application package consists purely of application content. It serializes
-     *       entire subtrees with no inclusion or exclusion filters. it does not contain any subpackages nor OSGi
-     *       configuration or bundles.</li> 
-     *   <li>{@code content}: A content package consists only of content and user defined configuration.
-     *       It usually serializes entire subtrees but can contain inclusion or exclusion filters. it does not contain
-     *       any subpackages nor OSGi configuration or bundles.</li> 
-     *   <li>{@code container}: A container package only contains sub packages and OSGi configuration and bundles.
-     *       The container package is only used as container for deployment.</li> 
-     *   <li>{@code mixed}: Catch all type for a combination of the above.</li> 
-     * </ul>
-     */
-    @Parameter(property = "vault.packageType")
-    protected PackageType packageType;
-
-    /**
-     * Sets the package type.
-     * @param type the string representation of the package type
-     * @throws MojoFailureException if an error occurrs
-     */
-    public void setPackageType(String type) throws MojoFailureException {
-        try {
-            packageType = PackageType.valueOf(type.toUpperCase());
-        } catch (IllegalArgumentException e) {
-            throw new MojoFailureException("Invalid package type specified: " + type +".\n" +
-                    "Must be empty or one of 'application', 'content', 'container', 'mixed'");
+     * Adds a path prefix to all resources. Useful for shallower source trees.
+     * This does not apply to files in {@link #workDirectory} nor {@link #metaInfVaultDirectory}
+     * but e.g. is relevant for the default filter and for the jcr_root of the package.
+     */
+    @Parameter(property = "vault.prefix")
+    String prefix = "";
+
+    public void setPrefix(String prefix) {
+        if (prefix == null) {
+            prefix = "";
+        } else if (!prefix.endsWith("/")) {
+            prefix += "/";
         }
+        this.prefix = prefix;
     }
 
+
     /**
      * Sets the map of embedded files as project properties as a helper to pass data between the goals
      * @param embeddedFiles map of embedded files.
@@ -162,47 +120,42 @@ public abstract class AbstractPackageMoj
         }
     }
 
-    File getVaultDir() {
-        return new File(workDirectory, VAULT_DIR);
+    /**
+     * 
+     * @return the META-INF/vault directory below the {@link #workDirectory}
+     */
+    File getGeneratedVaultDir() {
+        return new File(workDirectory, Constants.META_DIR);
     }
 
-    File getMetaInfDir() {
-        // find the meta-inf source directory
-        File metaInfDirectory = null;
-        for (File dir: metaInfVaultDirectory) {
-            if (dir.exists() && dir.isDirectory()) {
-                metaInfDirectory = dir;
-                break;
-            }
-        }
-        if (metaInfDirectory != null) {
-            getLog().info("using meta-inf/vault from " + metaInfDirectory.getPath());
-        }
-        return metaInfDirectory;
+    File getGeneratedManifestFile() {
+        return new File(workDirectory, JarFile.MANIFEST_NAME);
     }
 
-    File getManifestFile() {
-        return new File(workDirectory, "META-INF/MANIFEST.MF");
+    File getGeneratedFilterFile() {
+        return new File(getGeneratedVaultDir(), Constants.FILTER_XML);
     }
 
-    File getFilterFile() {
-        return new File(getVaultDir(), "filter.xml");
+    /**
+     * 
+     * @return the first matching directory from the list given in {@link #metaInfVaultDirectory}
+     */
+    protected File getMetaInfVaultSourceDirectory() {
+        return getMetaInfVaultSourceDirectory(metaInfVaultDirectory, getLog());
     }
 
-    Filters loadFilterFile() throws IOException, ConfigurationException {
+    protected static File getMetaInfVaultSourceDirectory(File[] metaInfVaultDirectory, Log log) {
+        File metaInfDirectory = getFirstExistingDirectory(metaInfVaultDirectory);
+        if (metaInfDirectory != null) {
+            log.info("Using META-INF/vault from " + metaInfDirectory.getPath());
+        }
+        return metaInfDirectory;
+    }
+    Filters loadGeneratedFilterFile() throws IOException, ConfigurationException {
         // load filters for further processing
         Filters filters = new Filters();
-        filters.load(getFilterFile());
+        filters.load(getGeneratedFilterFile());
         return filters;
     }
-    
-    static File getFirstExistingDirectory(File[] directories) {
-        for (File dir: directories) {
-            if (dir.exists() && dir.isDirectory()) {
-                return dir;
-            }
-        }
-        return null;
-    }
 
  }

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractSourceAndMetadataPackageMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractSourceAndMetadataPackageMojo.java?rev=1868139&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractSourceAndMetadataPackageMojo.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractSourceAndMetadataPackageMojo.java Tue Oct  8 15:22:03 2019
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+package org.apache.jackrabbit.filevault.maven.packaging;
+
+import java.io.File;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.codehaus.plexus.util.AbstractScanner;
+import org.codehaus.plexus.util.DirectoryScanner;
+
+/**
+ * Commons ancestor for all mojos dealing with package source files and meta data files
+ */
+public abstract class AbstractSourceAndMetadataPackageMojo extends AbstractMetadataPackageMojo {
+
+    /**
+     * The directory containing the content to be packaged up into the content
+     * package.
+     *
+     * This property is deprecated; use {@link #jcrRootSourceDirectory} instead.
+     */
+    @Deprecated
+    @Parameter
+    private File builtContentDirectory;
+
+    /**
+     * The directory that contains the jcr_root of the content. Multiple directories can be specified as a comma separated list,
+     * which will act as a search path and cause the plugin to look for the first existing directory.
+     */
+    @Parameter(property = "vault.jcrRootSourceDirectory", required = true, defaultValue = "${project.basedir}/jcr_root,"
+            + "${project.basedir}/src/main/jcr_root," + "${project.basedir}/src/main/content/jcr_root,"
+            + "${project.basedir}/src/content/jcr_root," + "${project.build.outputDirectory}")
+    private File[] jcrRootSourceDirectory;
+
+    /**
+     * The file name patterns to exclude in addition to the ones listed in
+     * {@link AbstractScanner#DEFAULTEXCLUDES}. The format of each pattern is described in {@link DirectoryScanner}.
+     * The comparison is against the path relative to the according filter root.
+     * Since this is hardly predictable it is recommended to use only filename/directory name patterns here 
+     * but not take into account file system hierarchies!
+     * <p>
+     * Each value is either a regex pattern if enclosed within {@code %regex[} and {@code ]}, otherwise an 
+     * <a href="https://ant.apache.org/manual/dirtasks.html#patterns">Ant pattern</a>.
+     */
+    @Parameter(property = "vault.excludes", defaultValue = "**/.vlt,**/.vltignore", required = true)
+    protected String[] excludes;
+
+    protected File getJcrSourceDirectory() {
+        return getJcrSourceDirectory(jcrRootSourceDirectory, builtContentDirectory, getLog());
+    }
+    
+    protected static File getJcrSourceDirectory(File[] jcrRootSourceDirectory, File builtContentDirectory, Log log) {
+        final File jcrSourceDirectory;
+        if (builtContentDirectory != null) {
+            log.warn("The 'builtContentDirectory' is deprecated. Please use the new 'jcrRootSourceDirectory' instead.");
+            jcrSourceDirectory = builtContentDirectory;
+        } else {
+            jcrSourceDirectory = getFirstExistingDirectory(jcrRootSourceDirectory);
+        }
+        return jcrSourceDirectory;
+    }
+}

Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java?rev=1868139&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractValidateMojo.java Tue Oct  8 15:22:03 2019
@@ -0,0 +1,253 @@
+/*
+ * 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.
+ */
+package org.apache.jackrabbit.filevault.maven.packaging;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.jackrabbit.filevault.maven.packaging.validator.impl.context.DependencyResolver;
+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.spi.ValidationMessageSeverity;
+import org.apache.jackrabbit.vault.validation.spi.impl.AdvancedFilterValidatorFactory;
+import org.apache.jackrabbit.vault.validation.spi.impl.DependencyValidatorFactory;
+import org.apache.maven.artifact.Artifact;
+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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.repository.RepositorySystem;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Common ancestor for all validation related mojos
+ */
+public abstract class AbstractValidateMojo extends AbstractMojo {
+
+    /** All validator settings in a map. The keys are the validator ids and the values
+     * are a complex object of type ValdidatorSettings.
+     * An example configuration looks like
+     * <pre>
+     *  &lt;jackrabbit-filter&gt;
+     *      &lt;options&gt;
+     *          &lt;
+     *      &lt;/options&gt;
+     *  &lt;/jackrabbit-filter&gt;
+     * </pre>
+     */
+    @Parameter
+    Map<String, ValidatorSettings> validatorsSettings;
+
+    /** Controls if errors during dependency validation should fail the build. 
+     *  
+     * @deprecated Use {@link validatorsSettings} with the following values
+     * instead
+     * <pre>
+     *   &lt;jackrabbit-dependencies&gt;
+     *       &lt;defaultSeverity&gt;debug&lt;/defaultSeverity&gt;
+     *   &lt;/jackrabbit-dependencies&gt;
+     * </pre>
+     * 
+     */
+    @Parameter(property = "vault.failOnDependencyErrors", defaultValue = "true", required = true)
+    @Deprecated
+    private boolean failOnDependencyErrors;
+
+    /** The Maven project (might be {@code null}) */
+    @Parameter(property = "project", readonly = true, required = false)
+    protected MavenProject project;
+
+    @Parameter(defaultValue = "${mojoExecution}", readonly = true, required = true)
+    protected MojoExecution mojoExecution;
+
+    @Parameter(defaultValue = "${session}", readonly = true, required = false)
+    protected MavenSession session;
+
+    /** 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")
+    protected boolean failOnValidationWarnings;
+
+    /** 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;
+     *     &lt;name&gt;theName&lt;/name&gt;
+     *     &lt;version&gt;1.5&lt;/version&gt;
+     * &lt;/dependency&gt;
+     * </pre>
+     * <p>
+     * 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;/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 []} */
+    @Parameter(property = "vault.dependencies")
+    protected MavenBasedPackageDependency[] dependencies = new MavenBasedPackageDependency[0];
+
+    /** Defines the packages that define the repository structure. For the format description look at {@link #dependencies}.
+     * <p>
+     * The repository-init feature of sling-start can define initial content that will be available in the repository before the first
+     * package is installed. Packages that depend on those nodes have no way to reference any dependency package that provides these nodes.
+     * A "real" package that would creates those nodes cannot be installed in the repository, because it would void the repository init
+     * structure. On the other hand would filevault complain, if the package was listed as dependency but not installed in the repository.
+     * So therefore this repository-structure packages serve as indicator packages that helps satisfy the structural dependencies, but are
+     * not added as real dependencies to the package. */
+    @Parameter(property = "vault.repository.structure.packages")
+    protected MavenBasedPackageDependency[] repositoryStructurePackages = new MavenBasedPackageDependency[0];
+
+    /**
+     * Mapping of package dependencies given via group and name to Maven identifiers for enhanced validation.
+     * Each entry must have the format {@code <group>:<name>=<groupId>:<artifactId>}
+     */
+    @Parameter(property = "vault.package.dependency.to.maven.ga")
+    protected Collection<String> mapPackageDependencyToMavenGa;
+
+    @Component
+    protected RepositorySystem repositorySystem;
+
+    @Component
+    protected ResolutionErrorHandler resolutionErrorHandler;
+
+    @Component
+    protected BuildContext buildContext;
+
+    protected final ValidationExecutorFactory validationExecutorFactory;
+
+    protected final ValidationHelper validationHelper;
+
+    protected DependencyResolver resolver;
+
+    public AbstractValidateMojo() {
+        super();
+        this.validationExecutorFactory = new ValidationExecutorFactory(this.getClass().getClassLoader());
+        this.validationHelper = new ValidationHelper();
+    }
+
+    static Map<Dependency, Artifact> resolveMap(Collection<String> mapPackageDependencyToMavenGa) {
+        // resolve mapping map
+        return mapPackageDependencyToMavenGa.stream()
+                .map(s -> s.split("=", 2))
+                .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 {
+        // resolve mapping map
+        resolver = new DependencyResolver(DefaultRepositoryRequest.getRepositoryRequest(session, project), repositorySystem,
+                resolutionErrorHandler, resolveMap(mapPackageDependencyToMavenGa));
+        translateLegacyParametersToValidatorParameters();
+        final Collection<PackageInfo> resolvedDependencies = new LinkedList<>();
+        if (project != null) {
+            validationHelper.clearPreviousValidationMessages(buildContext, project.getBasedir());
+        }
+        // repository structure only defines valid roots
+        // https://github.com/apache/jackrabbit-filevault-package-maven-plugin/blob/02a853e64d985f075fe88d19101d7c66d741767f/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/DependencyValidator.java#L51
+        try {
+            Collection<String> validRoots = new LinkedList<>();
+            for (PackageInfo packageInfo : getPackageInfoFromMavenBasedDependencies(repositoryStructurePackages)) {
+                for (PathFilterSet set : packageInfo.getFilter().getFilterSets()) {
+                    validRoots.add(set.getRoot());
+                }
+            }
+            if (!validRoots.isEmpty()) {
+                ValidatorSettings settings = null;
+                if (validatorsSettings != null) {
+                    settings = validatorsSettings.get(AdvancedFilterValidatorFactory.ID);
+                } else {
+                    validatorsSettings = new HashMap<>();
+                }
+                if (settings == null) {
+                    settings = new ValidatorSettings();
+                    settings.addOption(AdvancedFilterValidatorFactory.OPTION_VALID_ROOTS, StringUtils.join(validRoots, ","));
+                    validatorsSettings.put(AdvancedFilterValidatorFactory.ID, settings);
+                } else {
+                    String oldValidRoots = settings.getOptions().get(AdvancedFilterValidatorFactory.OPTION_VALID_ROOTS);
+                    settings.addOption(AdvancedFilterValidatorFactory.OPTION_VALID_ROOTS, oldValidRoots + "," + StringUtils.join(validRoots, ","));
+                }
+            }
+        } catch (IOException e) {
+            throw new MojoExecutionException("Could not get meta information for repositoryStructurePackages '"
+                    + StringUtils.join(repositoryStructurePackages, ",") + "': " + e.getMessage(), e);
+        }
+        try {
+            resolvedDependencies.addAll(getPackageInfoFromMavenBasedDependencies(dependencies));
+        } catch (IOException e) {
+            throw new MojoExecutionException(
+                    "Could not get meta information for dependencies '" + StringUtils.join(dependencies, ",") + "': " + e.getMessage(),
+                    e);
+        }
+        doExecute(resolvedDependencies);
+    }
+
+    private Collection<PackageInfo> getPackageInfoFromMavenBasedDependencies(MavenBasedPackageDependency... dependencies) throws IOException {
+        Collection<PackageInfo> packageInfos = new LinkedList<>();
+        // try to resolve from project artifacts (in case a project is given)
+        MavenBasedPackageDependency.resolve(project, getLog(), dependencies);
+        for (MavenBasedPackageDependency dependency : dependencies) {
+            // check if resolution was successful
+            if (dependency.getInfo() != null) {
+                packageInfos.add(dependency.getInfo());
+            }
+        }
+        return packageInfos;
+    }
+
+    private void translateLegacyParametersToValidatorParameters() throws MojoExecutionException {
+        if (!failOnDependencyErrors) {
+            getLog().warn("Deprecated parameter 'failOnDependencyErrors' used.");
+
+            if (validatorsSettings != null) {
+                if (validatorsSettings.containsKey(DependencyValidatorFactory.ID)) {
+                    throw new MojoExecutionException("Can not set parameters 'failOnDependencyErrors' and 'validationSettings' for '"
+                            + DependencyValidatorFactory.ID + "' at the same time");
+                }
+            } else {
+                validatorsSettings = new HashMap<>();
+            }
+
+            // do no fully disable but emit violations with level DEBUG
+            ValidatorSettings dependencyValidatorSettings = new ValidatorSettings(ValidationMessageSeverity.DEBUG);
+            validatorsSettings.put(DependencyValidatorFactory.ID, dependencyValidatorSettings);
+        }
+    }
+
+    public abstract void doExecute(Collection<PackageInfo> resolvedDependencies) throws MojoExecutionException, MojoFailureException;
+}

Modified: jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FormatDocviewXmlMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FormatDocviewXmlMojo.java?rev=1868139&r1=1868138&r2=1868139&view=diff
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FormatDocviewXmlMojo.java (original)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FormatDocviewXmlMojo.java Tue Oct  8 15:22:03 2019
@@ -45,6 +45,10 @@ import org.sonatype.plexus.build.increme
 )
 public class FormatDocviewXmlMojo extends AbstractMojo {
 
+    /**
+     * The directory that contains the jcr_root of the content. Multiple directories can be specified as a comma separated list,
+     * which will act as a search path and cause the plugin to look for the first existing directory.
+     */
     @Parameter(
             property = "vault.jcrRootSourceDirectory",
             required = true,
@@ -93,7 +97,7 @@ public class FormatDocviewXmlMojo extend
            "(http://jackrabbit.apache.org/filevault/usage.html).";
  
     public void execute() throws MojoExecutionException, MojoFailureException {
-        File jcrSourceDirectory = AbstractPackageMojo.getFirstExistingDirectory(jcrRootSourceDirectory);
+        File jcrSourceDirectory = AbstractSourceAndMetadataPackageMojo.getFirstExistingDirectory(jcrRootSourceDirectory);
         executeInternal(jcrSourceDirectory);
     }
     

Modified: jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java?rev=1868139&r1=1868138&r2=1868139&view=diff
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java (original)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/GenerateMetadataMojo.java Tue Oct  8 15:22:03 2019
@@ -30,7 +30,6 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -41,17 +40,14 @@ import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
-import aQute.bnd.header.Attrs;
-import aQute.bnd.header.Parameters;
-import aQute.bnd.osgi.Processor;
-import org.apache.jackrabbit.filevault.maven.packaging.impl.DependencyValidator;
-import org.apache.jackrabbit.filevault.maven.packaging.impl.PackageDependency;
 import org.apache.jackrabbit.vault.fs.api.PathFilterSet;
 import org.apache.jackrabbit.vault.fs.config.ConfigurationException;
 import org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter;
 import org.apache.jackrabbit.vault.fs.io.AccessControlHandling;
 import org.apache.jackrabbit.vault.packaging.PackageId;
+import org.apache.jackrabbit.vault.packaging.PackageProperties;
 import org.apache.jackrabbit.vault.packaging.PackageType;
+import org.apache.jackrabbit.vault.util.Constants;
 import org.apache.jackrabbit.vault.util.Text;
 import org.apache.maven.archiver.ManifestConfiguration;
 import org.apache.maven.archiver.MavenArchiveConfiguration;
@@ -75,6 +71,10 @@ import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
+import aQute.bnd.header.Attrs;
+import aQute.bnd.header.Parameters;
+import aQute.bnd.osgi.Processor;
+
 /**
  * Maven goal which generates the metadata ending up in the package like {@code META-INF/MANIFEST.MF} as well as the
  * files ending up in {@code META-INF/vault} like {@code filter.xml}, {@code properties.xml}, {@code config.xml} and
@@ -86,7 +86,7 @@ import org.sonatype.plexus.build.increme
         defaultPhase = LifecyclePhase.PROCESS_CLASSES,
         requiresDependencyResolution = ResolutionScope.COMPILE
 )
-public class GenerateMetadataMojo extends AbstractPackageMojo {
+public class GenerateMetadataMojo extends AbstractMetadataPackageMojo {
 
     /**
      *  A date format which is compliant with {@code org.apache.jackrabbit.util.ISO8601.parse(...)}
@@ -95,18 +95,6 @@ public class GenerateMetadataMojo extend
      */
     private final DateFormat iso8601DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
 
-    public static final String MF_KEY_PACKAGE_TYPE = "Content-Package-Type";
-
-    public static final String MF_KEY_PACKAGE_ID = "Content-Package-Id";
-
-    public static final String MF_KEY_PACKAGE_DEPENDENCIES = "Content-Package-Dependencies";
-
-    public static final String MF_KEY_PACKAGE_ROOTS = "Content-Package-Roots";
-
-    public static final String MF_KEY_PACKAGE_DESC = "Content-Package-Description";
-
-    public static final String MF_KEY_IMPORT_PACKAGE = "Import-Package";
-
     /**
      * For m2e incremental build support
      */
@@ -225,17 +213,9 @@ public class GenerateMetadataMojo extend
      * accepted versions, where the bounds are either included using parentheses
      * {@code ()} or excluded using brackets {@code []}
      */
-    @Parameter
-    private Dependency[] dependencies = new Dependency[0];
+    @Parameter(property = "vault.dependencies")
+    private MavenBasedPackageDependency[] dependencies = new MavenBasedPackageDependency[0];
 
-    /**
-     * Controls if errors during dependency validation should fail the build.
-     */
-    @Parameter(
-            property = "vault.failOnDependencyErrors",
-            defaultValue="true",
-            required = true)
-    private boolean failOnDependencyErrors;
 
     /**
      * Defines the Access control handling. This will become the
@@ -349,21 +329,6 @@ public class GenerateMetadataMojo extend
     private SubPackage[] subPackages = new SubPackage[0];
 
     /**
-     * Defines the packages that define the repository structure.
-     * For the format description look at {@link #dependencies}.
-     * <p>
-     * The repository-init feature of sling-start can define initial content that will be available in the
-     * repository before the first package is installed. Packages that depend on those nodes have no way to reference
-     * any dependency package that provides these nodes. A "real" package that would creates those nodes cannot be
-     * installed in the repository, because it would void the repository init structure. On the other hand would filevault
-     * complain, if the package was listed as dependency but not installed in the repository. So therefor this
-     * repository-structure packages serve as indicator packages that helps satisfy the structural dependencies, but are
-     * not added as real dependencies to the package.
-     */
-    @Parameter
-    private Dependency[] repositoryStructurePackages = new Dependency[0];
-
-    /**
      * File to store the generated manifest snippet.
      */
     @Parameter(property = "vault.generatedImportPackage", defaultValue = "${project.build.directory}/vault-generated-import.txt")
@@ -374,7 +339,7 @@ public class GenerateMetadataMojo extend
      * href="http://maven.apache.org/shared/maven-archiver/index.html">the
      * documentation for Maven Archiver</a>.
      * 
-     * All settings related to manifest are not relevant as this gets overwritten by the manifest in {@link AbstractPackageMojo#workDirectory}
+     * All settings related to manifest are not relevant as this gets overwritten by the manifest in {@link AbstractMetadataPackageMojo#workDirectory}
      */
     @Parameter
     private MavenArchiveConfiguration archive;
@@ -385,6 +350,52 @@ public class GenerateMetadataMojo extend
     @Parameter
     private File thumbnailImage;
 
+
+    /**
+     * Defines the content package type. This is either 'application', 'content', 'container' or 'mixed'.
+     * If omitted, it is calculated automatically based on filter definitions. Certain package types imply restrictions,
+     * for example, 'application' and 'content' packages are not allowed to contain sub packages or embedded bundles.<br>
+     * Possible values:
+     * <ul>
+     *   <li>{@code application}: An application package consists purely of application content. It serializes
+     *       entire subtrees with no inclusion or exclusion filters. it does not contain any subpackages nor OSGi
+     *       configuration or bundles.</li> 
+     *   <li>{@code content}: A content package consists only of content and user defined configuration.
+     *       It usually serializes entire subtrees but can contain inclusion or exclusion filters. it does not contain
+     *       any subpackages nor OSGi configuration or bundles.</li> 
+     *   <li>{@code container}: A container package only contains sub packages and OSGi configuration and bundles.
+     *       The container package is only used as container for deployment.</li> 
+     *   <li>{@code mixed}: Catch all type for a combination of the above.</li> 
+     * </ul>
+     */
+    @Parameter(property = "vault.packageType")
+    protected PackageType packageType;
+
+
+    /**
+     * Defines whether the package is allowed to contain index definitions. This will become the
+     * {@code allowIndexDefinitions} property of the properties.xml file.
+     */
+    @Parameter(
+            property = "vault.allowIndexDefinitions",
+            defaultValue="false",
+            required = true)
+    boolean allowIndexDefinitions;
+
+    /**
+     * Sets the package type.
+     * @param type the string representation of the package type
+     * @throws MojoFailureException if an error occurs
+     */
+    public void setPackageType(String type) throws MojoFailureException {
+        try {
+            packageType = PackageType.valueOf(type.toUpperCase());
+        } catch (IllegalArgumentException e) {
+            throw new MojoFailureException("Invalid package type specified: " + type +".\n" +
+                    "Must be empty or one of 'application', 'content', 'container', 'mixed'");
+        }
+    }
+
     /**
      * Sets the access control handling.
      * @param type the string representation of the ac handling
@@ -394,6 +405,7 @@ public class GenerateMetadataMojo extend
         try {
             accessControlHandling = AccessControlHandling.valueOf(type.toUpperCase());
         } catch (IllegalArgumentException e) {
+            // TODO: emit in lower case
             throw new MojoFailureException("Invalid accessControlHandling specified: " + type +".\n" +
                     "Must be empty or one of '" + StringUtils.join(AccessControlHandling.values(), "','") + "'.");
         }
@@ -418,7 +430,7 @@ public class GenerateMetadataMojo extend
             }
         }
 
-        final File vaultDir = getVaultDir();
+        final File vaultDir = getGeneratedVaultDir();
         vaultDir.mkdirs();
 
         // JCRVLT-331 share work directory to expose vault metadata between process-classes and package phases for
@@ -427,34 +439,32 @@ public class GenerateMetadataMojo extend
                 .put(getModuleArtifactKey(project.getArtifact()), workDirectory);
 
         try {
+            // find the meta-inf source directory
+            File metaInfDirectory = getMetaInfVaultSourceDirectory();
+            
+            // generate the filter.xml
+            String sourceFilters = computeFilters(metaInfDirectory);
+            computeImportPackage();
+
+            // this must happen before the filter rules are extended 
+            // but after filters have been consolidated
+            computePackageTypeIfNotSet();
+            
             // calculate the embeddeds and subpackages
             Map<String, File> embeddedFiles = getEmbeddeds();
             embeddedFiles.putAll(getSubPackages());
             setEmbeddedFilesMap(embeddedFiles);
 
-            // find the meta-inf source directory
-            File metaInfDirectory = getMetaInfDir();
-            
-            // generate the filter.xml
-            computePackageFilters(metaInfDirectory);
-            computeImportPackage();
             String dependenciesString = computeDependencies();
-            
-            // some validations
-            validatePackageType();
-            if (packageType == PackageType.APPLICATION) {
-                validateDependencies();
-            } else {
-                getLog().info("Ignoring dependency validation due to non-application package type: " + packageType);
-            }
 
             // generate properties.xml
             final Properties vaultProperties = computeProperties(dependenciesString);
-            final FileOutputStream fos = new FileOutputStream(new File(vaultDir, "properties.xml"));
-            vaultProperties.storeToXML(fos, project.getName());
-
-            copyFile("/vault/config.xml", new File(vaultDir, "config.xml"));
-            copyFile("/vault/settings.xml", new File(vaultDir, "settings.xml"));
+            try (FileOutputStream fos = new FileOutputStream(new File(vaultDir, Constants.PROPERTIES_XML))) {
+                vaultProperties.storeToXML(fos, project.getName());
+            }
+            writeFilters(sourceFilters);
+            copyFile("/vault/config.xml", new File(vaultDir, Constants.CONFIG_XML));
+            copyFile("/vault/settings.xml", new File(vaultDir, Constants.SETTINGS_XML));
             
             // add package thumbnail
             if (thumbnailImage != null && thumbnailImage.exists()) {
@@ -469,12 +479,13 @@ public class GenerateMetadataMojo extend
             // generate manifest file
             MavenArchiver mavenArchiver = new MavenArchiver();
             Manifest manifest = mavenArchiver.getManifest(session, project, getMavenArchiveConfiguration(vaultProperties, dependenciesString));
-            try (OutputStream out = new FileOutputStream(getManifestFile())) {
+            try (OutputStream out = new FileOutputStream(getGeneratedManifestFile())) {
                 manifest.write(out);
             }
         } catch (IOException | ManifestException | DependencyResolutionRequiredException e) {
             throw new MojoExecutionException(e.toString(), e);
         }
+        buildContext.refresh(vaultDir);
     }
     
     /**
@@ -488,12 +499,13 @@ public class GenerateMetadataMojo extend
      * - if both, a inline filter and a implicit filter is present, the build fails.
      * - re-run the package goal w/o cleaning the target first must work
      *
+     *@return the source filter string (if there have been a filter given manually), otherwise {@code null}
      * @throws IOException if an I/O error occurs
      * @throws MojoExecutionException if the build fails
      */
-    private void computePackageFilters(File vaultMetaDir) throws IOException, MojoExecutionException {
+    private String computeFilters(File vaultMetaDir) throws IOException, MojoExecutionException {
         // backward compatibility: if implicit filter exists, use it. but check for conflicts
-        File filterFile = getFilterFile();
+        File filterFile = getGeneratedFilterFile();
         if (filterFile.exists() && filterFile.lastModified() != 0) {
             // if both, a inline filter and a implicit filter is present, the build fails.
             if (!filters.getFilterSets().isEmpty()) {
@@ -504,13 +516,13 @@ public class GenerateMetadataMojo extend
             try {
                 filters.load(filterFile);
             } catch (ConfigurationException e) {
-                throw new IOException(e);
+                throw new IOException("Error loading filter file '" + filterFile + "'", e);
             }
 
             getLog().warn("The project is using a filter.xml provided via the resource plugin.");
             getLog().warn("This is deprecated and might no longer be supported in future versions.");
             getLog().warn("Use the 'filterSource' property to specify the filter or use inline filters.");
-            return;
+            return null;
         }
 
         // if last modified of vault-work/META-INF/vault/filter.xml == 0 -> delete it
@@ -550,10 +562,11 @@ public class GenerateMetadataMojo extend
             }
 
             // now copy everything from sourceFilter to filters (as the latter is supposed to contain the final filter rules)!
-            sourceFilters.resetSource();
+            // sourceFilters.resetSource();
             // there is no suitable clone nor constructor, therefore use a serialization/deserialization approach
             try (InputStream serializedFilters = sourceFilters.getSource()) {
                 filters.load(serializedFilters);
+                //filters.resetSource();
             } catch (ConfigurationException e) {
                 throw new IllegalStateException("cloning filters failed.", e);
             }
@@ -564,9 +577,8 @@ public class GenerateMetadataMojo extend
             try {
                 sourceFilters.load(filterSource);
             } catch (ConfigurationException e) {
-                throw new IOException(e);
+                throw new IOException("Error loading filter file '" + filterSource + "'", e);
             }
-            sourceFilters.resetSource();
         }
 
         // if the prefix property is set, it should be used if no filter is set
@@ -574,6 +586,22 @@ public class GenerateMetadataMojo extend
             addWorkspaceFilter(prefix);
         }
 
+        return sourceFilters.getSourceAsString();
+    }
+
+    private void mergeFilters(DefaultWorkspaceFilter dst, DefaultWorkspaceFilter src) {
+        for (PathFilterSet fs: src.getFilterSets()) {
+            // check for collision
+            for (PathFilterSet mfs: dst.getFilterSets()) {
+                if (mfs.getRoot().equals(fs.getRoot())) {
+                    throw new IllegalArgumentException("Merging of equal filter roots not allowed for: " + fs.getRoot());
+                }
+            }
+            dst.add(fs);
+        }
+    }
+
+    private void writeFilters(String sourceFilters) throws IOException, MojoExecutionException {
         // if no filter is defined at all, fail
         if (filters.getFilterSets().isEmpty()) {
             if (failOnEmptyFilter) {
@@ -585,8 +613,9 @@ public class GenerateMetadataMojo extend
             }
         }
 
+        File filterFile = getGeneratedFilterFile();
         // if the source filters and the generated filters are the same, copy the source file to retain the comments
-        if (filterSource != null && sourceFilters.getSourceAsString().equals(filters.getSourceAsString())) {
+        if (filterSource != null && filters.getSourceAsString().equals(sourceFilters)) {
             FileUtils.copyFile(filterSource, filterFile);
         } else {
             // generate xml and write to filter.xml
@@ -600,23 +629,13 @@ public class GenerateMetadataMojo extend
         }
     }
 
-    private void mergeFilters(DefaultWorkspaceFilter dst, DefaultWorkspaceFilter src) {
-        for (PathFilterSet fs: src.getFilterSets()) {
-            // check for collision
-            for (PathFilterSet mfs: dst.getFilterSets()) {
-                if (mfs.getRoot().equals(fs.getRoot())) {
-                    throw new IllegalArgumentException("Merging of equal filter roots not allowed for: " + fs.getRoot());
-                }
-            }
-            dst.add(fs);
-        }
-    }
+    
 
 
     /**
      * Checks if the filter roots of this package are covered by the dependencies and also checks for colliding roots
      * in the dependencies.
-     */
+     
     private void validateDependencies() throws MojoExecutionException {
         List<String> errors = new DependencyValidator()
                 .addDependencies(dependencies)
@@ -641,7 +660,7 @@ public class GenerateMetadataMojo extend
         } else {
             getLog().info("All dependencies satisfied.");
         }
-    }
+    }*/
 
     /**
      * Computes the import-package definition from the given bundles if not provided by the project.
@@ -722,10 +741,8 @@ public class GenerateMetadataMojo extend
     private String computeDependencies() throws IOException {
         String dependenciesString = null;
         if (dependencies.length > 0) {
-            dependenciesString = PackageDependency.toString(Dependency.resolve(project, getLog(), dependencies));
+            dependenciesString = org.apache.jackrabbit.vault.packaging.Dependency.toString(MavenBasedPackageDependency.resolve(project, getLog(), dependencies));
         }
-        // this is mainly checking that the dependencies given by the repositoryStructurePackages are valid
-        Dependency.resolve(project, getLog(), repositoryStructurePackages);
         return dependenciesString;
     }
 
@@ -757,11 +774,11 @@ public class GenerateMetadataMojo extend
 
             // TODO: split up manifest generation
             PackageId id = new PackageId(group, name, version);
-            archive.addManifestEntry(MF_KEY_PACKAGE_TYPE, escapeManifestValue(packageType.name().toLowerCase()));
-            archive.addManifestEntry(MF_KEY_PACKAGE_ID, escapeManifestValue(id.toString()));
-            archive.addManifestEntry(MF_KEY_PACKAGE_DESC, escapeManifestValue(vaultProperties.getProperty("description", "")));
+            archive.addManifestEntry(PackageProperties.MF_KEY_PACKAGE_TYPE, escapeManifestValue(packageType.name().toLowerCase()));
+            archive.addManifestEntry(PackageProperties.MF_KEY_PACKAGE_ID, escapeManifestValue(id.toString()));
+            archive.addManifestEntry(PackageProperties.MF_KEY_PACKAGE_DESC, escapeManifestValue(vaultProperties.getProperty("description", "")));
             if (dependenciesString != null && dependenciesString.length() > 0) {
-                archive.addManifestEntry(MF_KEY_PACKAGE_DEPENDENCIES, escapeManifestValue(dependenciesString));
+                archive.addManifestEntry(PackageProperties.MF_KEY_PACKAGE_DEPENDENCIES, escapeManifestValue(dependenciesString));
             }
             // be sure to avoid duplicates
             Set<String> rts = new TreeSet<>();
@@ -770,11 +787,11 @@ public class GenerateMetadataMojo extend
             }
             String[] roots = rts.toArray(new String[rts.size()]);
             Arrays.sort(roots);
-            archive.addManifestEntry(MF_KEY_PACKAGE_ROOTS, escapeManifestValue(StringUtils.join(roots, ",")));
+            archive.addManifestEntry(PackageProperties.MF_KEY_PACKAGE_ROOTS, escapeManifestValue(StringUtils.join(roots, ",")));
 
             // import package is not yet there!
             if (StringUtils.isNotEmpty(importPackage)) {
-                archive.addManifestEntry(MF_KEY_IMPORT_PACKAGE, escapeManifestValue(StringUtils.deleteWhitespace(importPackage)));
+                archive.addManifestEntry(PackageProperties.MF_KEY_IMPORT_PACKAGE, escapeManifestValue(StringUtils.deleteWhitespace(importPackage)));
             }
         }
 
@@ -793,7 +810,7 @@ public class GenerateMetadataMojo extend
                 description = project.getArtifactId();
             }
         }
-        props.put("description", description);
+        props.put(PackageProperties.NAME_DESCRIPTION, description);
 
         // add all user defined properties
         // before the rest of the properties to prevent user
@@ -810,9 +827,9 @@ public class GenerateMetadataMojo extend
         props.putAll(properties);
 
         // package descriptor properties
-        props.put("group", group);
-        props.put("name", name);
-        props.put("version", version);
+        props.put(PackageProperties.NAME_GROUP, group);
+        props.put(PackageProperties.NAME_NAME, name);
+        props.put(PackageProperties.NAME_VERSION, version);
 
         // maven artifact identification
         props.put("groupId", project.getGroupId());
@@ -820,21 +837,21 @@ public class GenerateMetadataMojo extend
 
         // dependencies
         if (dependenciesString != null && dependenciesString.length() > 0) {
-            props.put("dependencies", dependenciesString);
+            props.put(PackageProperties.NAME_DEPENDENCIES, dependenciesString);
         }
 
         // creation stamp
-        if (!props.containsKey("createdBy")) {
-            props.put("createdBy", System.getProperty("user.name"));
+        if (!props.containsKey(PackageProperties.NAME_CREATED_BY)) {
+            props.put(PackageProperties.NAME_CREATED_BY, System.getProperty("user.name"));
         }
-        props.put("created", iso8601DateFormat.format(new Date()));
+        props.put(PackageProperties.NAME_CREATED, iso8601DateFormat.format(new Date()));
 
         // configurable properties
-        props.put("requiresRoot", String.valueOf(requiresRoot));
-        props.put("allowIndexDefinitions", String.valueOf(allowIndexDefinitions));
-        props.put("packageType", packageType.name().toLowerCase());
+        props.put(PackageProperties.NAME_REQUIRES_ROOT, String.valueOf(requiresRoot));
+        props.put(PackageProperties.NAME_ALLOW_INDEX_DEFINITIONS, String.valueOf(allowIndexDefinitions));
+        props.put(PackageProperties.NAME_PACKAGE_TYPE, packageType.name().toLowerCase());
         if (accessControlHandling != null) {
-            props.put("acHandling", accessControlHandling.name().toLowerCase());
+            props.put(PackageProperties.NAME_AC_HANDLING, accessControlHandling.name().toLowerCase());
         }
         return props;
     }
@@ -869,7 +886,7 @@ public class GenerateMetadataMojo extend
             }
             targetPath = makeAbsolutePath(targetPath);
 
-            targetPath = JCR_ROOT + targetPath;
+            targetPath = Constants.ROOT_DIR + "/" + targetPath;
             targetPath = FileUtils.normalize(targetPath);
             if (!targetPath.endsWith("/")) {
                 targetPath += "/";
@@ -910,7 +927,7 @@ public class GenerateMetadataMojo extend
                     }
                 }
                 final String targetPathName = targetPath + destFileName;
-                final String targetNodePathName = targetPathName.substring(JCR_ROOT.length() - 1);
+                final String targetNodePathName = targetPathName.substring(Constants.ROOT_DIR.length());
 
                 getLog().info(String.format("Embedding %s (from %s) -> %s", artifact.getId(), source.getAbsolutePath(), targetPathName));
                 fileMap.put(targetPathName, source);
@@ -927,7 +944,7 @@ public class GenerateMetadataMojo extend
      * Establishes a session-shareable workDirectory lookup map for the given pluginContext.
      *
      * @param pluginContext a Map retrieved from {@link MavenSession#getPluginContext(PluginDescriptor, MavenProject)}.
-     * @return a lookup Map. The key is {@link Artifact#getId()} and value is {@link AbstractPackageMojo#workDirectory}.
+     * @return a lookup Map. The key is {@link Artifact#getId()} and value is {@link AbstractMetadataPackageMojo#workDirectory}.
      */
     @SuppressWarnings("unchecked")
     static Map<String, File> getArtifactWorkDirectoryLookup(final Map pluginContext) {
@@ -1012,24 +1029,22 @@ public class GenerateMetadataMojo extend
                     }
                 } else {
                     // load properties
-                    InputStream in = null;
-                    try (ZipFile zip = new ZipFile(source, ZipFile.OPEN_READ)) {
+                    try (ZipFile zip = new ZipFile(source)) {
                         ZipEntry e = zip.getEntry(propsRelPath);
                         if (e == null) {
                             throw new IOException("Package does not contain 'META-INF/vault/properties.xml'");
                         }
-                        in = zip.getInputStream(e);
-                        props.loadFromXML(in);
+                        try (InputStream in = zip.getInputStream(e)) {
+                            props.loadFromXML(in);
+                        }
                     } catch (IOException e) {
                         throw new MojoFailureException("Could not open subpackage '" + source + "' to extract metadata: " + e.getMessage(), e);
-                    } finally {
-                        IOUtil.close(in);
                     }
                 }
                 PackageId pid = new PackageId(
-                        props.getProperty("group"),
-                        props.getProperty("name"),
-                        props.getProperty("version")
+                        props.getProperty(PackageProperties.NAME_GROUP),
+                        props.getProperty(PackageProperties.NAME_NAME),
+                        props.getProperty(PackageProperties.NAME_VERSION)
                 );
                 final String targetNodePathName = pid.getInstallationPath() + ".zip";
                 final String targetPathName = "jcr_root" + targetNodePathName;
@@ -1060,32 +1075,52 @@ public class GenerateMetadataMojo extend
         return absPath;
     }
 
-    private void validatePackageType() throws MojoFailureException {
+    private void computePackageTypeIfNotSet() {
         if (packageType == null) {
             // auto detect...
             boolean hasApps = false;
             boolean hasOther = false;
             for (PathFilterSet p: filters.getFilterSets()) {
-                if ("cleanup".equals(p.getType())) {
+                if (PathFilterSet.TYPE_CLEANUP.equals(p.getType())) {
                     continue;
                 }
                 String root = p.getRoot();
                 if ("/apps".equals(root) || root.startsWith("/apps/") || "/libs".equals(root) || root.startsWith("/libs/")) {
                     hasApps = true;
+                    getLog().debug("Detected /apps or /libs filter entry: " + p);
                 } else {
                     hasOther = true;
+                    getLog().debug("Detected filter entry outside /apps and /libs: " + p);
                 }
             }
-            if (hasApps && !hasOther) {
-                packageType = PackageType.APPLICATION;
-            } else if (hasOther && !hasApps) {
-                packageType = PackageType.CONTENT;
+            // no embeds and subpackages?
+            getLog().debug("Detected " + embeddeds.length + " bundle(s) and " + subPackages.length + " sub package(s).");
+            if (embeddeds.length == 0 && subPackages.length == 0) {
+                if (hasApps && !hasOther) {
+                    packageType = PackageType.APPLICATION;
+                } else if (hasOther && !hasApps) {
+                    packageType = PackageType.CONTENT;
+                } else {
+                    packageType = PackageType.MIXED;
+                }
             } else {
-                packageType = PackageType.MIXED;
+                if (!hasApps && !hasOther) {
+                    packageType = PackageType.CONTAINER;
+                } else {
+                    packageType = PackageType.MIXED;
+                }
             }
+            getLog().info("Auto-detected package type: " + packageType.toString().toLowerCase());
         }
     }
 
+    /**
+     * Copies from the class loader resource given by {@link source} into the file given in {@link target} in case
+     * the target file does not exist yet.
+     * @param source the name of the class loader resource
+     * @param target the target file to copy to
+     * @throws IOException
+     */
     private void copyFile(String source, File target) throws IOException {
         // nothing to do if the file exists
         if (target.exists()) {
@@ -1094,15 +1129,10 @@ public class GenerateMetadataMojo extend
 
         target.getParentFile().mkdirs();
 
-        InputStream ins = getClass().getResourceAsStream(source);
-        if (ins != null) {
-            OutputStream out = null;
-            try {
-                out = new FileOutputStream(target);
+        try (InputStream ins = getClass().getResourceAsStream(source);
+             OutputStream out = new FileOutputStream(target)) {
+            if (ins != null) {
                 IOUtil.copy(ins, out);
-            } finally {
-                IOUtil.close(ins);
-                IOUtil.close(out);
             }
         }
     }



Mime
View raw message