You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by rm...@apache.org on 2020/06/13 18:04:12 UTC

[openwebbeans] branch master updated: [OWB-1329] no more need of owb-maven module since it is built-in in maven-shade-plugin

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

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ac0aa3  [OWB-1329] no more need of owb-maven module since it is built-in in maven-shade-plugin
4ac0aa3 is described below

commit 4ac0aa3f1e900eae95a5daa03f490f3e41cb6b99
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Sat Jun 13 20:04:04 2020 +0200

    [OWB-1329] no more need of owb-maven module since it is built-in in maven-shade-plugin
---
 pom.xml                                            |   3 +-
 webbeans-maven/pom.xml                             |  39 ------
 .../shade/OpenWebBeansPropertiesTransformer.java   | 131 ---------------------
 3 files changed, 1 insertion(+), 172 deletions(-)

diff --git a/pom.xml b/pom.xml
index 381bc1b..1705fb0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,7 @@
         <osgi.el.range>2.2</osgi.el.range>
         <osgi.faces.range>2.0</osgi.faces.range>
 
-        <maven-shade-plugin.version>3.2.3</maven-shade-plugin.version>
+        <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
     </properties>
     
     <mailingLists>
@@ -645,7 +645,6 @@
         <module>webbeans-tck</module>
         <module>webbeans-tck-jakarta</module>
         <module>distribution</module>
-        <module>webbeans-maven</module>
         <module>webbeans-gradle</module>
         <module>webbeans-se</module>
         <module>webbeans-junit5</module>
diff --git a/webbeans-maven/pom.xml b/webbeans-maven/pom.xml
deleted file mode 100644
index 79e21e6..0000000
--- a/webbeans-maven/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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/xsd/maven-4.0.0.xsd">
-  <parent>
-    <artifactId>openwebbeans</artifactId>
-    <groupId>org.apache.openwebbeans</groupId>
-    <version>2.0.18-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>openwebbeans-maven</artifactId>
-  <name>Maven Shade Plugin Integration</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven.plugins</groupId>
-      <artifactId>maven-shade-plugin</artifactId>
-      <version>${maven-shade-plugin.version}</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/webbeans-maven/src/main/java/org/apache/openwebbeans/maven/shade/OpenWebBeansPropertiesTransformer.java b/webbeans-maven/src/main/java/org/apache/openwebbeans/maven/shade/OpenWebBeansPropertiesTransformer.java
deleted file mode 100644
index 3045a0f..0000000
--- a/webbeans-maven/src/main/java/org/apache/openwebbeans/maven/shade/OpenWebBeansPropertiesTransformer.java
+++ /dev/null
@@ -1,131 +0,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.
- */
-package org.apache.openwebbeans.maven.shade;
-
-import org.apache.maven.plugins.shade.relocation.Relocator;
-import org.apache.maven.plugins.shade.resource.ResourceTransformer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.jar.JarOutputStream;
-import java.util.zip.ZipEntry;
-
-public class OpenWebBeansPropertiesTransformer implements ResourceTransformer
-{
-    private final List<Properties> configurations = new ArrayList<>();
-
-    private String resource = "META-INF/openwebbeans/openwebbeans.properties";
-    private String ordinalKey = "configuration.ordinal";
-    private int defaultOrdinal = 100;
-    private boolean reverseOrder;
-
-    @Override
-    public boolean canTransformResource(String s)
-    {
-        return resource.equals(s);
-    }
-
-    @Override
-    public void processResource(String s, InputStream inputStream, List<Relocator> list, long time) throws IOException
-    {
-        Properties p = new Properties();
-        p.load(inputStream);
-        configurations.add(p);
-    }
-
-    @Override
-    public boolean hasTransformedResource()
-    {
-        return !configurations.isEmpty();
-    }
-
-    @Override
-    public void modifyOutputStream(JarOutputStream jarOutputStream) throws IOException
-    {
-        Properties out = mergeProperties(sortProperties(configurations));
-        jarOutputStream.putNextEntry(new ZipEntry(resource));
-        out.store(jarOutputStream, "# maven " + resource + " merge");
-        jarOutputStream.closeEntry();
-    }
-
-    public void setReverseOrder(boolean reverseOrder)
-    {
-        this.reverseOrder = reverseOrder;
-    }
-
-    public void setResource(String resource)
-    {
-        this.resource = resource;
-    }
-
-    public void setOrdinalKey(String ordinalKey)
-    {
-        this.ordinalKey = ordinalKey;
-    }
-
-    public void setDefaultOrdinal(int defaultOrdinal)
-    {
-        this.defaultOrdinal = defaultOrdinal;
-    }
-
-    private List<Properties> sortProperties(List<Properties> allProperties)
-    {
-        List<Properties> sortedProperties = new ArrayList<>();
-        for (Properties p : allProperties)
-        {
-            int configOrder = getConfigurationOrdinal(p);
-
-            int i;
-            for (i = 0; i < sortedProperties.size(); i++)
-            {
-                int listConfigOrder = getConfigurationOrdinal(sortedProperties.get(i));
-                if ((!reverseOrder && listConfigOrder > configOrder) || (reverseOrder && listConfigOrder < configOrder))
-                {
-                    break;
-                }
-            }
-            sortedProperties.add(i, p);
-        }
-        return sortedProperties;
-    }
-
-    private int getConfigurationOrdinal(Properties p)
-    {
-        String configOrderString = p.getProperty(ordinalKey);
-        if (configOrderString != null && configOrderString.length() > 0)
-        {
-            return Integer.parseInt(configOrderString);
-        }
-        return defaultOrdinal;
-    }
-
-    private static Properties mergeProperties(List<Properties> sortedProperties)
-    {
-        Properties mergedProperties = new Properties();
-        for (Properties p : sortedProperties)
-        {
-            mergedProperties.putAll(p);
-        }
-
-        return mergedProperties;
-    }
-}