# ElasticSearch + ProGuard

**URL:** <https://discuss.elastic.co/t/elasticsearch-proguard/9478>\
**Category:** Elasticsearch\
**Created:** [October 26, 2012, 10:24am UTC](https://discuss.elastic.co/t/elasticsearch-proguard/9478 "2012-10-26T10:24:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Warski](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@Adam\_Warski](https://discuss.elastic.co/u/Adam_Warski)\
**Post date:** [October 26, 2012, 10:24am UTC](https://discuss.elastic.co/t/elasticsearch-proguard/9478/1 "2012-10-26T10:24:52Z")

</div>

Hello,

I'm trying to run ProGuard on one project that includes ElasticSearch.  
However the process fails with a DuplicateZipEntry exception:

[error] {file:/Users/adamw/projects/...}.../\*:proguard:  
java.io.IOException: Can't write  
[/Users/adamw/projects/.../target/scala-2.9.1/....min.jar] (Can't read  
[/Users/adamw/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-0.19.10.jar(;;;;!META-INF/MANIFEST.MF)]  
(Duplicate zip entry  
[elasticsearch-0.19.10.jar:org/apache/lucene/index/BufferedDeletesStream$1.class]))

When looking at the BufferedDeletesStream class, indeed it says:

// LUCENE MONITOR: We copied this class from Lucene, effectively overriding  
it with our implementation  
// if it comes first in the classpath, allowing for faster apply deletes  
based on terms

which is the cause of the issue. Not sure if it will be a problem for  
anyone else. Still looking for a solution using proguard configuration,  
just letting you know :).

Adam

--

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [October 26, 2012, 4:09pm UTC](https://discuss.elastic.co/t/elasticsearch-proguard/9478/2 "2012-10-26T16:09:15Z")

</div>

Elasticsearch shadows the Lucene library, so one option would be to not to  
include Lucene.

--  
Ivan

On Fri, Oct 26, 2012 at 3:24 AM, Adam Warski [adamwtw@gmail.com](mailto:adamwtw@gmail.com) wrote:

> Hello,
> 
> I'm trying to run ProGuard on one project that includes Elasticsearch.  
> However the process fails with a DuplicateZipEntry exception:
> 
> [error] {file:/Users/adamw/projects/...}.../\*:proguard:  
> java.io.IOException: Can't write  
> [/Users/adamw/projects/.../target/scala-2.9.1/....min.jar] (Can't read  
> [/Users/adamw/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-0.19.10.jar(;;;;!META-INF/MANIFEST.MF)]  
> (Duplicate zip entry  
> [elasticsearch-0.19.10.jar:org/apache/lucene/index/BufferedDeletesStream$1.class]))
> 
> When looking at the BufferedDeletesStream class, indeed it says:
> 
> // LUCENE MONITOR: We copied this class from Lucene, effectively  
> overriding it with our implementation  
> // if it comes first in the classpath, allowing for faster apply deletes  
> based on terms
> 
> which is the cause of the issue. Not sure if it will be a problem for  
> anyone else. Still looking for a solution using proguard configuration,  
> just letting you know :).
> 
> Adam
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Adam\_Warski\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adam_warski_2/32/2668_2.png) [@Adam\_Warski\_2](https://discuss.elastic.co/u/Adam_Warski_2)\
**Post date:** [October 26, 2012, 4:17pm UTC](https://discuss.elastic.co/t/elasticsearch-proguard/9478/3 "2012-10-26T16:17:53Z")

</div>

Well it shadows only this one particular class.

I found a solution, basically you need to exclude that class from proguard. If you're using xsbt-proguarg-pluing, you need to set this setting:

val proguardFileFilter = (file: String) =\> {  
if (file.contains("lucene-core"))  
"!META-INF/MANIFEST.MF,!org/apache/lucene/index/BufferedDeletesStream\*.class"  
else {  
"!META-INF/MANIFEST.MF"  
}  
}

// From ProguardPlugin.proguardSettings  
makeInJarFilter := proguardFileFilter

Adam

On Oct 26, 2012, at 6:09 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Elasticsearch shadows the Lucene library, so one option would be to not to include Lucene.
> 
> --  
> Ivan
> 
> On Fri, Oct 26, 2012 at 3:24 AM, Adam Warski [adamwtw@gmail.com](mailto:adamwtw@gmail.com) wrote:  
> Hello,
> 
> I'm trying to run ProGuard on one project that includes Elasticsearch. However the process fails with a DuplicateZipEntry exception:
> 
> [error] {file:/Users/adamw/projects/...}.../\*:proguard: java.io.IOException: Can't write [/Users/adamw/projects/.../target/scala-2.9.1/....min.jar] (Can't read [/Users/adamw/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-0.19.10.jar(;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [elasticsearch-0.19.10.jar:org/apache/lucene/index/BufferedDeletesStream$1.class]))
> 
> When looking at the BufferedDeletesStream class, indeed it says:
> 
> // LUCENE MONITOR: We copied this class from Lucene, effectively overriding it with our implementation  
> // if it comes first in the classpath, allowing for faster apply deletes based on terms
> 
> which is the cause of the issue. Not sure if it will be a problem for anyone else. Still looking for a solution using proguard configuration, just letting you know :).
> 
> Adam
> 
> --
> 
> --

--  
Adam Warski

[http://twitter.com/#!/adamwarski](http://twitter.com/#!/adamwarski)

> **[SoftwareMill - proactively transforming your business with technology](https://softwaremill.com/)**
>
> Custom software solutions: web applications, backend systems & enterprise applications. Scala, Java, Big Data, Machine Learning, Blockchain.

> **[Adam Warski](https://www.warski.org)**
>
> Sharing elegant solutions to everyday problems

--

---

<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:07am UTC](https://discuss.elastic.co/t/elasticsearch-proguard/9478/4 "2017-07-06T03:07:04Z")

</div>


