maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elh...@apache.org
Subject [maven-shade-plugin] branch master updated: make constructors public (#45)
Date Sat, 11 Apr 2020 18:23:27 GMT
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 4775d25  make constructors public (#45)
4775d25 is described below

commit 4775d253c7bbfaa164ef76d8f3a5df1f47b74384
Author: Elliotte Rusty Harold <elharo@users.noreply.github.com>
AuthorDate: Sat Apr 11 14:23:21 2020 -0400

    make constructors public (#45)
---
 src/it/projects/MSHADE-351/pom.xml                 | 73 ++++++++++++++++++++++
 .../projects/MSHADE-351/verify.bsh}                | 21 +++----
 .../properties/MicroprofileConfigTransformer.java  |  2 +-
 .../OpenWebBeansPropertiesTransformer.java         |  2 +-
 .../resource/properties/SortedProperties.java      |  2 +-
 5 files changed, 83 insertions(+), 17 deletions(-)

diff --git a/src/it/projects/MSHADE-351/pom.xml b/src/it/projects/MSHADE-351/pom.xml
new file mode 100644
index 0000000..e1728f3
--- /dev/null
+++ b/src/it/projects/MSHADE-351/pom.xml
@@ -0,0 +1,73 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.shade.srt</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <name>MSHADE-351</name>
+  <description>
+    Test the merging of META-INF/services/** entries.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its.shade.srt</groupId>
+      <artifactId>one</artifactId>
+      <version>0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.its.shade.srt</groupId>
+      <artifactId>two</artifactId>
+      <version>0.1</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>attach-shade</id>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <shadedArtifactAttached>false</shadedArtifactAttached>
+              <transformers>
+                <transformer implementation=
+                  "org.apache.maven.plugins.shade.resource.properties.OpenWebBeansPropertiesTransformer"
/>
+                <transformer implementation=
+                  "org.apache.maven.plugins.shade.resource.properties.MicroprofileConfigTransformer"
/>
+              </transformers>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
b/src/it/projects/MSHADE-351/verify.bsh
similarity index 68%
copy from src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
copy to src/it/projects/MSHADE-351/verify.bsh
index ecc49b2..d7967a7 100644
--- a/src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
+++ b/src/it/projects/MSHADE-351/verify.bsh
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.shade.resource.properties;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,16 +16,11 @@ package org.apache.maven.plugins.shade.resource.properties;
  * specific language governing permissions and limitations
  * under the License.
  */
+import java.io.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
 
-/**
- * Enables to merge Microprofile Config configuration files properly respecting their ordinal.
- *
- * @since 3.2.2
- */
-public class MicroprofileConfigTransformer extends PropertiesTransformer
-{
-    protected MicroprofileConfigTransformer()
-    {
-        super( null, "config_ordinal", 1000, false );
-    }
-}
+JarFile jarFile = new JarFile( new File( basedir, "target/test-1.0.jar" ) );
+JarEntry jarEntry = jarFile.getEntry( "META-INF/services/org.apache.maven.Shade" );
+String service = IOUtil.toString( jarFile.getInputStream( jarEntry ), "UTF-8" );
+jarFile.close();
diff --git a/src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
b/src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
index ecc49b2..7d47f25 100644
--- a/src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
+++ b/src/main/java/org/apache/maven/plugins/shade/resource/properties/MicroprofileConfigTransformer.java
@@ -26,7 +26,7 @@ package org.apache.maven.plugins.shade.resource.properties;
  */
 public class MicroprofileConfigTransformer extends PropertiesTransformer
 {
-    protected MicroprofileConfigTransformer()
+    public MicroprofileConfigTransformer()
     {
         super( null, "config_ordinal", 1000, false );
     }
diff --git a/src/main/java/org/apache/maven/plugins/shade/resource/properties/OpenWebBeansPropertiesTransformer.java
b/src/main/java/org/apache/maven/plugins/shade/resource/properties/OpenWebBeansPropertiesTransformer.java
index 180ac54..7c37d34 100644
--- a/src/main/java/org/apache/maven/plugins/shade/resource/properties/OpenWebBeansPropertiesTransformer.java
+++ b/src/main/java/org/apache/maven/plugins/shade/resource/properties/OpenWebBeansPropertiesTransformer.java
@@ -26,7 +26,7 @@ package org.apache.maven.plugins.shade.resource.properties;
  */
 public class OpenWebBeansPropertiesTransformer extends PropertiesTransformer
 {
-    protected OpenWebBeansPropertiesTransformer()
+    public OpenWebBeansPropertiesTransformer()
     {
         super( "META-INF/openwebbeans/openwebbeans.properties", "configuration.ordinal",
100, false );
     }
diff --git a/src/main/java/org/apache/maven/plugins/shade/resource/properties/SortedProperties.java
b/src/main/java/org/apache/maven/plugins/shade/resource/properties/SortedProperties.java
index f64f9f7..fb96b84 100644
--- a/src/main/java/org/apache/maven/plugins/shade/resource/properties/SortedProperties.java
+++ b/src/main/java/org/apache/maven/plugins/shade/resource/properties/SortedProperties.java
@@ -35,7 +35,7 @@ import java.util.Set;
  * Internal Properties instance sorting its keys on iterations for store() usages.
  * It ensures properties persistence is deterministic.
  *
- * IMPORTANT: this only overrides methods used accross JVM in store() so ordering is not
guaranteed for other cases.
+ * IMPORTANT: this only overrides methods used across JVM in store() so ordering is not guaranteed
for other cases.
  */
 public class SortedProperties extends Properties
 {


Mime
View raw message