@@ -150,62 +150,6 @@ and add it as a dependency. As an example, we will use the `slf4j-simple` logger
150
150
</dependency>
151
151
--------------------------------------------------
152
152
153
-
154
- == Dealing with JAR dependency conflicts
155
-
156
- If you want to use Elasticsearch in your Java application, you may have to deal with version conflicts with third party
157
- dependencies like Guava and Joda. For instance, perhaps Elasticsearch uses Joda 2.8, while your code uses Joda 2.1.
158
-
159
- You have two choices:
160
-
161
- * The simplest solution is to upgrade. Newer module versions are likely to have fixed old bugs.
162
- The further behind you fall, the harder it will be to upgrade later. Of course, it is possible that you are using a
163
- third party dependency that in turn depends on an outdated version of a package, which prevents you from upgrading.
164
-
165
- * The second option is to relocate the troublesome dependencies and to shade them either with your own application
166
- or with Elasticsearch and any plugins needed by the Elasticsearch client.
167
-
168
- The https://www.elastic.co/blog/to-shade-or-not-to-shade["To shade or not to shade" blog post] describes
169
- all the steps for doing so.
170
-
171
- == Embedding jar with dependencies
172
-
173
- If you want to create a single jar containing your application and all dependencies, you should not
174
- use `maven-assembly-plugin` for that because it can not deal with `META-INF/services` structure which is
175
- required by Lucene jars.
176
-
177
- Instead, you can use `maven-shade-plugin` and configure it as follow:
178
-
179
- [source,xml]
180
- --------------------------------------------------
181
- <plugin>
182
- <groupId>org.apache.maven.plugins</groupId>
183
- <artifactId>maven-shade-plugin</artifactId>
184
- <version>2.4.1</version>
185
- <executions>
186
- <execution>
187
- <phase>package</phase>
188
- <goals><goal>shade</goal></goals>
189
- <configuration>
190
- <transformers>
191
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
192
- </transformers>
193
- </configuration>
194
- </execution>
195
- </executions>
196
- </plugin>
197
- --------------------------------------------------
198
-
199
- Note that if you have a `main` class you want to automatically call when running `java -jar yourjar.jar`, just add
200
- it to the `transformers`:
201
-
202
- [source,xml]
203
- --------------------------------------------------
204
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
205
- <mainClass>org.elasticsearch.demo.Generate</mainClass>
206
- </transformer>
207
- --------------------------------------------------
208
-
209
153
include::client.asciidoc[]
210
154
211
155
include::docs.asciidoc[]
0 commit comments