You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2017/09/11 06:56:42 UTC
svn commit: r1807995 [4/7] - in
/jackrabbit/commons/filevault-package-maven-plugin/trunk: ./ it/ it/src/
it/src/test/ it/src/test/java/ it/src/test/java/org/
it/src/test/java/org/apache/ it/src/test/java/org/apache/jackrabbit/
it/src/test/java/org/apac...
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-contains/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-contains/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-contains/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-contains/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,59 @@
+<!--
+ 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>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-plugin-test-pkg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>content-package</packaging>
+ <name>Packaging test</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin</artifactId>
+ <version>${plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <failOnDependencyErrors>true</failOnDependencyErrors>
+ <filters>
+ <filter>
+ <root>/libs/foo/bar/components/foo</root>
+ </filter>
+ </filters>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ <version>1.0.0</version>
+ <scope>system</scope>
+ <systemPath>${testcontent.directory}/test-package.zip</systemPath>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+</project>
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-contains/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-cover/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-cover/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-cover/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-cover/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,59 @@
+<!--
+ 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>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-plugin-test-pkg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>content-package</packaging>
+ <name>Packaging test</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin</artifactId>
+ <version>${plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <failOnDependencyErrors>true</failOnDependencyErrors>
+ <filters>
+ <filter>
+ <root>/libs/super/project</root>
+ </filter>
+ </filters>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ <version>1.0.0</version>
+ <scope>system</scope>
+ <systemPath>${testcontent.directory}/test-package.zip</systemPath>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+</project>
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-cover/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-maven-deps/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-maven-deps/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-maven-deps/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-maven-deps/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,49 @@
+<!--
+ 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>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-plugin-test-pkg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>content-package</packaging>
+ <name>Packaging test</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin</artifactId>
+ <version>${plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <failOnDependencyErrors>true</failOnDependencyErrors>
+ <filters>
+ <filter>
+ <root>/libs/foo</root>
+ </filter>
+ </filters>
+ <dependencies>
+ <dependency>
+ <group>org/apache</group>
+ <name>jackrabbit.content</name>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/fail-no-maven-deps/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/no-errors/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/no-errors/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/no-errors/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/no-errors/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,62 @@
+<!--
+ 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>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-plugin-test-pkg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>content-package</packaging>
+ <name>Packaging test</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin</artifactId>
+ <version>${plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <failOnDependencyErrors>true</failOnDependencyErrors>
+ <filters>
+ <filter>
+ <root>/var/foo/bar/components</root>
+ </filter>
+ <filter>
+ <root>/tmp/foo</root>
+ </filter>
+ </filters>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ <version>1.0.0</version>
+ <scope>system</scope>
+ <systemPath>${testcontent.directory}/test-package.zip</systemPath>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+</project>
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/no-errors/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/repo-structure-pkg/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/repo-structure-pkg/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/repo-structure-pkg/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/repo-structure-pkg/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,62 @@
+<!--
+ 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>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-plugin-test-pkg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>content-package</packaging>
+ <name>Packaging test</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin</artifactId>
+ <version>${plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <failOnDependencyErrors>true</failOnDependencyErrors>
+ <filters>
+ <filter>
+ <root>/var/foo/bar/components</root>
+ </filter>
+ <filter>
+ <root>/tmp/foo</root>
+ </filter>
+ </filters>
+ <repositoryStructurePackages>
+ <repositoryStructurePackage>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ </repositoryStructurePackage>
+ </repositoryStructurePackages>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.apache.jackrabbit.filevault</groupId>
+ <artifactId>test.content.package</artifactId>
+ <version>1.0.0</version>
+ <scope>system</scope>
+ <systemPath>${testcontent.directory}/test-package.zip</systemPath>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+</project>
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/it/src/test/resources/test-projects/validate-deps-projects/repo-structure-pkg/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/parent/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Sep 11 06:56:40 2017
@@ -0,0 +1,7 @@
+target
+.idea
+.classpath
+.project
+.settings
+*.iml
+.DS_Store
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/parent/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/parent/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/parent/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,132 @@
+<?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/xsd/maven-4.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 -->
+ <!-- ====================================================================== -->
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>10</version>
+ <relativePath />
+ </parent>
+
+ <!-- ====================================================================== -->
+ <!-- P R O J E C T D E S C R I P T I O N -->
+ <!-- ====================================================================== -->
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Apache Jackrabbit FileVault - Package Maven Plugin Reactor</name>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+
+ <!-- ====================================================================== -->
+ <!-- S C M D E F I N I T I O N -->
+ <!-- ====================================================================== -->
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk/parent</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk/parent</developerConnection>
+ <url>http://svn.apache.org/viewvc/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk/parent</url>
+ </scm>
+
+ <mailingLists>
+ <mailingList>
+ <name>Jackrabbit Developer List</name>
+ <subscribe>dev-subscribe@jackrabbit.apache.org</subscribe>
+ <unsubscribe>dev-unsubscribe@jackrabbit.apache.org</unsubscribe>
+ <post>mailto:dev@jackrabbit.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/jackrabbit-dev/</archive>
+ </mailingList>
+
+ <mailingList>
+ <name>Jackrabbit User List</name>
+ <subscribe>users-subscribe@jackrabbit.apache.org</subscribe>
+ <unsubscribe>users-unsubscribe@jackrabbit.apache.org</unsubscribe>
+ <post>mailto:users@jackrabbit.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/jackrabbit-users/</archive>
+ </mailingList>
+ </mailingLists>
+
+ <issueManagement>
+ <url>https://issues.apache.org/jira/browse/JCRVLT</url>
+ </issueManagement>
+
+ <!-- ====================================================================== -->
+ <!-- B U I L D D E F I N I T I O N -->
+ <!-- ====================================================================== -->
+ <build>
+ <plugins>
+ <!-- ====================================================================== -->
+ <!-- C O M P I L ER P L U G I N -->
+ <!-- ====================================================================== -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ <debug>true</debug>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>false</optimize>
+ </configuration>
+ </plugin>
+ <!-- ====================================================================== -->
+ <!-- R A T P L U G I N -->
+ <!-- ====================================================================== -->
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.12</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
\ No newline at end of file
Propchange: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Sep 11 06:56:40 2017
@@ -0,0 +1,7 @@
+target
+.idea
+.classpath
+.project
+.settings
+*.iml
+.DS_Store
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/pom.xml?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/pom.xml (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/pom.xml Mon Sep 11 06:56:40 2017
@@ -0,0 +1,293 @@
+<?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 ">
+ <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 -->
+ <!-- ====================================================================== -->
+ <parent>
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-maven-plugin-parent</artifactId>
+ <relativePath>../parent/pom.xml</relativePath>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- ====================================================================== -->
+ <!-- P R O J E C T D E S C R I P T I O N -->
+ <!-- ====================================================================== -->
+ <artifactId>package-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+
+ <name>Apache Jackrabbit FileVault - Package Maven Plugin</name>
+ <description>Maven Plugin supporting creation of content packages.</description>
+
+ <prerequisites>
+ <maven>3.2.5</maven>
+ </prerequisites>
+
+ <properties>
+ <mavenVersion>3.2.5</mavenVersion>
+ <aether.version>1.0.2.v20150114</aether.version>
+ </properties>
+
+ <!-- ====================================================================== -->
+ <!-- S C M D E F I N I T I O N -->
+ <!-- ====================================================================== -->
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin</developerConnection>
+ <url>http://svn.apache.org/viewvc/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin</url>
+ </scm>
+
+ <!-- ====================================================================== -->
+ <!-- B U I L D D E F I N I T I O N -->
+ <!-- ====================================================================== -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.5</version>
+ <executions>
+ <execution>
+ <id>default-descriptor</id>
+ <phase>process-classes</phase>
+ </execution>
+ <!-- if you want to generate help goal -->
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0</version>
+ </plugin>
+ </plugins>
+
+ <!-- ====================================================================== -->
+ <!-- P L U G I N M A N A G E M E N T -->
+ <!-- ====================================================================== -->
+ <pluginManagement>
+ <plugins>
+ <!--
+ This plugin's configuration is used to store Eclipse m2e settings only.
+ It has no influence on the Maven build itself.
+ -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.apache.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-dependency-plugin
+ </artifactId>
+ <versionRange>
+ [2.1,)
+ </versionRange>
+ <goals>
+ <goal>
+ unpack-dependencies
+ </goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ </build>
+
+ <!-- ====================================================================== -->
+ <!-- R E P O R T I N G -->
+ <!-- ====================================================================== -->
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ <report>dependencies</report>
+ <report>license</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <!-- ====================================================================== -->
+ <!-- D E P E N D E N C I E S -->
+ <!-- ====================================================================== -->
+ <dependencies>
+ <!-- Maven Plugin stuff -->
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>3.0-alpha-2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-compat</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>3.0.0</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.0.22</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>findbugs</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <!-- bundle tools -->
+ <dependency>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>biz.aQute.bndlib</artifactId>
+ <version>3.3.0</version>
+ </dependency>
+ <!-- class analyzer -->
+ <dependency>
+ <groupId>io.github.lukehutch</groupId>
+ <artifactId>fast-classpath-scanner</artifactId>
+ <version>2.0.21</version>
+ </dependency>
+
+ <!-- oak:index definition checker -->
+ <dependency>
+ <groupId>org.jsoup</groupId>
+ <artifactId>jsoup</artifactId>
+ <version>1.10.3</version>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <version>1.14</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-testing</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <version>3.3.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.json</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>${aether.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-aether-provider</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractEmbeddedsMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractEmbeddedsMojo.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractEmbeddedsMojo.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AbstractEmbeddedsMojo.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,55 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Base class for mojos which use embedded artifacts.
+ */
+abstract class AbstractEmbeddedsMojo extends AbstractMojo {
+
+ /**
+ * The Maven project.
+ */
+ @Parameter(property = "project", readonly = true, required = true)
+ protected MavenProject project;
+
+ /**
+ * list of embedded bundles
+ */
+ @Parameter
+ protected final List<Embedded> embeddeds = new ArrayList<Embedded>();
+
+ /**
+ * Defines whether to fail the build when an embedded artifact is not
+ * found in the project's dependencies
+ * @since 0.0.12
+ */
+ @Parameter(property = "vault.failOnMissingEmbed", defaultValue = "false", required = true)
+ protected boolean failOnMissingEmbed;
+
+ public void addEmbedded(final Embedded embedded) {
+ embeddeds.add(embedded);
+ }
+
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AnalyzeClassesMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AnalyzeClassesMojo.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AnalyzeClassesMojo.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/AnalyzeClassesMojo.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,80 @@
+/*
+ * 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 java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import aQute.bnd.osgi.Processor;
+
+/**
+ * Maven goal which analyzes the generated class files and generates a usage report
+ */
+@Mojo(
+ name = "analyze-classes",
+ defaultPhase = LifecyclePhase.PROCESS_CLASSES,
+ requiresDependencyResolution = ResolutionScope.COMPILE
+)
+public class AnalyzeClassesMojo extends AbstractEmbeddedsMojo {
+
+ /**
+ * Location of class files
+ */
+ @Parameter(property = "vault.classesDirectory", defaultValue = "${project.build.outputDirectory}")
+ private File sourceDirectory;
+
+ /**
+ * Controls if the output should contain the package report.
+ */
+ @Parameter(property = "vault.showPackageReport", defaultValue = "true")
+ private boolean showImportPackageReport;
+
+ /**
+ * File to store the generated manifest snippet.
+ */
+ @Parameter(property = "vault.generatedImportPackage", defaultValue = "${project.build.directory}/vault-generated-import.txt")
+ private File generatedImportPackage;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ try {
+ getLog().info("Analyzing java package dependencies.");
+ ImportPackageBuilder builder = new ImportPackageBuilder()
+ .withDependenciesFromProject(project)
+ .withClassFileDirectory(sourceDirectory)
+ .analyze();
+
+ String report = builder.createExportPackageReport();
+ if (showImportPackageReport) {
+ getLog().info(report);
+ }
+
+ String importParams = Processor.printClauses(builder.getImportParameters());
+ FileUtils.write(generatedImportPackage, importParams, "utf-8");
+
+ } catch (IOException e) {
+ throw new MojoExecutionException("Error while analysing imports", e);
+ }
+ }
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/CheckSignatureMojo.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/CheckSignatureMojo.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/CheckSignatureMojo.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/CheckSignatureMojo.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,179 @@
+/*
+ * 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 java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+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.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.codehaus.mojo.animal_sniffer.ClassListBuilder;
+import org.codehaus.mojo.animal_sniffer.SignatureChecker;
+import org.codehaus.mojo.animal_sniffer.maven.MavenLogger;
+import org.codehaus.mojo.animal_sniffer.maven.Signature;
+
+/**
+ * Maven goal which checks the embedded libraries against a defined
+ * signature. Based on the Animal Sniffer project.
+ */
+@Mojo(
+ name = "check-signature",
+ defaultPhase = LifecyclePhase.PROCESS_CLASSES,
+ requiresDependencyResolution = ResolutionScope.COMPILE
+)
+public class CheckSignatureMojo extends AbstractEmbeddedsMojo {
+
+ /**
+ */
+ @Component
+ private ArtifactFactory artifactFactory;
+
+ /**
+ * Project classpath.
+ */
+ @Parameter(property = "project.compileClasspathElements", required = true, readonly = true)
+ private List classpathElements;
+
+ /**
+ * Class names to ignore signatures for (wildcards accepted).
+ */
+ @Parameter
+ private String[] ignores;
+
+ /**
+ */
+ @Parameter(property = "localRepository", readonly = true)
+ private ArtifactRepository localRepository;
+
+ /**
+ */
+ @Component
+ private ArtifactResolver resolver;
+
+ /**
+ * Signature module to use.
+ */
+ @Parameter
+ private Signature signature;
+
+ /**
+ * If true, skip the signature check.
+ */
+ @Parameter(property = "vault.checksignature.skip", defaultValue="false")
+ private boolean skipCheckSignature;
+
+ /**
+ * List of packages defined in the application.
+ */
+ private Set<String> buildPackageList() throws IOException {
+ ClassListBuilder plb = new ClassListBuilder(new MavenLogger(getLog()));
+ for (Object classpathElement : classpathElements) {
+ String path = (String) classpathElement;
+ plb.process(new File(path));
+ }
+ return plb.getPackages();
+ }
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (skipCheckSignature) {
+ getLog().info("Skipping signature check.");
+ return;
+ }
+ if (signature == null) {
+ getLog().info("No signature defined. Skipping signature check.");
+ return;
+ }
+
+ try {
+ getLog().info("Checking unresolved references to " + signature);
+
+ org.apache.maven.artifact.Artifact a = signature.createArtifact(artifactFactory);
+
+ resolver.resolve(a, project.getRemoteArtifactRepositories(), localRepository);
+ // just check code from this module
+ final Set<String> ignoredPackages = buildPackageList();
+
+ if (ignores != null) {
+ for (String ignore : ignores) {
+ if (ignore == null) {
+ continue;
+ }
+ ignoredPackages.add(ignore.replace('.', '/'));
+ }
+ }
+
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(ignoredPackages.toString());
+ }
+
+ final SignatureChecker signatureChecker = new SignatureChecker(new FileInputStream(a.getFile()),
+ ignoredPackages, new MavenLogger(getLog()));
+ signatureChecker.setCheckJars(true);
+ signatureChecker.setSourcePath(Collections.singletonList(new File(project.getBuild().getSourceDirectory())));
+ signatureChecker.process(getEmbeddeds().toArray(new File[0]));
+
+ if (signatureChecker.isSignatureBroken()) {
+ throw new MojoFailureException(
+ "Signature errors found. Verify them and put @IgnoreJRERequirement on them.");
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to check signatures", e);
+ } catch (AbstractArtifactResolutionException e) {
+ throw new MojoExecutionException("Failed to obtain signature: " + signature, e);
+ }
+ }
+
+ private Collection<File> getEmbeddeds() throws MojoFailureException {
+ Set<File> files = new HashSet<File>();
+ for (Embedded emb : embeddeds) {
+ final List<Artifact> artifacts = emb.getMatchingArtifacts(project);
+ if (artifacts.isEmpty()) {
+ if (failOnMissingEmbed) {
+ throw new MojoFailureException(
+ "Embedded artifact specified "
+ + emb
+ + ", but no matching dependency artifact found. Add the missing dependency or fix the embed definition.");
+ } else {
+ getLog().warn("No matching artifacts for " + emb);
+ continue;
+ }
+ }
+
+ for (Artifact artifact : artifacts) {
+ final File source = artifact.getFile();
+ files.add(source);
+ }
+ }
+ return files;
+ }
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ContentPackageArchiver.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ContentPackageArchiver.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ContentPackageArchiver.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/ContentPackageArchiver.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,28 @@
+/*
+ * 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 org.codehaus.plexus.archiver.jar.JarArchiver;
+
+public class ContentPackageArchiver extends JarArchiver {
+
+ public ContentPackageArchiver() {
+ super();
+ archiveType = "content-package";
+ }
+
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Dependency.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Dependency.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Dependency.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Dependency.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,186 @@
+/*
+ * 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 javax.annotation.Nullable;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.StringUtils;
+
+import org.apache.jackrabbit.filevault.maven.packaging.impl.PackageInfo;
+
+/**
+ * The <code>Dependency</code> class represents a dependency to another content
+ * package. A dependency consists of a group name, a package name and a version
+ * range.
+ * <p>
+ * A dependency is declared as a <code><dependency></code> element of a list
+ * style <code><dependencies></code> element:
+ * <p>
+ * <pre>
+ * <dependency>
+ * <group>theGroup</group>
+ * <name>theName</name>
+ * <version>1.5</version>
+ * </dependency>
+ * </pre>
+ * <p>
+ * The dependency can also reference a maven project dependency, this is preferred
+ * as it yields to more robust builds.
+ * <p>
+ * <pre>
+ * <dependency>
+ * <groupId>theGroup</groupId>
+ * <artifactId>theName</artifactId>
+ * </dependency>
+ * </pre>
+ * <p>
+ * <p>
+ * The <code>versionRange</code> 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>()</code> or excluded using brackets <code>[]</code>.
+ */
+public class Dependency {
+
+ /**
+ * The group name, required for package-id references
+ */
+ @Parameter
+ private String group;
+
+ /**
+ * The group id, required for maven coordinate references
+ */
+ @Parameter
+ private String groupId;
+
+ /**
+ * The package name, required for package-id references.
+ */
+ @Parameter
+ private String name;
+
+ /**
+ * The artifact id, required for maven coordinate references
+ */
+ @Parameter
+ private String artifactId;
+
+ /**
+ * The version range (optional)
+ */
+ @Parameter
+ private String version;
+
+ /**
+ * Package information of this dependency. only available for maven referenced dependencies after {@link #resolve(MavenProject, Log)}
+ */
+ private PackageInfo info;
+
+ /**
+ * Resolved package dependency. only available after {@link #resolve(MavenProject, Log)}
+ */
+ private PackageDependency dependency;
+
+ /**
+ * Converts a list of {@link Dependency} instances to vault dependencies.
+ *
+ * @param log the Logger
+ * @param dependencyList The list of {@link Dependency} instances to convert.
+ * @return The Vault Packaging Dependency representing the dependencies.
+ */
+ static PackageDependency[] resolve(final MavenProject project, final Log log, final Dependency... dependencyList) throws IOException {
+ PackageDependency[] dependencies = new PackageDependency[dependencyList.length];
+ for (int i = 0; i < dependencies.length; i++) {
+ dependencies[i] = dependencyList[i].resolve(project, log);
+ }
+ return dependencies;
+ }
+
+ /**
+ * Helper method for {@link #toString)} to convert an instance of this
+ * class to a Vault Packaging Dependency for easy string conversion.
+ */
+ private PackageDependency resolve(final MavenProject project, final Log log) throws IOException {
+ if (StringUtils.isEmpty(group) || StringUtils.isEmpty(name)) {
+ log.warn("Using package id in dependencies is deprecated. use maven coordinates instead: " + group + ":" + name);
+ }
+ if (!StringUtils.isEmpty(groupId) && !StringUtils.isEmpty(artifactId)) {
+ for (Artifact a : project.getDependencyArtifacts()) {
+ if (a.getArtifactId().equals(artifactId) && a.getGroupId().equals(groupId)) {
+ PackageInfo info = PackageInfo.read(a.getFile());
+ if (info != null) {
+ PackageId id = info.getId();
+ group = id.getGroup();
+ name = id.getName();
+ if (StringUtils.isEmpty(version)) {
+ version = new VersionRange(id.getVersion(), true, null, false).toString();
+ }
+ this.info = info;
+ break;
+ } else {
+ throw new IOException("Specified dependency " + this + " is not a package.");
+ }
+ }
+ }
+ }
+ if (StringUtils.isEmpty(group) || StringUtils.isEmpty(name)) {
+ throw new IOException("Specified dependency " + this + " is not qualified.");
+ }
+ VersionRange range = StringUtils.isEmpty(version) ? VersionRange.INFINITE : VersionRange.fromString(version);
+ return dependency = new PackageDependency(group, name, range);
+ }
+
+ /**
+ * Returns the package info or {@code null}.
+ *
+ * @return the info.
+ */
+ @Nullable
+ public PackageInfo getInfo() {
+ return info;
+ }
+
+ /**
+ * Returns the package dependency or {@code null} if not resolved.
+ *
+ * @return the package dependency.
+ */
+ @Nullable
+ public PackageDependency getPackageDependency() {
+ return dependency;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("Dependency{");
+ sb.append("group='").append(group).append('\'');
+ sb.append(", groupId='").append(groupId).append('\'');
+ sb.append(", name='").append(name).append('\'');
+ sb.append(", artifactId='").append(artifactId).append('\'');
+ sb.append(", version='").append(version).append('\'');
+ sb.append('}');
+ return sb.toString();
+ }
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/DependencyValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/DependencyValidator.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/DependencyValidator.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/DependencyValidator.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,117 @@
+/*
+ * 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.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+
+import org.apache.jackrabbit.filevault.maven.packaging.impl.DefaultWorkspaceFilter;
+import org.apache.jackrabbit.filevault.maven.packaging.impl.PackageInfo;
+import org.apache.jackrabbit.filevault.maven.packaging.impl.PathFilterSet;
+
+/**
+ * {@code DependencyValidator}...
+ */
+public class DependencyValidator {
+
+ private List<Dependency> dependencies = new LinkedList<>();
+
+ private DefaultWorkspaceFilter filters;
+
+ private List<String> errors = new LinkedList<String>();
+
+ public DependencyValidator addDependencies(Dependency ... dependencies) {
+ this.dependencies.addAll(Arrays.asList(dependencies));
+ return this;
+ }
+
+ public DependencyValidator setFilters(DefaultWorkspaceFilter filters) {
+ this.filters = filters;
+ return this;
+ }
+
+ public List<String> getErrors() {
+ return errors;
+ }
+
+ /**
+ * Checks if the filter roots of this package are covered by the dependencies and also checks for colliding roots
+ * in the dependencies.
+ */
+ public DependencyValidator validate() {
+ // check for overlapping dependency roots
+ Map<String, Dependency> roots = new HashMap<String, Dependency>();
+ for (Dependency dep: dependencies) {
+ PackageInfo info = dep.getInfo();
+ if (info == null) {
+ String msg = String.format("Dependency '%s' is not using maven coordinates and cannot be used for analysis.", dep.getPackageDependency());
+ errors.add(msg);
+ continue;
+ }
+ for (PathFilterSet set : info.getFilter().getFilterSets()) {
+ String root = set.getRoot();
+ Dependency existing = roots.get(root);
+ if (existing != null) {
+ String msg = String.format("Dependency '%s' defines same filter root '%s' as dependency '%s'",
+ dep.getPackageDependency(), root, existing.getPackageDependency());
+ errors.add(msg);
+ }
+ roots.put(root, dep);
+ }
+ }
+ // check that this filter is covered.
+ Set<String> ancestors = new HashSet<String>();
+ for (PathFilterSet set: filters.getFilterSets()) {
+ String root = StringUtils.substringBeforeLast(set.getRoot(), "/");
+ // ignore root node as ancestor
+ if ("/".equals(root)) {
+ continue;
+ }
+ ancestors.add(root);
+ }
+ for (String root: ancestors) {
+ String isCovered = null;
+ boolean isContained = false;
+ for (Dependency dep: roots.values()) {
+ DefaultWorkspaceFilter filter = dep.getInfo().getFilter();
+ if (filter.contains(root)) {
+ isContained = true;
+ }
+ if (filter.covers(root)) {
+ isCovered = dep.getPackageDependency().toString();
+ }
+ }
+ if (!isContained) {
+ String msg;
+ if (isCovered == null) {
+ msg = String.format("Filter root's ancestor '%s' is not covered by any of the specified dependencies.", root);
+ } else {
+ msg = String.format("Filter root's ancestor '%s' is covered by '%s' but excluded by its patterns.", root, isCovered);
+ }
+ errors.add(msg);
+ }
+ }
+ return this;
+ }
+}
\ No newline at end of file
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Embedded.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Embedded.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Embedded.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Embedded.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,195 @@
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.project.MavenProject;
+
+import org.apache.jackrabbit.filevault.maven.packaging.impl.StringFilterSet;
+
+/**
+ * The <code>Embedded</code> class represents an embedded artifact dependency
+ * from the project descriptor. Such an embedding is declared in
+ * <code><embedded></code> elements inside the list style
+ * <code><embeddeds></code> element as follows:
+ *
+ * <pre>
+ * <embedded>
+ * <groupId>artifact.groupId.pattern</groupId>
+ * <artifactId>artifact.artifactId.pattern</artifactId>
+ * <scope>compile</scope>
+ * <type>jar</type>
+ * <classifier>sources</classifier>
+ * <filter>true</filter>
+ * <target>/libs/sling/install</target>
+ * </embedded>
+ * </pre>
+ */
+public class Embedded {
+
+ /**
+ * A group filter string, consisted of one or several comma separated patterns.
+ * @parameter type="String"
+ */
+ private final StringFilterSet groupId = new StringFilterSet();
+
+ /**
+ * A artifact filter string, consisted of one or several comma separated patterns.
+ * @parameter type="String"
+ */
+ private final StringFilterSet artifactId = new StringFilterSet();
+
+ /**
+ * @parameter
+ */
+ private ScopeArtifactFilter scope;
+
+ /**
+ * @parameter
+ * @since 0.0.4
+ */
+ private String type;
+
+ /**
+ * @parameter
+ * @since 0.0.4
+ */
+ private String classifier;
+
+ /**
+ * If <code>true</code> a filter entry will be generated for all embedded artifacts.
+ * @parameter
+ */
+ private boolean filter;
+
+ /**
+ * Target location.
+ * @parameter
+ */
+ private String target;
+
+ /**
+ * Name to use for the artifact in the destination
+ * @since 0.0.5
+ * @parameter
+ */
+ private String destFileName;
+
+ private boolean excludeTransitive;
+
+ public void setGroupId(String groupId) {
+ this.groupId.addEntries(groupId);
+ }
+
+ public void setArtifactId(String artifactId) {
+ this.artifactId.addEntries(artifactId);
+ }
+
+ public void setScope(String scope) {
+ this.scope = new ScopeArtifactFilter(scope);
+ }
+
+ public void setAddFilter(boolean filter) {
+ this.filter = filter;
+ }
+
+ public boolean isFilter() {
+ return filter;
+ }
+
+ public String getDestFileName() {
+ return destFileName;
+ }
+
+ public void setDestFileName(String destFileName) {
+ this.destFileName = destFileName;
+ }
+
+ public void setTarget(String target) {
+ // need trailing slash
+ if (!target.endsWith("/")) {
+ target += "/";
+ }
+
+ this.target = target;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setExcludeTransitive(boolean excludeTransitive) {
+ this.excludeTransitive = excludeTransitive;
+ }
+
+ public boolean isExcludeTransitive() {
+ return excludeTransitive;
+ }
+
+ public List<Artifact> getMatchingArtifacts(final MavenProject project) {
+
+ // get artifacts depending on whether we exclude transitives or not
+ final Set<Artifact> deps;
+ if (excludeTransitive) {
+ // only direct dependencies, transitives excluded
+ deps = project.getDependencyArtifacts();
+ } else {
+ // all dependencies, transitives included
+ deps = project.getArtifacts();
+ }
+
+ final List<Artifact> matches = new ArrayList<Artifact>();
+ for (Artifact artifact : deps) {
+ if (groupId.contains(artifact.getGroupId())
+ && artifactId.contains(artifact.getArtifactId())
+ && (scope == null || scope.include(artifact))
+ && (type == null || type.equals(artifact.getType()))
+ && (classifier == null || classifier.equals(artifact.getClassifier()))) {
+ matches.add(artifact);
+ }
+ }
+ return matches;
+ }
+
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("Embedded: ");
+ if (groupId != null) {
+ builder.append("groupId=").append(groupId).append(",");
+ }
+ if (artifactId != null) {
+ builder.append("artifactId=").append(artifactId).append(",");
+ }
+ if (scope != null) {
+ builder.append("scope=").append(scope).append(",");
+ }
+ builder.append("filter=").append(filter);
+ builder.append(",excludeTransitive=").append(excludeTransitive);
+ if (target != null) {
+ builder.append(",target=").append(target);
+ }
+ if (destFileName != null) {
+ builder.append(",destFileName=").append(destFileName);
+ }
+ return builder.toString();
+ }
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FileValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FileValidator.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FileValidator.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/FileValidator.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,129 @@
+/*
+ * 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.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.parser.Parser;
+
+/**
+ * This helper class checks for index definitions within packages
+ */
+public class FileValidator {
+ public boolean isContainingIndexDef;
+
+ //store entries of index found in META-INF/vault/filter.xml
+ List<String> indexPaths = new ArrayList<String>();
+
+ //store entries of index found in _oak_index/.content.xml
+ Map<String, String> foundIndexes = new HashMap<String, String>();
+
+ public void lookupIndexDefinitionInArtifact(InputStream artifactFileInputStream, String artifactName) throws IOException, MojoExecutionException {
+ if (artifactName.endsWith("zip")) {
+ ZipInputStream zipArtifactStream = new ZipInputStream(artifactFileInputStream);
+ String entryName = "";
+ ZipEntry entry = zipArtifactStream.getNextEntry();
+ while (entry != null) {
+ entryName = entry.getName();
+ if (entryName.endsWith("zip")) {
+ //recur if the entry is a zip file
+ lookupIndexDefinitionInArtifact(zipArtifactStream, artifactName + "/" + entryName);
+ } else if ("META-INF/vault/filter.xml".equals(entryName) || entryName.contains("/_oak_index/")) {
+ //if entry is an vault filter file or an oak index definition file, parse it to check for indexes
+ this.parseXMLForIndexDefinition(zipArtifactStream, entryName, artifactName + "/" + entryName);
+ }
+ entry = zipArtifactStream.getNextEntry();
+ }
+ } else if ("META-INF/vault/filter.xml".equals(artifactName) || artifactName.contains("/_oak_index/")) {
+ //if entry is an vault filter file or an oak index definition file, parse it to check for indexes
+ this.parseXMLForIndexDefinition(artifactFileInputStream, artifactName, artifactName);
+ }
+ }
+
+ private void parseXMLForIndexDefinition(InputStream xmlInputStream, String entryName, String absoluteEntryName) throws MojoExecutionException {
+ try {
+ Document xml = Jsoup.parse(xmlInputStream, "UTF-8", "", Parser.xmlParser());
+ if ("META-INF/vault/filter.xml".equals(entryName)) {
+ for (Element filter : xml.select("filter[root]")) {
+ String root = filter.attr("root");
+ int oakIndexPosition = root.indexOf("/oak:index");
+ if (oakIndexPosition >= 0) {
+ isContainingIndexDef = true;
+ int nextSlash = root.indexOf("/", oakIndexPosition + "oak:index".length() + 2);
+ String baseIndexPath;
+
+ if (nextSlash > -1) {
+ baseIndexPath = root.substring(0, nextSlash);
+ } else {
+ baseIndexPath = root;
+ }
+ indexPaths.add(baseIndexPath);
+ }
+
+ }
+ } else if (entryName.contains("/_oak_index/")) {
+ String basePath = entryName.substring(8).replace("_oak_index", "oak:index").replace("/.content.xml", "");
+
+ // search for "jcr:primaryType" properties that have a value ending in oak:QueryIndexDefinition
+ // as it can also be "{Name}oak:QueryIndexDefinition"
+ for (Element element : xml.select("*[jcr:primaryType$=oak:QueryIndexDefinition]")) {
+ String xmlPath = getXmlPath(element);
+ String jcrPath = StringUtils.removeStart(xmlPath, "/jcr:root");
+ foundIndexes.put(basePath + jcrPath, absoluteEntryName);
+ }
+ }
+ } catch (Exception e) {
+ throw new MojoExecutionException("Error while trying to parse xml " + absoluteEntryName, e);
+ }
+ }
+
+ private static String getXmlPath(Element element) {
+ if (element.ownerDocument() == element) {
+ return "";
+ } else {
+ return getXmlPath(element.parent()) + "/" + element.nodeName();
+ }
+ }
+
+ public String getMessageWithPathsOfIndexDef() {
+ StringBuilder msg = new StringBuilder();
+
+ for (String path : indexPaths) {
+ String completePath = foundIndexes.get(path);
+
+ if (completePath != null) {
+ msg.append(" Package contains index ").append(path).append(" in ").append(completePath).append(".").append(System.lineSeparator());
+ } else {
+ msg.append(" Package contains index ").append(path).append(" in filter, but not in package. Existing index will be removed.").append(System.lineSeparator());
+ }
+ }
+ return msg.toString();
+ }
+}
Added: jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Filter.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Filter.java?rev=1807995&view=auto
==============================================================================
--- jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Filter.java (added)
+++ jackrabbit/commons/filevault-package-maven-plugin/trunk/plugin/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/Filter.java Mon Sep 11 06:56:40 2017
@@ -0,0 +1,90 @@
+/*
+ * 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 org.apache.jackrabbit.filevault.maven.packaging.impl.DefaultPathFilter;
+import org.apache.jackrabbit.filevault.maven.packaging.impl.ImportMode;
+import org.apache.jackrabbit.filevault.maven.packaging.impl.PathFilterSet;
+
+public class Filter {
+
+ /**
+ * General format:
+ *
+ * <pre>
+ *
+ * <filter>
+ * <root>/var</root>
+ * <mode>merge</mode>
+ * <includes>
+ * <include>dam/sharepoint(/.*)?</include>
+ * <include>/var/dam</include>
+ * </includes>
+ * </filter>
+ * </pre>
+ */
+
+ static final String INDENT = " ";
+
+ private String root;
+
+ /** ImportMode defaulting to REPLACE */
+ private ImportMode mode = ImportMode.REPLACE;
+
+ private final IncludeExcludeList includes = new IncludeExcludeList();
+
+ private final IncludeExcludeList excludes = new IncludeExcludeList();
+
+ public Filter() {
+ }
+
+ public Filter(String root) {
+ setRoot(root);
+ }
+
+ public void setRoot(final String root) {
+ this.root = root;
+ }
+
+ public String getRoot() {
+ return root;
+ }
+
+ public void setMode(String mode) {
+ if (mode != null) {
+ this.mode = ImportMode.valueOf(mode.toUpperCase());
+ }
+ }
+
+ public ImportMode getMode() {
+ return mode;
+ }
+
+ public PathFilterSet toPathFilterSet() {
+ PathFilterSet set = new PathFilterSet();
+ set.setRoot(root);
+ set.setImportMode(mode);
+ for (String pattern: includes) {
+ set.addInclude(new DefaultPathFilter(pattern));
+ }
+ for (String pattern: excludes) {
+ set.addExclude(new DefaultPathFilter(pattern));
+ }
+ return set;
+ }
+
+}