# Maven shaded/renamed dependencies in es

**URL:** <https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053>\
**Category:** Elasticsearch\
**Created:** [June 12, 2012, 7:45am UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053 "2012-06-12T07:45:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sisu\_Alexandru](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@Sisu\_Alexandru](https://discuss.elastic.co/u/Sisu_Alexandru)\
**Post date:** [June 12, 2012, 7:45am UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053/1 "2012-06-12T07:45:55Z")

</div>

Hello all,

I'm developing some custom facets based on the default ones present in the  
elasticsearch.

My problems are the way I manage dependencies for my custom plugin/facet  
projects.

Here's my question: what would be the best practice for referencing joda  
and guava libraries in the project?

My eclipse workspace setup is:  
-elasticsearch sourcecode project  
-code for my custom plugins and facets. (gradle build)

As a binary elasticsearch shades/renames the joda and guava libraries to  
org.elasticsearch.common.  
That means, when using elasticsearch binary jar as a reference for my  
custom project, I'm referencing the shaded joda and guava libraries.

BUT! This way I can't debug.

Therefore, at the moment, I'm using 2 sets of imports (literary: 2 sets of  
imports in the classes using guava/joda) depending on the task I'm doing:

- for debugging, I reference the standard guava and joda, this way my  
plugins get deployed and I have access to the internals of es
- for deploying I reference elasticsearch-0.19.4 binary

It sucks, I know, and I am curious if there is a clean way to do this,  
other then maven, preferably with gradle, or any other method.

Tnx,

Alex

---

<div class="post-metadata">

**Author:** ![Sisu\_Alexandru](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@Sisu\_Alexandru](https://discuss.elastic.co/u/Sisu_Alexandru)\
**Post date:** [June 12, 2012, 12:04pm UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053/2 "2012-06-12T12:04:32Z")

</div>

Regarding having my custom project as a maven project. It still doesnt  
solve the issue.  
That is because, even if I manage to shade dependencies, I still need to  
have hard references to elasticsearch source code in my workspace.  
And I still dont have a clear way of dealing with the shaded dependencies.  
Damn!🙂

Or I might be wrong??

On Tue, Jun 12, 2012 at 9:45 AM, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)wrote:

> Hello all,
> 
> I'm developing some custom facets based on the default ones present in the  
> elasticsearch.
> 
> My problems are the way I manage dependencies for my custom plugin/facet  
> projects.
> 
> Here's my question: what would be the best practice for referencing joda  
> and guava libraries in the project?
> 
> My eclipse workspace setup is:  
> -elasticsearch sourcecode project  
> -code for my custom plugins and facets. (gradle build)
> 
> As a binary elasticsearch shades/renames the joda and guava libraries to  
> org.elasticsearch.common.  
> That means, when using elasticsearch binary jar as a reference for my  
> custom project, I'm referencing the shaded joda and guava libraries.
> 
> BUT! This way I can't debug.
> 
> Therefore, at the moment, I'm using 2 sets of imports (literary: 2 sets of  
> imports in the classes using guava/joda) depending on the task I'm doing:
> 
> - for debugging, I reference the standard guava and joda, this way my  
> plugins get deployed and I have access to the internals of es
> - for deploying I reference elasticsearch-0.19.4 binary
> 
> It sucks, I know, and I am curious if there is a clean way to do this,  
> other then maven, preferably with gradle, or any other method.
> 
> Tnx,
> 
> Alex

---

<div class="post-metadata">

**Author:** ![Sisu\_Alexandru](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@Sisu\_Alexandru](https://discuss.elastic.co/u/Sisu_Alexandru)\
**Post date:** [June 13, 2012, 11:24am UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053/3 "2012-06-13T11:24:28Z")

</div>

The following compromise had been reached:

- remove the shading step from elasticsearch building;
- install the generated elasticsearch jar in your local repository
- build the project with references to the elasticsearch jar in your local  
repository;
- shade the resulting project jar;

But its wicked.... Still waiting for suggestions 🙂 :-?

On Tue, Jun 12, 2012 at 2:04 PM, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)wrote:

