SLING-6409 Models Impl: Use shading instead of embedding for commons.osgi and scripti...
authorStefan Seifert <sseifert@apache.org>
Sat, 17 Dec 2016 08:23:39 +0000 (08:23 +0000)
committerStefan Seifert <sseifert@apache.org>
Sat, 17 Dec 2016 08:23:39 +0000 (08:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1774718 13f79535-47bb-0310-9956-ffa450edef68

.gitignore [new file with mode: 0644]
pom.xml

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..2e73990
--- /dev/null
@@ -0,0 +1 @@
+dependency-reduced-pom.xml
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4ef82c3..104f3c7 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <extensions>true</extensions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>2.4.3</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <createSourcesJar>true</createSourcesJar>
+                            <shadeSourcesContent>true</shadeSourcesContent>
+                            <artifactSet>
+                                <includes>
+                                    <include>org.apache.sling:org.apache.sling.commons.osgi</include>
+                                    <include>org.apache.sling:org.apache.sling.scripting.core</include>
+                                </includes>
+                            </artifactSet>
+                            <relocations>
+                                <relocation>
+                                    <pattern>org.apache.sling.commons.osgi</pattern>
+                                    <shadedPattern>slingmodelsimpl.org.apache.sling.commons.osgi</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>org.apache.sling.scripting.core</pattern>
+                                    <shadedPattern>slingmodelsimpl.org.apache.sling.scripting.core</shadedPattern>
+                                </relocation>
+                            </relocations>
+                            <filters>
+                                <filter>
+                                    <artifact>org.apache.sling:org.apache.sling.commons.osgi</artifact>
+                                    <includes>
+                                        <include>org/apache/sling/commons/osgi/*</include>
+                                    </includes>
+                                </filter>
+                                <filter>
+                                    <artifact>org.apache.sling:org.apache.sling.scripting.core</artifact>
+                                    <includes>
+                                        <include>org/apache/sling/scripting/core/impl/helper/ProtectedBindings*</include>
+                                    </includes>
+                                </filter>
+                            </filters>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
                 <configuration>
-                    <instructions>
-                        <Embed-Dependency>
-                            *;scope=compile,
-                            org.apache.sling.commons.osgi;inline=true,
-                            org.apache.sling.scripting.core;inline="org/apache/sling/scripting/core/impl/helper/ProtectedBindings.class"
-                        </Embed-Dependency>
-                    </instructions>
+                    <excludes>
+                        <exclude>dependency-reduced-pom.xml</exclude>
+                    </excludes>
                 </configuration>
             </plugin>
         </plugins>
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.scripting.core</artifactId>
-            <version>2.0.20</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
             <scope>provided</scope>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
         </dependency>
-        <!-- we need a pretty new version for the RankedServices, but we embed the necessary classes in this bundle -->
+        <!-- Artifact is shaded and inlined, only some classes included (see above) -->
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.osgi</artifactId>
             <version>2.4.0</version>
-            <scope>provided</scope>
+            <scope>compile</scope>
+        </dependency>
+        <!-- Artifact is shaded and inlined, only some classes included (see above) -->
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.core</artifactId>
+            <version>2.0.20</version>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>commons-lang</groupId>