OpenSearch/dev-tools
David Pilato 34ee4c2d66 [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.
2015-09-02 11:57:10 +02:00
..
src/main/resources [build] remove shaded elasticsearch version 2015-09-02 11:57:10 +02:00
Elasticsearch.launch Eclipse: Fix launch configuration 2015-08-21 19:07:03 -07:00
build_randomization.rb [BUILD] Randomly enable AggressiveOpts in builds 2014-09-09 21:58:37 +02:00
build_repositories.sh Release: Remove aws-maven plugin/improve release docs 2015-08-17 15:39:22 +02:00
client_tests_urls.prop [BUILD] Switch 1x to JDK7 download 2014-03-31 19:28:27 -07:00
create_bwc_index.py Tests: Fix generation scripts for bwc indexes, and add 2.0 beta1 index 2015-08-26 19:36:26 -07:00
create_bwc_index_with_conficting_mappings.py Check for incompatible mappings while upgrading old indices 2015-08-04 18:13:29 -06:00
create_bwc_index_with_some_ancient_segments.py Check for incompatible mappings while upgrading old indices 2015-08-04 18:13:29 -06:00
create_bwc_repo_with_ancient_indices.py Core: Don't allow indices containing too-old segments to be opened 2015-05-19 23:37:05 -04:00
download-s3.py [TOOLS] Added simple S3 Download tool based on boto 2014-06-02 13:35:21 +02:00
es_release_notes.pl Release notes: Add upgrades category 2015-08-25 17:16:14 +02:00
extract_party_license.rb typo fixes - https://github.com/vlajos/misspell_fixer 2014-11-08 18:55:57 +01:00
get-bwc-version.py Make 0.x and 1.x indexes still work with get-bwc-version 2015-08-27 10:19:59 -07:00
pom.xml [maven] also rename artifactId for dev-tools and rest-api-spec 2015-08-18 13:41:12 +02:00
prepare_release_candidate.py [BUILD] Add publish instructions to the release script 2015-08-26 16:22:14 +02:00
prepare_release_update_documentation.py Release scripts: Split prepare_release into two scripts 2015-08-14 16:44:39 +02:00
smoke_test_rc.py use provided version in smoke test file paths 2015-08-27 23:20:01 +02:00
upgrade-tests.py Networking: Move multicast discovery to a plugin 2015-08-20 16:43:25 -07:00
upload-s3.py Fix ASL Header in source files to reflect s/ElasticSearch/Elasticsearch 2014-01-07 11:22:01 +01:00