You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/01/12 18:46:28 UTC

[maven-dependency-plugin] 01/04: Unpacking different resources into different location from the same artifact do work.

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

rfscholte pushed a commit to branch MDEP-586
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git

commit e213ac14bf116b5646eea84a6add379621551d35
Author: Andre Tadeu de Carvalho <an...@gmail.com>
AuthorDate: Wed Jan 9 02:47:29 2019 -0200

    Unpacking different resources into different location from the same artifact do work.
---
 .../ResourceArtifact/1.0/ResourceArtifact-1.0.jar  | Bin 0 -> 604 bytes
 .../projects/mdep-586-unpacking-resources/pom.xml  |  85 +++++++++++++++++++++
 .../mdep-586-unpacking-resources/verify.groovy     |  45 +++++++++++
 3 files changed, 130 insertions(+)

diff --git a/src/it/projects/mdep-586-unpacking-resources/lib/test/ResourceArtifact/1.0/ResourceArtifact-1.0.jar b/src/it/projects/mdep-586-unpacking-resources/lib/test/ResourceArtifact/1.0/ResourceArtifact-1.0.jar
new file mode 100644
index 0000000..7c41edc
Binary files /dev/null and b/src/it/projects/mdep-586-unpacking-resources/lib/test/ResourceArtifact/1.0/ResourceArtifact-1.0.jar differ
diff --git a/src/it/projects/mdep-586-unpacking-resources/pom.xml b/src/it/projects/mdep-586-unpacking-resources/pom.xml
new file mode 100644
index 0000000..8733381
--- /dev/null
+++ b/src/it/projects/mdep-586-unpacking-resources/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.maven.plugins.dependency.its</groupId>
+    <artifactId>mdep-586-unpacking-resource</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <description>Unpacking different files in the same JAR in different locations</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>ResourceArtifact</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+
+    <repositories>
+        <repository>
+            <id>lib</id>
+            <url>file:${project.basedir}/lib</url>
+        </repository>
+    </repositories>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>@project.version@</version>
+                <executions>
+                    <execution>
+                        <id>unpack-resource1</id>
+                        <goals>
+                            <goal>unpack-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <includeArtifactIds>ResourceArtifact</includeArtifactIds>
+                            <includes>resource1.txt</includes>
+                            <outputDirectory>resources1</outputDirectory>
+                            <markersDirectory>
+                                ${project.build.directory}/resource1/dependency-maven-plugin-markers
+                            </markersDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>unpack-resource2</id>
+                        <goals>
+                            <goal>unpack-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <includeArtifactIds>ResourceArtifact</includeArtifactIds>
+                            <includes>resource2.txt</includes>
+                            <outputDirectory>resources2</outputDirectory>
+                            <markersDirectory>
+                                ${project.build.directory}/resource2/dependency-maven-plugin-markers
+                            </markersDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/src/it/projects/mdep-586-unpacking-resources/verify.groovy b/src/it/projects/mdep-586-unpacking-resources/verify.groovy
new file mode 100644
index 0000000..ad9e168
--- /dev/null
+++ b/src/it/projects/mdep-586-unpacking-resources/verify.groovy
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+File file = new File( basedir, "build.log" );
+assert file.exists();
+
+try
+{
+    File file1 = new File( basedir, "resources1/resource1.txt" )
+    if ( !file1.exists() || !file1.isFile() )
+    {
+        println( "Error: cannot open file resources1/resource1.txt" )
+        return false
+    }
+    File file2 = new File( basedir, "resources2/resource2.txt" )
+    if ( !file2.exists() || !file2.isFile() )
+    {
+        println( "Error: cannot open file resources2/resource2.txt" )
+        return false
+    }
+}
+catch ( Throwable e )
+{
+    e.printStackTrace()
+    return false;
+}
+
+
+return true
\ No newline at end of file