[build] remove shaded elasticsearch version
The shaded version of elasticsearch was built at the very beginning to avoid dependency conflicts in a specific case where: * People use elasticsearch from Java * People needs to embed elasticsearch jar within their own application (as it's today the only way to get a `TransportClient`) * People also embed in their application another (most of the time older) version of dependency we are using for elasticsearch, such as: Guava, Joda, Jackson... This conflict issue can be solved within the projects themselves by either upgrade the dependency version and use the one provided by elasticsearch or by shading elasticsearch project and relocating some conflicting packages. Example ------- As an example, let's say you want to use within your project `Joda 2.1` but elasticsearch `2.0.0-beta1` provides `Joda 2.8`. Let's say you also want to run all that with shield plugin. Create a new maven project or module with: ```xml <groupId>fr.pilato.elasticsearch.test</groupId> <artifactId>es-shaded</artifactId> <version>1.0-SNAPSHOT</version> <properties> <elasticsearch.version>2.0.0-beta1</elasticsearch.version> </properties> <dependencies> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>${elasticsearch.version}</version> </dependency> <dependency> <groupId>org.elasticsearch.plugin</groupId> <artifactId>shield</artifactId> <version>${elasticsearch.version}</version> </dependency> </dependencies> ``` And now shade and relocate all packages which conflicts with your own application: ```xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <relocations> <relocation> <pattern>org.joda</pattern> <shadedPattern>fr.pilato.thirdparty.joda</shadedPattern> </relocation> </relocations> </configuration> </execution> </executions> </plugin> </plugins> </build> ``` You can create now a shaded version of elasticsearch + shield by running `mvn clean install`. In your project, you can now depend on: ```xml <dependency> <groupId>fr.pilato.elasticsearch.test</groupId> <artifactId>es-shaded</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.1</version> </dependency> ``` Build then your TransportClient as usual: ```java TransportClient client = TransportClient.builder() .settings(Settings.builder() .put("path.home", ".") .put("shield.user", "username:password") .put("plugin.types", "org.elasticsearch.shield.ShieldPlugin") ) .build(); client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("localhost", 9300))); // Index some data client.prepareIndex("test", "doc", "1").setSource("foo", "bar").setRefresh(true).get(); SearchResponse searchResponse = client.prepareSearch("test").get(); ``` If you want to use your own version of Joda, then import for example `org.joda.time.DateTime`. If you want to access to the shaded version (not recommended though), import `fr.pilato.thirdparty.joda.time.DateTime`. You can run a simple test to make sure that both classes can live together within the same JVM: ```java CodeSource codeSource = new org.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource(); System.out.println("unshaded = " + codeSource); codeSource = new fr.pilato.thirdparty.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource(); System.out.println("shaded = " + codeSource); ``` It will print: ``` unshaded = (file:/path/to/joda-time-2.1.jar <no signer certificates>) shaded = (file:/path/to/es-shaded-1.0-SNAPSHOT.jar <no signer certificates>) ``` This PR also removes fully-loaded module. By the way, the project can now build with Maven 3.3.3 so we can relax a bit our maven policy.
This commit is contained in:
parent
17959871ff
commit
34ee4c2d66
|
@ -105,8 +105,6 @@
|
|||
</dependency>
|
||||
<!-- Lucene spatial -->
|
||||
|
||||
|
||||
<!-- START: dependencies that might be shaded -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
|
@ -165,7 +163,6 @@
|
|||
<groupId>commons-cli</groupId>
|
||||
<artifactId>commons-cli</artifactId>
|
||||
</dependency>
|
||||
<!-- END: dependencies that might be shaded -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
|
|
|
@ -396,36 +396,4 @@
|
|||
<target name="start-external-cluster-rpm" depends="setup-workspace-rpm">
|
||||
<startup-elasticsearch home="${integ.scratch}/rpm-extracted/usr/share/elasticsearch/"/>
|
||||
</target>
|
||||
|
||||
<!-- check shaded jar for jar hell -->
|
||||
<target name="check-for-jar-hell">
|
||||
<java failonerror="true" fork="true" classname="org.elasticsearch.bootstrap.JarHell">
|
||||
<classpath>
|
||||
<pathelement location="${project.build.directory}/${project.artifactId}-${project.version}.jar"/>
|
||||
<pathelement location="${org.apache.lucene:lucene-core:jar}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="check-shaded-jar-packages">
|
||||
<!-- we unzip the jar, vs zipfileset, zipfileset toString is useless -->
|
||||
<delete dir="${integ.temp}/unzipped"/>
|
||||
<mkdir dir="${integ.temp}/unzipped"/>
|
||||
<unzip src="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||
dest="${integ.temp}/unzipped"/>
|
||||
<local name="unshaded.classes"/>
|
||||
<fileset id="unshaded.classes"
|
||||
dir="${integ.temp}/unzipped"
|
||||
includes="**/*.class"
|
||||
excludes="org/elasticsearch/**,org/apache/lucene/**"/>
|
||||
<fail message="shaded jar contains packages outside of org.elasticsearch: ${toString:unshaded.classes}">
|
||||
<condition>
|
||||
<not>
|
||||
<resourcecount count="0">
|
||||
<fileset refid="unshaded.classes"/>
|
||||
</resourcecount>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
# either express or implied. See the License for the specific
|
||||
# language governing permissions and limitations under the License.
|
||||
|
||||
# For shaded dependencies, please put signatures in third-party-shaded.txt
|
||||
# and third-party-unshaded.txt instead of here.
|
||||
# For third-party dependencies, please put signatures in third-party.txt instead of here.
|
||||
|
||||
@defaultMessage spawns threads with vague names; use a custom thread factory and name threads so that you can tell (by its name) which executor it is associated with
|
||||
|
||||
|
@ -47,7 +46,7 @@ org.apache.lucene.search.NumericRangeFilter#newFloatRange(java.lang.String,java.
|
|||
org.apache.lucene.search.NumericRangeFilter#newIntRange(java.lang.String,java.lang.Integer,java.lang.Integer,boolean,boolean)
|
||||
org.apache.lucene.search.NumericRangeFilter#newLongRange(java.lang.String,java.lang.Long,java.lang.Long,boolean,boolean)
|
||||
|
||||
@defaultMessage Only use wait / notify when really needed try to use concurrency primitives, latches or callbacks instead.
|
||||
@defaultMessage Only use wait / notify when really needed try to use concurrency primitives, latches or callbacks instead.
|
||||
java.lang.Object#wait()
|
||||
java.lang.Object#wait(long)
|
||||
java.lang.Object#wait(long,int)
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
# Licensed to Elasticsearch under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright
|
||||
# ownership. Elasticsearch 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.
|
||||
|
||||
@defaultMessage Use Long.compare instead we are on Java7
|
||||
org.elasticsearch.common.primitives.Longs#compare(long,long)
|
||||
|
||||
@defaultMessage unsafe encoders/decoders have problems in the lzf compress library. Use variants of encode/decode functions which take Encoder/Decoder.
|
||||
org.elasticsearch.common.compress.lzf.impl.UnsafeChunkDecoder#<init>()
|
||||
org.elasticsearch.common.compress.lzf.util.ChunkDecoderFactory#optimalInstance()
|
||||
|
||||
@defaultMessage Constructing a DateTime without a time zone is dangerous
|
||||
org.elasticsearch.joda.time.DateTime#<init>()
|
||||
org.elasticsearch.joda.time.DateTime#<init>(long)
|
||||
org.elasticsearch.joda.time.DateTime#<init>(int, int, int, int, int)
|
||||
org.elasticsearch.joda.time.DateTime#<init>(int, int, int, int, int, int)
|
||||
org.elasticsearch.joda.time.DateTime#<init>(int, int, int, int, int, int, int)
|
||||
org.elasticsearch.joda.time.DateTime#now()
|
||||
org.elasticsearch.joda.time.DateTimeZone#getDefault()
|
||||
|
||||
org.elasticsearch.common.collect.Iterators#emptyIterator() @ Use Collections.emptyIterator instead
|
|
@ -24,15 +24,6 @@
|
|||
<deb.sign.method>dpkg-sig</deb.sign.method>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.distribution.fully-loaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<filters>
|
||||
|
@ -172,7 +163,7 @@
|
|||
</data>
|
||||
<data>
|
||||
<src>${project.build.directory}/../target/lib</src>
|
||||
<excludes>${project.build.finalName}-shaded.jar,${project.build.finalName}-sources.jar,${project.build.finalName}-tests.jar,${project.build.finalName}-test-sources.jar,slf4j-api-*.jar</excludes>
|
||||
<excludes>${project.build.finalName}-sources.jar,${project.build.finalName}-tests.jar,${project.build.finalName}-test-sources.jar,slf4j-api-*.jar</excludes>
|
||||
<type>directory</type>
|
||||
<mapper>
|
||||
<type>perm</type>
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.elasticsearch.distribution</groupId>
|
||||
<artifactId>distributions</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.elasticsearch.distribution.fully-loaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<name>Distribution: with all optional dependencies</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-expressions</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.spatial4j</groupId>
|
||||
<artifactId>spatial4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vividsolutions</groupId>
|
||||
<artifactId>jts</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- needed for templating -->
|
||||
<dependency>
|
||||
<groupId>com.github.spullara.mustache.java</groupId>
|
||||
<artifactId>compiler</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>apache-log4j-extras</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- we intentionally do not want slf4j in the distro by default, we use log4j
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -69,6 +69,61 @@
|
|||
<artifactId>httpclient</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Embedded components in any distribution -->
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-expressions</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.spatial4j</groupId>
|
||||
<artifactId>spatial4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vividsolutions</groupId>
|
||||
<artifactId>jts</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- needed for templating -->
|
||||
<dependency>
|
||||
<groupId>com.github.spullara.mustache.java</groupId>
|
||||
<artifactId>compiler</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>apache-log4j-extras</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- we intentionally do not want slf4j in the distro by default, we use log4j
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -170,8 +225,6 @@
|
|||
</build>
|
||||
|
||||
<modules>
|
||||
<module>fully-loaded</module>
|
||||
<module>shaded</module>
|
||||
<module>tar</module>
|
||||
<module>zip</module>
|
||||
<module>deb</module>
|
||||
|
|
|
@ -15,15 +15,6 @@
|
|||
<packaging>rpm</packaging>
|
||||
<description>The RPM distribution of Elasticsearch</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.distribution.fully-loaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<skip.unit.tests>true</skip.unit.tests>
|
||||
<rpm.outputDirectory>${project.build.directory}/releases/</rpm.outputDirectory>
|
||||
|
@ -187,7 +178,6 @@
|
|||
<source>
|
||||
<location>target/lib/</location>
|
||||
<excludes>
|
||||
<exclude>${project.build.finalName}-shaded.jar</exclude>
|
||||
<exclude>${project.build.finalName}-sources.jar</exclude>
|
||||
<exclude>${project.build.finalName}-tests.jar</exclude>
|
||||
<exclude>${project.build.finalName}-test-sources.jar</exclude>
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.elasticsearch.distribution</groupId>
|
||||
<artifactId>distributions</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.elasticsearch.distribution.shaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<name>Distribution: Shaded JAR</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<!-- see docs, incremental builds dont play well with shading otherwise -->
|
||||
<configuration>
|
||||
<skipIfEmpty>false</skipIfEmpty>
|
||||
<forceCreation>true</forceCreation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-for-jar-hell</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<ant antfile="${elasticsearch.integ.antfile}" target="check-for-jar-hell"/>
|
||||
<ant antfile="${elasticsearch.integ.antfile}" target="check-shaded-jar-packages"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<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>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<shadeTestJar>false</shadeTestJar>
|
||||
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.apache.lucene:*</exclude>
|
||||
<exclude>com.spatial4j:*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
<transformers>
|
||||
<!-- copy over MANIFEST.MF from unshaded jar, but mark jar as shaded too -->
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<manifestEntries>
|
||||
<X-Build-Shaded>true</X-Build-Shaded>
|
||||
</manifestEntries>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.google.common</pattern>
|
||||
<shadedPattern>org.elasticsearch.common</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.thirdparty</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.thirdparty</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.carrotsearch.hppc</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.hppc</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.HdrHistogram</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.HdrHistogram</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.yaml</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.yaml</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.twitter.jsr166e</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.util.concurrent.jsr166e</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.fasterxml.jackson</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.jackson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.joda.time</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.joda.time</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.joda.convert</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.joda.convert</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.jboss.netty</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.netty</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.ning.compress</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.compress</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.github.mustachejava</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.mustache</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.tdunning.math.stats</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.stats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons.lang</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.lang</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons.cli</pattern>
|
||||
<shadedPattern>org.elasticsearch.common.cli.commons</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/license/**</exclude>
|
||||
<exclude>META-INF/*</exclude>
|
||||
<exclude>META-INF/maven/**</exclude>
|
||||
<exclude>LICENSE</exclude>
|
||||
<exclude>NOTICE</exclude>
|
||||
<exclude>/*.txt</exclude>
|
||||
<exclude>build.properties</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -19,15 +19,6 @@
|
|||
<!--packaging>pom</packaging-->
|
||||
<description>The TAR distribution of Elasticsearch</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.distribution.fully-loaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<filters>
|
||||
<filter>${project.basedir}/../src/main/packaging/packaging.properties</filter>
|
||||
|
|
|
@ -19,15 +19,6 @@
|
|||
<!--packaging>pom</packaging-->
|
||||
<description>The ZIP distribution of Elasticsearch</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.distribution.fully-loaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<filters>
|
||||
<filter>${project.basedir}/../src/main/packaging/packaging.properties</filter>
|
||||
|
|
|
@ -60,24 +60,8 @@ json.put("message","trying out Elasticsearch");
|
|||
[[java-docs-index-generate-beans]]
|
||||
===== Serialize your beans
|
||||
|
||||
Elasticsearch already uses Jackson but shades it under
|
||||
`org.elasticsearch.common.jackson` package. +
|
||||
So, you can add your own Jackson version in your `pom.xml` file or in
|
||||
your classpath. See http://wiki.fasterxml.com/JacksonDownload[Jackson
|
||||
Download Page].
|
||||
|
||||
For example:
|
||||
|
||||
[source,xml]
|
||||
--------------------------------------------------
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
--------------------------------------------------
|
||||
|
||||
Then, you can start serializing your beans to JSON:
|
||||
Elasticsearch already uses http://wiki.fasterxml.com/JacksonHome[Jackson].
|
||||
So you can use it to serialize your beans to JSON:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -52,7 +52,6 @@
|
|||
|
||||
<!-- Build resources properties -->
|
||||
<elasticsearch.tools.directory>${project.build.directory}/dev-tools</elasticsearch.tools.directory>
|
||||
<elasticsearch.thirdparty.config>unshaded</elasticsearch.thirdparty.config>
|
||||
<elasticsearch.license.header>${elasticsearch.tools.directory}/license-check/elasticsearch_license_header.txt</elasticsearch.license.header>
|
||||
<elasticsearch.license.headerDefinition>${elasticsearch.tools.directory}/license-check/license_header_definition.xml</elasticsearch.license.headerDefinition>
|
||||
<elasticsearch.integ.antfile.default>${elasticsearch.tools.directory}/ant/integration-tests.xml</elasticsearch.integ.antfile.default>
|
||||
|
@ -336,7 +335,6 @@
|
|||
<version>${lucene.maven.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- START: dependencies that might be shaded -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
|
@ -416,8 +414,6 @@
|
|||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- END: dependencies that might be shaded -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
|
@ -551,7 +547,7 @@
|
|||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>[3.1.0,3.3.0)</version>
|
||||
<version>[3.1.0,)</version>
|
||||
</requireMavenVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
|
@ -846,7 +842,7 @@
|
|||
<signaturesFiles>
|
||||
<signaturesFile>${elasticsearch.tools.directory}/forbidden/core-signatures.txt</signaturesFile>
|
||||
<signaturesFile>${elasticsearch.tools.directory}/forbidden/all-signatures.txt</signaturesFile>
|
||||
<signaturesFile>${elasticsearch.tools.directory}/forbidden/third-party-${elasticsearch.thirdparty.config}-signatures.txt</signaturesFile>
|
||||
<signaturesFile>${elasticsearch.tools.directory}/forbidden/third-party-signatures.txt</signaturesFile>
|
||||
</signaturesFiles>
|
||||
<signatures>${forbidden.signatures}</signatures>
|
||||
<suppressAnnotations><annotation>**.SuppressForbidden</annotation></suppressAnnotations>
|
||||
|
@ -893,7 +889,7 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<!-- add some additonal binary types to prevent maven from
|
||||
<!-- add some additional binary types to prevent maven from
|
||||
screwing them up with resource filtering -->
|
||||
<configuration>
|
||||
<nonFilteredFileExtensions>
|
||||
|
|
|
@ -146,7 +146,6 @@
|
|||
|
||||
<modules>
|
||||
<module>smoke-test-plugins</module>
|
||||
<module>smoke-test-shaded</module>
|
||||
<module>smoke-test-multinode</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.elasticsearch.qa</groupId>
|
||||
<artifactId>elasticsearch-qa</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>smoke-test-shaded</artifactId>
|
||||
<name>QA: Smoke Test Shaded Jar</name>
|
||||
<description>Runs a simple </description>
|
||||
|
||||
<properties>
|
||||
<elasticsearch.thirdparty.config>shaded</elasticsearch.thirdparty.config>
|
||||
<skip.unit.tests>true</skip.unit.tests>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.distribution.shaded</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-all</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-test-framework</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch 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.elasticsearch.shaded.test;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.NodeBuilder;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ShadedIT extends LuceneTestCase {
|
||||
|
||||
public void testStartShadedNode() {
|
||||
ESLoggerFactory.getRootLogger().setLevel("ERROR");
|
||||
Path data = createTempDir();
|
||||
Settings settings = Settings.builder()
|
||||
.put("path.home", data.toAbsolutePath().toString())
|
||||
.put("node.mode", "local")
|
||||
.put("http.enabled", "false")
|
||||
.build();
|
||||
NodeBuilder builder = NodeBuilder.nodeBuilder().data(true).settings(settings).loadConfigSettings(false).local(true);
|
||||
try (Node node = builder.node()) {
|
||||
Client client = node.client();
|
||||
client.admin().indices().prepareCreate("test").get();
|
||||
client.prepareIndex("test", "foo").setSource("{ \"field\" : \"value\" }").get();
|
||||
client.admin().indices().prepareRefresh().get();
|
||||
SearchResponse response = client.prepareSearch("test").get();
|
||||
assertEquals(response.getHits().getTotalHits(), 1l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadShadedClasses() throws ClassNotFoundException {
|
||||
Class.forName("org.elasticsearch.common.cache.LoadingCache");
|
||||
Class.forName("org.elasticsearch.common.joda.time.DateTime");
|
||||
Class.forName("org.elasticsearch.common.util.concurrent.jsr166e.LongAdder");
|
||||
}
|
||||
|
||||
@Test(expected = ClassNotFoundException.class)
|
||||
public void testGuavaIsNotOnTheCP() throws ClassNotFoundException {
|
||||
Class.forName("com.google.common.cache.LoadingCache");
|
||||
}
|
||||
|
||||
@Test(expected = ClassNotFoundException.class)
|
||||
public void testJodaIsNotOnTheCP() throws ClassNotFoundException {
|
||||
Class.forName("org.joda.time.DateTime");
|
||||
}
|
||||
|
||||
@Test(expected = ClassNotFoundException.class)
|
||||
public void testjsr166eIsNotOnTheCP() throws ClassNotFoundException {
|
||||
Class.forName("com.twitter.jsr166e.LongAdder");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue