Ability to create tar.gz files from the zip
diff --git a/tomee-patch-core/pom.xml b/tomee-patch-core/pom.xml
index 7896d0b..60bae10 100644
--- a/tomee-patch-core/pom.xml
+++ b/tomee-patch-core/pom.xml
@@ -82,6 +82,11 @@
       <version>0.10</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-compress</artifactId>
+      <version>1.20</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.10</version>
diff --git a/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/ZipToTar.java b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/ZipToTar.java
new file mode 100644
index 0000000..cd9bd53
--- /dev/null
+++ b/tomee-patch-core/src/main/java/org/apache/tomee/patch/core/ZipToTar.java
@@ -0,0 +1,85 @@
+/*
+ * 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.tomee.patch.core;
+
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
+import org.tomitribe.util.IO;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.GZIPOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class ZipToTar {
+
+    public static File toTarGz(final File zip) throws Exception {
+
+        final String tarGzName = zip.getName().replaceAll("\\.(zip|jar)$", ".tar.gz");
+        final File tarGz = new File(zip.getParentFile(), tarGzName);
+
+        try (final InputStream in = IO.read(zip); final TarArchiveOutputStream tarOut = tar(tarGz)) {
+
+            tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
+
+            final ZipInputStream zipIn = new ZipInputStream(in);
+
+            ZipEntry zipEntry;
+            while ((zipEntry = zipIn.getNextEntry()) != null) {
+                final String name = zipEntry.getName();
+
+                // The ZipEntry often shows -1 as the size and the
+                // TarArchiveOutputStream API requires us to know the
+                // exact size before we start writing.  So we have to
+                // buffer everything in memory first to learn the size
+                final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+                IO.copy(zipIn, buffer);
+                final byte[] bytes = buffer.toByteArray();
+
+                final TarArchiveEntry tarEntry = new TarArchiveEntry(name);
+
+                // Set the size and date
+                tarEntry.setSize(bytes.length);
+                tarEntry.setModTime(zipEntry.getLastModifiedTime().toMillis());
+
+                // Mark any shell scripts as executable
+                if (name.endsWith(".sh")) {
+                    tarEntry.setMode(493);
+                }
+
+                // Finally out the Entry into the archive
+                // Any attributes set on tarEntry after this
+                // point are ignored.
+                tarOut.putArchiveEntry(tarEntry);
+
+                IO.copy(bytes, tarOut);
+                tarOut.closeArchiveEntry();
+            }
+
+            tarOut.finish();
+        }
+
+        return tarGz;
+    }
+
+    private static TarArchiveOutputStream tar(final File tarGz) throws IOException {
+        return new TarArchiveOutputStream(new GZIPOutputStream(IO.write(tarGz)));
+    }
+}
diff --git a/tomee-patch-core/src/test/java/org/apache/tomee/patch/core/ZipToTarTest.java b/tomee-patch-core/src/test/java/org/apache/tomee/patch/core/ZipToTarTest.java
new file mode 100644
index 0000000..13bca8f
--- /dev/null
+++ b/tomee-patch-core/src/test/java/org/apache/tomee/patch/core/ZipToTarTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.tomee.patch.core;
+
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.junit.Test;
+import org.tomitribe.util.Archive;
+import org.tomitribe.util.IO;
+import org.tomitribe.util.PrintString;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.zip.GZIPInputStream;
+
+import static org.junit.Assert.assertEquals;
+
+public class ZipToTarTest {
+
+    @Test
+    public void createTarGz() throws Exception {
+        final File zip = Archive.archive()
+                .add("color/red/crimson.txt", "DC143C")
+                .add("color/red/ruby.txt", "9b111e")
+                .add("color/blue/navy.sh", "000080")
+                .add("color/green/forest.txt", "228b22")
+                .add("index.txt", "red,green,blue")
+                .toJar();
+
+
+        final File tarGz = ZipToTar.toTarGz(zip);
+
+        final PrintString out = new PrintString();
+        {
+
+            final InputStream in = IO.read(tarGz);
+            final GZIPInputStream gzipIn = new GZIPInputStream(in);
+            final TarArchiveInputStream tarIn = new TarArchiveInputStream(gzipIn);
+
+            TarArchiveEntry tarEntry = null;
+            while ((tarEntry = (TarArchiveEntry) tarIn.getNextEntry()) != null) {
+                out.printf("%s %s %s%n", tarEntry.getSize(), tarEntry.getMode(), tarEntry.getName());
+            }
+        }
+
+        assertEquals("" +
+                "14 33188 index.txt\n" +
+                "6 33188 color/red/crimson.txt\n" +
+                "6 493 color/blue/navy.sh\n" +
+                "6 33188 color/red/ruby.txt\n" +
+                "6 33188 color/green/forest.txt\n", out.toString());
+    }
+
+}
diff --git a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
index c76ab47..00afa53 100644
--- a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
+++ b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
@@ -26,11 +26,13 @@
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.AttachedArtifact;
 import org.apache.maven.toolchain.Toolchain;
 import org.apache.maven.toolchain.ToolchainManager;
 import org.apache.tomee.patch.core.Clazz;
 import org.apache.tomee.patch.core.Is;
 import org.apache.tomee.patch.core.Transformation;
+import org.apache.tomee.patch.core.ZipToTar;
 import org.codehaus.plexus.compiler.Compiler;
 import org.codehaus.plexus.compiler.CompilerConfiguration;
 import org.codehaus.plexus.compiler.CompilerMessage;
@@ -89,6 +91,9 @@
     @Parameter
     private Map<String, String> replacements;
 
+    @Parameter(defaultValue = "false")
+    private Boolean createTarGz;
+
     /**
      * Sets the executable of the compiler to use when fork is <code>true</code>.
      */
@@ -180,6 +185,22 @@
                 getLog().debug("Patching " + file.getAbsolutePath());
                 final File patched = transformation.transformArchive(file);
                 IO.copy(patched, file);
+
+                if (createTarGz && file.getName().endsWith(".zip")) {
+                    final File tarGz;
+                    try {
+                        tarGz = ZipToTar.toTarGz(file);
+                    } catch (Exception e) {
+                        getLog().error("Failed to create tar.gz from " + file.getAbsolutePath(), e);
+                        continue;
+                    }
+
+                    final String classifier = artifact.getClassifier();
+                    final AttachedArtifact attachedArtifact = new AttachedArtifact(project.getArtifact(), "tar.gz", classifier, project.getArtifact().getArtifactHandler());
+                    attachedArtifact.setFile(tarGz);
+                    attachedArtifact.setResolved(true);
+                    project.addAttachedArtifact(attachedArtifact);
+                }
             }
 
             transformation.complete();