You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by eo...@apache.org on 2018/12/27 09:09:13 UTC

[maven-assembly-plugin] branch MASSEMBLY-897 created (now 4270098)

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

eolivelli pushed a change to branch MASSEMBLY-897
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git.


      at 4270098  MASSEMBLY-897 zipentry.getSize() returns -1 for regular files in a m-a-p created zip

This branch includes the following new commits:

     new 4270098  MASSEMBLY-897 zipentry.getSize() returns -1 for regular files in a m-a-p created zip

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



[maven-assembly-plugin] 01/01: MASSEMBLY-897 zipentry.getSize() returns -1 for regular files in a m-a-p created zip

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

eolivelli pushed a commit to branch MASSEMBLY-897
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git

commit 4270098be9e608e85ed461442211cdd2d8d877e5
Author: Enrico Olivelli <eo...@apache.org>
AuthorDate: Thu Dec 27 10:08:35 2018 +0100

    MASSEMBLY-897 zipentry.getSize() returns -1 for regular files in a m-a-p created zip
---
 src/it/projects/files/zipentrysize/pom.xml    | 60 +++++++++++++++++++++++++++
 src/it/projects/files/zipentrysize/verify.bsh | 56 +++++++++++++++++++++++++
 2 files changed, 116 insertions(+)

diff --git a/src/it/projects/files/zipentrysize/pom.xml b/src/it/projects/files/zipentrysize/pom.xml
new file mode 100644
index 0000000..42bdf2b
--- /dev/null
+++ b/src/it/projects/files/zipentrysize/pom.xml
@@ -0,0 +1,60 @@
+<?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>
+  <parent>
+    <groupId>org.apache.maven.plugin.assembly.test</groupId>
+    <artifactId>it-project-parent</artifactId>
+    <version>1</version>
+  </parent>
+  
+  <groupId>test</groupId>
+  <artifactId>getSizeTest</artifactId>
+  <version>1.0</version>
+  
+  <name>getSizeTest</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>3.1.0</version>
+        <executions>
+          <execution>
+            <id>assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <tarLongFileMode>posix</tarLongFileMode>
+              <descriptorRefs>
+                <descriptorRef>project</descriptorRef>
+              </descriptorRefs>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/projects/files/zipentrysize/verify.bsh b/src/it/projects/files/zipentrysize/verify.bsh
new file mode 100644
index 0000000..97e4247
--- /dev/null
+++ b/src/it/projects/files/zipentrysize/verify.bsh
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.util.zip.*;
+
+try
+{  
+  boolean foundPom = false;
+  boolean allFilesOk = true;
+  File a = new File( basedir, "target/getSizeTest-1.0-project.zip" );
+  ZipInputStream zis = new ZipInputStream( new FileInputStream( a ) );
+  try {
+     ZipEntry entry = null;     
+     while ((entry = zis.getNextEntry()) != null) {
+	System.out.println( "name: " + entry.getName()
+          + ", size: " + entry.getSize() + ", directory:" + entry.isDirectory() );
+        if ( entry.getSize() <= 0 && !entry.isDirectory() ) {
+            System.out.println( "ERROR: name: " + entry.getName()
+             + ", size: " + entry.getSize() + ", directory:" + entry.isDirectory() );
+            allFilesOk = false;
+        }
+        if ( entry.getName().equals( "pom.xml" ) ) {
+          // verify that we have at least one known file
+          foundPom = true;
+        }
+     }     
+  }
+  finally {
+     zis.close();
+  }
+  return allFilesOk && foundPom;
+}
+catch( Exception e )
+{
+    e.printStackTrace();
+    return false;
+}
+
+