Hi Torgeir,

We would not be able shade Lucene classes as they are exported and
meant to be used by certain SPI implementations. So as of now there is
no solution for using a different Lucene version in non OSGi world


Chetan Mehrotra


On Wed, Nov 23, 2016 at 7:15 PM, Torgeir Veimo <torgeir.ve...@gmail.com> wrote:
> Second version, this pom file can be put in a separate directly as a self
> contained maven artifact and includes oak-lucene remotely.
>
> <?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>
>
>     <groupId>no.karriere</groupId>
>     <version>0.1-SNAPSHOT</version>
>     <artifactId>oak-lucene-shaded</artifactId>
>     <name>Oak Lucene (shaded)</name>
>     <description>Oak Lucene integration subproject</description>
>
>     <properties>
>         <tika.version>1.5</tika.version>
>         <lucene.version>4.7.1</lucene.version>
>         <oak.version>1.4.6</oak.version>
>     </properties>
>
>     <build>
>         <plugins>
>             <!-- https://app.camunda.com/jira/browse/CAM-1573 -->
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-source-plugin</artifactId>
>                 <version>3.0.1</version>
>                 <executions>
>                     <execution>
>                         <id>generate-sources-for-shade-plugin</id>
>                         <phase>package</phase>
>                         <goals>
>                             <goal>jar-no-fork</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-shade-plugin</artifactId>
>                 <version>3.0.0-SNAPSHOT</version>
>                 <executions>
>                     <execution>
>                         <phase>package</phase>
>                         <goals>
>                             <goal>shade</goal>
>                         </goals>
>                         <configuration>
>
> <!--<createDependencyReducedPom>false</createDependencyReducedPom>-->
>
> <promoteTransitiveDependencies>false</promoteTransitiveDependencies>
>                             <shadeSourcesContent>true</shadeSourcesContent>
>                             <createSourcesJar>true</createSourcesJar>
>                             <transformers>
>                                 <transformer
> implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
>                             </transformers>
>                             <relocations>
>                                 <relocation>
>                                     <pattern>org.apache.lucene</pattern>
>
> <shadedPattern>org.shaded.apache.lucene</shadedPattern>
>                                 </relocation>
>                                 <relocation>
>                                     <pattern>org.tartarus.snowball</pattern>
>
> <shadedPattern>org.shaded.tartarus.snowball</shadedPattern>
>                                 </relocation>
>                             </relocations>
>                             <artifactSet>
>                                 <excludes>
>
> <exclude>org.apache.jackrabbit:oak-core</exclude>
>
> <exclude>org.apache.jackrabbit:oak-commons</exclude>
>
> <exclude>org.apache.jackrabbit:oak-blob</exclude>
>
> <exclude>com.google.guava:guava</exclude>
>
> <exclude>commons-codec:commons-codec</exclude>
>                                     <exclude>commons-io:commons-io</exclude>
>                                     <exclude>javax.jcr:jcr</exclude>
>
> <exclude>org.apache.jackrabbit:jackrabbit-api</exclude>
>
> <exclude>org.apache.jackrabbit:jackrabbit-jcr-commons</exclude>
>
> <exclude>org.apache.tika:tika-core</exclude>
>                                     <exclude>org.slf4j:slf4j-api</exclude>
>                                 </excludes>
>                             </artifactSet>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>         </plugins>
>     </build>
>
>     <dependencies>
>         <dependency>
>             <groupId>org.apache.jackrabbit</groupId>
>             <artifactId>oak-core</artifactId>
>             <version>${oak.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.jackrabbit</groupId>
>             <artifactId>oak-lucene</artifactId>
>             <version>${oak.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.tika</groupId>
>             <artifactId>tika-core</artifactId>
>             <version>${tika.version}</version>
>         </dependency>
>
>         <!-- Lucene dependencies -->
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-core</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-analyzers-common</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-queryparser</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-queries</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-suggest</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-highlighter</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-memory</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-misc</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.lucene</groupId>
>             <artifactId>lucene-facet</artifactId>
>             <version>${lucene.version}</version>
>         </dependency>
>
>         <dependency>
>             <groupId>org.apache.tika</groupId>
>             <artifactId>tika-parsers</artifactId>
>             <version>${tika.version}</version>
>             <scope>test</scope>
>             <exclusions>
>                 <exclusion>
>                     <groupId>commons-logging</groupId>
>                     <artifactId>commons-logging</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>     </dependencies>
>
>     <pluginRepositories>
>         <pluginRepository>
>             <id>org.apache</id>
>             <name>Apache snapshots</name>
>             <url>http://repository.apache.org/content/repositories/snapshots
> </url>
>             <snapshots>
>                 <enabled>true</enabled>
>             </snapshots>
>         </pluginRepository>
>     </pluginRepositories>
> </project>
>
>
> On 15 November 2016 at 11:12, Torgeir Veimo <torgeir.ve...@gmail.com> wrote:
>
>> I'm in need of running oak in a non-osgi environment with a more recent
>> version of lucene already on the classpath, so I've experimented with using
>> the maven shade plugin to embed a shaded lucene jar inside the oak-lucene
>> jar.
>>
>> I'm not very familiar with the shade plugin, so there might be better ways
>> of doing this, but here's a modified pom.xml that will built to an artifact
>> that can be included with the id org.apache.jackrabbit:oak-lucene-shaded
>>
>> This might be useful for someone.
>>
>> <?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.jackrabbit</groupId>
>>         <artifactId>oak-parent</artifactId>
>>         <version>1.4.6</version>
>>         <relativePath>../oak-parent/pom.xml</relativePath>
>>     </parent>
>>
>>     <artifactId>oak-lucene-shaded</artifactId>
>>     <name>Oak Lucene (shaded)</name>
>>     <!--<packaging>bundle</packaging>-->
>>     <description>Oak Lucene integration subproject</description>
>>
>>     <properties>
>>         <tika.version>1.5</tika.version>
>>     </properties>
>>
>>     <build>
>>         <plugins>
>>             <!-- https://app.camunda.com/jira/browse/CAM-1573 -->
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-source-plugin</artifactId>
>>                 <executions>
>>                     <execution>
>>                         <id>generate-sources-for-shade-plugin</id>
>>                         <phase>package</phase>
>>                         <goals>
>>                             <goal>jar-no-fork</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>             </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>
>>                             <!--<minimizeJar>true</minimizeJar>-->
>>                             <promoteTransitiveDependencies>false</
>> promoteTransitiveDependencies>
>>                             <shadeSourcesContent>true</
>> shadeSourcesContent>
>>                             <createSourcesJar>true</createSourcesJar>
>>                             <shadeSourcesContent>true</
>> shadeSourcesContent>
>>
>>                             <relocations>
>>                                 <relocation>
>>                                     <pattern>org.apache.lucene</pattern>
>>                                     <shadedPattern>org.shaded.
>> apache.lucene</shadedPattern>
>>                                 </relocation>
>>                                 <relocation>
>>                                     <pattern>org.tartarus.
>> snowball</pattern>
>>                                     <shadedPattern>org.shaded.
>> tartarus.snowball</shadedPattern>
>>                                 </relocation>
>>                             </relocations>
>>                             <artifactSet>
>>                                 <excludes>
>>                                     <exclude>org.apache.
>> jackrabbit:oak-core</exclude>
>>                                     <exclude>org.apache.
>> jackrabbit:oak-commons</exclude>
>>                                     <exclude>org.apache.
>> jackrabbit:oak-blob</exclude>
>>                                     <exclude>com.google.guava:
>> guava</exclude>
>>                                     <exclude>commons-codec:
>> commons-codec</exclude>
>>                                     <exclude>commons-io:commons-
>> io</exclude>
>>                                     <exclude>javax.jcr:jcr</exclude>
>>                                     <exclude>org.apache.
>> jackrabbit:jackrabbit-api</exclude>
>>                                     <exclude>org.apache.
>> jackrabbit:jackrabbit-jcr-commons</exclude>
>>                                     <exclude>org.apache.tika:tika-
>> core</exclude>
>>                                     <exclude>org.slf4j:slf4j-api</exclude>
>>                                 </excludes>
>>                             </artifactSet>
>>                         </configuration>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>>     <dependencies>
>>         <!-- Optional OSGi dependencies, used only when running within
>> OSGi -->
>>         <dependency>
>>             <groupId>org.osgi</groupId>
>>             <artifactId>org.osgi.core</artifactId>
>>             <scope>provided</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.osgi</groupId>
>>             <artifactId>org.osgi.compendium</artifactId>
>>             <scope>provided</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>biz.aQute.bnd</groupId>
>>             <artifactId>bndlib</artifactId>
>>             <scope>provided</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.felix</groupId>
>>             <artifactId>org.apache.felix.scr.annotations</artifactId>
>>             <scope>provided</scope>
>>         </dependency>
>>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>oak-core</artifactId>
>>             <version>${project.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.tika</groupId>
>>             <artifactId>tika-core</artifactId>
>>             <version>${tika.version}</version>
>>         </dependency>
>>
>>         <!-- Lucene dependencies -->
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-core</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-analyzers-common</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-queryparser</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-queries</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-suggest</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-highlighter</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-memory</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-misc</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.lucene</groupId>
>>             <artifactId>lucene-facet</artifactId>
>>             <version>${lucene.version}</version>
>>         </dependency>
>>
>>         <!-- Logging -->
>>         <dependency>
>>             <groupId>org.slf4j</groupId>
>>             <artifactId>slf4j-api</artifactId>
>>         </dependency>
>>
>>         <!-- Findbugs annotations -->
>>         <dependency>
>>             <groupId>com.google.code.findbugs</groupId>
>>             <artifactId>jsr305</artifactId>
>>         </dependency>
>>
>>         <!-- Test Dependencies -->
>>         <dependency>
>>             <groupId>ch.qos.logback</groupId>
>>             <artifactId>logback-classic</artifactId>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>junit</groupId>
>>             <artifactId>junit</artifactId>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.mongodb</groupId>
>>             <artifactId>mongo-java-driver</artifactId>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>oak-core</artifactId>
>>             <version>${project.version}</version>
>>             <classifier>tests</classifier>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>oak-jcr</artifactId>
>>             <version>${project.version}</version>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>oak-jcr</artifactId>
>>             <version>${project.version}</version>
>>             <type>test-jar</type>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>oak-commons</artifactId>
>>             <version>${project.version}</version>
>>             <type>test-jar</type>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>jackrabbit-jcr-tests</artifactId>
>>             <version>${jackrabbit.version}</version>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.jackrabbit</groupId>
>>             <artifactId>jackrabbit-core</artifactId>
>>             <version>${jackrabbit.version}</version>
>>             <classifier>tests</classifier>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.tika</groupId>
>>             <artifactId>tika-parsers</artifactId>
>>             <version>${tika.version}</version>
>>             <scope>test</scope>
>>             <exclusions>
>>                 <exclusion>
>>                     <groupId>commons-logging</groupId>
>>                     <artifactId>commons-logging</artifactId>
>>                 </exclusion>
>>             </exclusions>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.apache.sling</groupId>
>>             <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.hamcrest</groupId>
>>             <artifactId>hamcrest-all</artifactId>
>>             <version>1.3</version>
>>             <scope>test</scope>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.mockito</groupId>
>>             <artifactId>mockito-core</artifactId>
>>             <version>1.10.19</version>
>>             <scope>test</scope>
>>         </dependency>
>>     </dependencies>
>> </project>
>>
>>
>> --
>> -Tor
>>
>
>
>
> --
> -Tor

Reply via email to