Github user stain commented on a diff in the pull request:
https://github.com/apache/jena/pull/45#discussion_r26959470
--- Diff: jena-shadowed-ext/pom.xml ---
@@ -0,0 +1,107 @@
+<?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.jena</groupId>
+ <artifactId>jena-parent</artifactId>
+ <version>13-SNAPSHOT</version>
+ <relativePath>../jena-parent</relativePath>
+ </parent>
+ <artifactId>jena-shadowed-ext</artifactId>
+ <version>2.14.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>Apache Jena - Shadowed external libraries</name>
+ <description>
+ This module shadows some external libraries like Guava,
+ which we don't want to be depending on in their regular
+ package names, as they are likely to change/upgrade
+ externally and also be used in other libraries
+ in potentially conflicting versions.
+
+ This module uses the Shade plugin to re-package them
+ under the package name
+ org.apache.jena.ext and is also a valid OSGi bundle
+ (but should only be used by used by other Jena modules).
+
+ </description>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <!-- Version number specified explicitly and not in jena-parent,
+ as it should only be used here, and further
shadowing/bundle/NOTICE
+ consideration might be needed on upgrade. -->
+ <version>18.0</version>
+ <!--
+ As Guava does not contain a NOTICE and is also
+ licensed under Apache License, no additional
+ NOTICE is required by us. In a way we should probably
+ NOT include our own NOTICE file in this JAR..
+ -->
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <artifact>com.google.guava:guava</artifact>
+ </includes>
+ </artifactSet>
+ <relocations>
+ <relocation>
+ <pattern>com.google</pattern>
+ <shadedPattern>org.apache.jena.ext.com.google</shadedPattern>
--- End diff --
The relocation is needed because jena-shadowed-ext would effectively become
a second Guava implementation, which might be older or newer from what
might also be on the class path (as in Elephas / Hadoop). Maven uses only
groupId and artifactId to decide in versions.
You do not want those to mix, as you could end up with say
com.google.common.FooBuilder from Guava 16 and com.google.common.FooImpl
from 10.
There is only com.google.common now. If a later update of guava adds
additional packages, are you saying those should NOT be relocated, but left
in place? (This can be mitigated by modifying the file include patterns,
but that could lead to linkage errors )
On 22 Mar 2015 12:02, "Andy Seaborne" <[email protected]> wrote:
> In jena-shadowed-ext/pom.xml
> <https://github.com/apache/jena/pull/45#discussion_r26902175>:
>
> > + <phase>package</phase>
> > + <goals>
> > + <goal>shade</goal>
> > + </goals>
> > + </execution>
> > + </executions>
> > + <configuration>
> > + <artifactSet>
> > + <includes>
> > + <artifact>com.google.guava:guava</artifact>
> > + </includes>
> > + </artifactSet>
> > + <relocations>
> > + <relocation>
> > + <pattern>com.google</pattern>
> > +
<shadedPattern>org.apache.jena.ext.com.google</shadedPattern>
>
> More focused is to shade com.google.common and com.google.thirdparty
>
> â
> Reply to this email directly or view it on GitHub
> <https://github.com/apache/jena/pull/45/files#r26902175>.
>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---