> Regarding having my custom project as a maven project. It still doesnt  
> solve the issue.  
> That is because, even if I manage to shade dependencies, I still need to  
> have hard references to elasticsearch source code in my workspace.  
> And I still dont have a clear way of dealing with the shaded dependencies.  
> Damn!🙂
> 
> Or I might be wrong??
> 
> On Tue, Jun 12, 2012 at 9:45 AM, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)wrote:
> 
> > Hello all,
> > 
> > I'm developing some custom facets based on the default ones present in  
> > the elasticsearch.
> > 
> > My problems are the way I manage dependencies for my custom plugin/facet  
> > projects.
> > 
> > Here's my question: what would be the best practice for referencing joda  
> > and guava libraries in the project?
> > 
> > My eclipse workspace setup is:  
> > -elasticsearch sourcecode project  
> > -code for my custom plugins and facets. (gradle build)
> > 
> > As a binary elasticsearch shades/renames the joda and guava libraries to  
> > org.elasticsearch.common.  
> > That means, when using elasticsearch binary jar as a reference for my  
> > custom project, I'm referencing the shaded joda and guava libraries.
> > 
> > BUT! This way I can't debug.
> > 
> > Therefore, at the moment, I'm using 2 sets of imports (literary: 2 sets  
> > of imports in the classes using guava/joda) depending on the task I'm doing:
> > 
> > - for debugging, I reference the standard guava and joda, this way my  
> > plugins get deployed and I have access to the internals of es
> > - for deploying I reference elasticsearch-0.19.4 binary
> > 
> > It sucks, I know, and I am curious if there is a clean way to do this,  
> > other then maven, preferably with gradle, or any other method.
> > 
> > Tnx,
> > 
> > Alex

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 13, 2012, 11:44am UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053/4 "2012-06-13T11:44:15Z")

</div>

You could perhaps grab the source code of joda and guava, import it in your IDE  
(Eclise for example), and refactor the package name to start with  
org.elasticsearch....

Then, add these projects as source when debugging...

It may help.

David.

Le 13 juin 2012 à 13:24, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com) a écrit :

> The following compromise had been reached:
> 
> - remove the shading step from elasticsearch building;
> - install the generated elasticsearch jar in your local repository
> - build the project with references to the elasticsearch jar in your local  
> repository;
> - shade the resulting project jar;
> 
> But its wicked.... Still waiting for suggestions 🙂 :-?
> 
> On Tue, Jun 12, 2012 at 2:04 PM, Sisu Alexandru \<[sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)  
> [mailto:sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com) \> wrote:
> 
> > > Regarding having my custom project as a maven project. It still doesnt  
> > > solve the issue.  
> > > That is because, even if I manage to shade dependencies, I still need to  
> > > have hard references to elasticsearch source code in my workspace.  
> > > And I still dont have a clear way of dealing with the shaded  
> > > dependencies. Damn!🙂
> > 
> > Or I might be wrong??
> > 
> > On Tue, Jun 12, 2012 at 9:45 AM, Sisu Alexandru \<[sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)  
> > [mailto:sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com) \> wrote:  
> > \> \> \> Hello all,
> > 
> > > ```
> > > I'm developing some custom facets based on the default ones present
> > > 
> > > ```
> > > 
> > > in the elasticsearch.
> > > 
> > > ```
> > > My problems are the way I manage dependencies for my custom
> > > 
> > > ```
> > > 
> > > plugin/facet projects.
> > > 
> > > ```
> > > Here's my question: what would be the best practice for referencing
> > > 
> > > ```
> > > 
> > > joda and guava libraries in the project?
> > > 
> > > ```
> > > My eclipse workspace setup is:
> > > -elasticsearch sourcecode project
> > > -code for my custom plugins and facets. (gradle build)
> > > 
> > > As a binary elasticsearch shades/renames the joda and guava libraries
> > > 
> > > ```
> > > 
> > > to org.elasticsearch.common.  
> > > That means, when using elasticsearch binary jar as a reference for my  
> > > custom project, I'm referencing the shaded joda and guava libraries.
> > > 
> > > ```
> > > BUT! This way I can't debug.
> > > 
> > > Therefore, at the moment, I'm using 2 sets of imports (literary: 2
> > > 
> > > ```
> > > 
> > > sets of imports in the classes using guava/joda) depending on the task I'm  
> > > doing:  
> > > - for debugging, I reference the standard guava and joda, this way my  
> > > plugins get deployed and I have access to the internals of es  
> > > - for deploying I reference elasticsearch-0.19.4 binary
> > > 
> > > ```
> > > It sucks, I know, and I am curious if there is a clean way to do
> > > 
> > > ```
> > > 
> > > this, other then maven, preferably with gradle, or any other method.
> > > 
> > > ```
> > > Tnx,
> > > 
> > > Alex
> > > 
> > > ```
> > > 
> > > > > >

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![Sisu\_Alexandru](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@Sisu\_Alexandru](https://discuss.elastic.co/u/Sisu_Alexandru)\
**Post date:** [June 13, 2012, 12:34pm UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053/5 "2012-06-13T12:34:28Z")

</div>

Tnx for the suggestion.

Meanwhile what I did, was to create an empty eclipse project. Add the  
binaries of the es, and its sources. And start es directly from the jar.  
:). (in eclipse \>:) ).

And it works. No more shaded dependencies hell.  
I can deploy and I can debug.

Cheers,

Alex

On Wed, Jun 13, 2012 at 1:44 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> \*\*
> 
> You could perhaps grab the source code of joda and guava, import it in  
> your IDE (Eclise for example), and refactor the package name to start with  
> org.elasticsearch....
> 
> Then, add these projects as source when debugging...
> 
> It may help.
> 
> David.
> 
> Le 13 juin 2012 à 13:24, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com) a écrit :
> 
> The following compromise had been reached:
> 
> - remove the shading step from elasticsearch building;
> - install the generated elasticsearch jar in your local repository
> - build the project with references to the elasticsearch jar in your  
> local repository;
> - shade the resulting project jar;
> 
> But its wicked.... Still waiting for suggestions 🙂 :-?
> 
> On Tue, Jun 12, 2012 at 2:04 PM, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)wrote:
> 
> Regarding having my custom project as a maven project. It still doesnt  
> solve the issue.  
> That is because, even if I manage to shade dependencies, I still need to  
> have hard references to elasticsearch source code in my workspace.  
> And I still dont have a clear way of dealing with the shaded  
> dependencies. Damn!🙂
> 
> Or I might be wrong??
> 
> On Tue, Jun 12, 2012 at 9:45 AM, Sisu Alexandru [sisu.eugen@gmail.com](mailto:sisu.eugen@gmail.com)wrote:
> 
> Hello all,
> 
> I'm developing some custom facets based on the default ones present in  
> the elasticsearch.
> 
> My problems are the way I manage dependencies for my custom plugin/facet  
> projects.
> 
> Here's my question: what would be the best practice for referencing joda  
> and guava libraries in the project?
> 
> My eclipse workspace setup is:  
> -elasticsearch sourcecode project  
> -code for my custom plugins and facets. (gradle build)
> 
> As a binary elasticsearch shades/renames the joda and guava libraries to  
> org.elasticsearch.common.  
> That means, when using elasticsearch binary jar as a reference for my  
> custom project, I'm referencing the shaded joda and guava libraries.
> 
> BUT! This way I can't debug.
> 
> Therefore, at the moment, I'm using 2 sets of imports (literary: 2 sets  
> of imports in the classes using guava/joda) depending on the task I'm  
> doing:
> 
> - for debugging, I reference the standard guava and joda, this way my  
> plugins get deployed and I have access to the internals of es
> - for deploying I reference elasticsearch-0.19.4 binary
> 
> It sucks, I know, and I am curious if there is a clean way to do this,  
> other then maven, preferably with gradle, or any other method.
> 
> Tnx,
> 
> Alex
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:24am UTC](https://discuss.elastic.co/t/maven-shaded-renamed-dependencies-in-es/8053/6 "2017-07-06T03:24:35Z")

</div>


