# Java API noob question

**URL:** <https://discuss.elastic.co/t/java-api-noob-question/3253>\
**Category:** Elasticsearch\
**Created:** [August 24, 2010, 6:42pm UTC](https://discuss.elastic.co/t/java-api-noob-question/3253 "2010-08-24T18:42:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [August 24, 2010, 6:42pm UTC](https://discuss.elastic.co/t/java-api-noob-question/3253/1 "2010-08-24T18:42:35Z")

</div>

Hopefully a quick question...

I get that the Java APIs are in a maven repository hosted by sonatype.  
I've spent a few minutes reading around on maven and how it uses  
repositories, but don't feel any closer to answering my question. I'm  
sure I could figure this out eventually...

Can somebody give me details on the correct way to pull these down?

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [August 24, 2010, 7:57pm UTC](https://discuss.elastic.co/t/java-api-noob-question/3253/2 "2010-08-24T19:57:02Z")

</div>

Hi,

the following is what works fine for me:

1. First of all you need to install maven on your machine.  
[http://maven.apache.org/](http://maven.apache.org/)  
[http://maven.apache.org/](http://maven.apache.org/)2) You need some maven repository to pull ES  
artifacts from. There are two options:  
a) you can pull from sonatype repository (in this case you want to use  
some of releases installed there or the SNAPSHOT version)  
b) you want to use the most recent version of ES which is built or  
modified locally. In this case it is better to pull from your local maven  
repo (typically located in .m2/repository folder). It is pretty easy to  
install the most recent artifact into your local repo by issuing the  
following gradle commands in the ES root folder:

> gradlew clean release install

Then you need to declare dependency in your pom.xml file. The following is  
example which follows the scenario b) above.

```
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <!--
            Assume ElasticSearch is installed in local mvn repository.
            You can install it into local repo using: > gradlew clean

```

release install  
--\>  
0.9.1-SNAPSHOT  
  
  
com.sun.jmx  
jmxri  
  
  
com.sun.jdmk  
jmxtools  
  
  
javax.jms  
jms  
  
  
javax.mail  
mail

Note: If I remember correctly then those are used because of  
log4j.1.2.16 dependencies (these transitive dependencies are not needed and  
are problematic w/t maven dependency mechanism as there are some licencing  
issues on the Sun/Oracle side).

If you want to use sonatype repository as opposed to local repository then  
there are many ways how you can tell maven to use it. Probably the most  
explicit one is to add sonatype repository directly into your pom.xml file.  
The following you can find more info about how to do it:  
[http://maven.apache.org/guides/introduction/introduction-to-repositories.html](http://maven.apache.org/guides/introduction/introduction-to-repositories.html)

Regards,  
Lukas

On Tue, Aug 24, 2010 at 8:42 PM, Paul [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> Hopefully a quick question...
> 
> I get that the Java APIs are in a maven repository hosted by sonatype.  
> I've spent a few minutes reading around on maven and how it uses  
> repositories, but don't feel any closer to answering my question. I'm  
> sure I could figure this out eventually...
> 
> Can somebody give me details on the correct way to pull these down?
> 
> Thanks,  
> Paul

---

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [August 24, 2010, 7:59pm UTC](https://discuss.elastic.co/t/java-api-noob-question/3253/3 "2010-08-24T19:59:57Z")

</div>

Thanks! I will give it a try, and should be able to figure out what I  
am doing with this info.

On Aug 24, 1:57 pm, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:

> Hi,
> 
> the following is what works fine for me:
> 
> 1. First of all you need to install maven on your machine.[http://maven.apache.org/](http://maven.apache.org/)  
> [http://maven.apache.org/](http://maven.apache.org/)2) You need some maven repository to pull ES  
> artifacts from. There are two options:  
> a) you can pull from sonatype repository (in this case you want to use  
> some of releases installed there or the SNAPSHOT version)  
> b) you want to use the most recent version of ES which is built or  
> modified locally. In this case it is better to pull from your local maven  
> repo (typically located in .m2/repository folder). It is pretty easy to  
> install the most recent artifact into your local repo by issuing the  
> following gradle commands in the ES root folder:
> 
> > gradlew clean release install
> 
> Then you need to declare dependency in your pom.xml file. The following is  
> example which follows the scenario b) above.
> 
> ```
> <dependency>
> <groupId>org.elasticsearch</groupId>
> <artifactId>elasticsearch</artifactId>
> <!--
> Assume ElasticSearch is installed in local mvn repository.
> You can install it into local repo using: > gradlew clean
> 
> ```
> 
> release install  
> --\>  
> 0.9.1-SNAPSHOT  
>   
>   
> com.sun.jmx  
> jmxri  
>   
>   
> com.sun.jdmk  
> jmxtools  
>   
>   
> javax.jms  
> jms  
>   
>   
> javax.mail  
> mail
> 
> Note: If I remember correctly then those are used because of  
> log4j.1.2.16 dependencies (these transitive dependencies are not needed and  
> are problematic w/t maven dependency mechanism as there are some licencing  
> issues on the Sun/Oracle side).
> 
> If you want to use sonatype repository as opposed to local repository then  
> there are many ways how you can tell maven to use it. Probably the most  
> explicit one is to add sonatype repository directly into your pom.xml file.  
> The following you can find more info about how to do it:[http://maven.apache.org/guides/introduction/introduction-to-repositor](http://maven.apache.org/guides/introduction/introduction-to-repositor)...
> 
> Regards,  
> Lukas
> 
> On Tue, Aug 24, 2010 at 8:42 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> 
> > Hopefully a quick question...
> 
> > I get that the Java APIs are in a maven repository hosted by sonatype.  
> > I've spent a few minutes reading around on maven and how it uses  
> > repositories, but don't feel any closer to answering my question. I'm  
> > sure I could figure this out eventually...
> 
> > Can somebody give me details on the correct way to pull these down?
> 
> > Thanks,  
> > Paul

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 24, 2010, 8:22pm UTC](https://discuss.elastic.co/t/java-api-noob-question/3253/4 "2010-08-24T20:22:30Z")

</div>

If you just want the jar files, then its in the distribution called  
elasticsearch-XXX.jar. You don't need anything else. You don't have to use  
maven or maven repos if you don't want to.

-shay.banon

On Tue, Aug 24, 2010 at 10:59 PM, Paul [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> Thanks! I will give it a try, and should be able to figure out what I  
> am doing with this info.
> 
> On Aug 24, 1:57 pm, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:
> 
> > Hi,
> > 
> > the following is what works fine for me:
> > 
> > 1. First of all you need to install maven on your machine.  
> > [http://maven.apache.org/](http://maven.apache.org/)  
> > [http://maven.apache.org/](http://maven.apache.org/)2) You need some maven repository to pull ES  
> > artifacts from. There are two options:  
> > a) you can pull from sonatype repository (in this case you want to use  
> > some of releases installed there or the SNAPSHOT version)  
> > b) you want to use the most recent version of ES which is built or  
> > modified locally. In this case it is better to pull from your local maven  
> > repo (typically located in .m2/repository folder). It is pretty easy to  
> > install the most recent artifact into your local repo by issuing the  
> > following gradle commands in the ES root folder:
> > 
> > > gradlew clean release install
> > 
> > Then you need to declare dependency in your pom.xml file. The following  
> > is  
> > example which follows the scenario b) above.
> > 
> > ```
> > <dependency>
> > <groupId>org.elasticsearch</groupId>
> > <artifactId>elasticsearch</artifactId>
> > <!--
> > Assume ElasticSearch is installed in local mvn
> > 
> > ```
> 
> repository.
> 
> > ```
> > You can install it into local repo using: > gradlew clean
> > 
> > ```
> > 
> > release install  
> > --\>  
> > 0.9.1-SNAPSHOT  
> >   
> >   
> > com.sun.jmx  
> > jmxri  
> >   
> >   
> > com.sun.jdmk  
> > jmxtools  
> >   
> >   
> > javax.jms  
> > jms  
> >   
> >   
> > javax.mail  
> > mail
> > 
> > Note: If I remember correctly then those are used because  
> > of  
> > log4j.1.2.16 dependencies (these transitive dependencies are not needed  
> > and  
> > are problematic w/t maven dependency mechanism as there are some  
> > licencing  
> > issues on the Sun/Oracle side).
> > 
> > If you want to use sonatype repository as opposed to local repository  
> > then  
> > there are many ways how you can tell maven to use it. Probably the most  
> > explicit one is to add sonatype repository directly into your pom.xml  
> > file.  
> > The following you can find more info about how to do it:  
> > [http://maven.apache.org/guides/introduction/introduction-to-repositor](http://maven.apache.org/guides/introduction/introduction-to-repositor)...
> > 
> > Regards,  
> > Lukas
> > 
> > On Tue, Aug 24, 2010 at 8:42 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> > 
> > > Hopefully a quick question...
> > 
> > > I get that the Java APIs are in a maven repository hosted by sonatype.  
> > > I've spent a few minutes reading around on maven and how it uses  
> > > repositories, but don't feel any closer to answering my question. I'm  
> > > sure I could figure this out eventually...
> > 
> > > Can somebody give me details on the correct way to pull these down?
> > 
> > > Thanks,  
> > > Paul

---

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [August 25, 2010, 7:53pm UTC](https://discuss.elastic.co/t/java-api-noob-question/3253/5 "2010-08-25T19:53:30Z")

</div>

Ah, that is easy. Thanks Shay and Lukas!

On Aug 24, 2:22 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> If you just want the jar files, then its in the distribution called  
> elasticsearch-XXX.jar. You don't need anything else. You don't have to use  
> maven or maven repos if you don't want to.
> 
> -shay.banon
> 
> On Tue, Aug 24, 2010 at 10:59 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> 
> > Thanks! I will give it a try, and should be able to figure out what I  
> > am doing with this info.
> 
> > On Aug 24, 1:57 pm, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:
> > 
> > > Hi,
> 
> > > the following is what works fine for me:
> > > 
> > > 1. First of all you need to install maven on your machine.  
> > > [http://maven.apache.org/](http://maven.apache.org/)  
> > > [http://maven.apache.org/](http://maven.apache.org/)2) You need some maven repository to pull ES  
> > > artifacts from. There are two options:  
> > > a) you can pull from sonatype repository (in this case you want to use  
> > > some of releases installed there or the SNAPSHOT version)  
> > > b) you want to use the most recent version of ES which is built or  
> > > modified locally. In this case it is better to pull from your local maven  
> > > repo (typically located in .m2/repository folder). It is pretty easy to  
> > > install the most recent artifact into your local repo by issuing the  
> > > following gradle commands in the ES root folder:
> 
> > > > gradlew clean release install
> 
> > > Then you need to declare dependency in your pom.xml file. The following  
> > > is  
> > > example which follows the scenario b) above.
> 
> > > ```
> > > <dependency>
> > > <groupId>org.elasticsearch</groupId>
> > > <artifactId>elasticsearch</artifactId>
> > > <!--
> > > Assume ElasticSearch is installed in local mvn
> > > 
> > > ```
> > 
> > repository.
> > 
> > > ```
> > > You can install it into local repo using: > gradlew clean
> > > 
> > > ```
> > > 
> > > release install  
> > > --\>  
> > > 0.9.1-SNAPSHOT  
> > >   
> > >   
> > > com.sun.jmx  
> > > jmxri  
> > >   
> > >   
> > > com.sun.jdmk  
> > > jmxtools  
> > >   
> > >   
> > > javax.jms  
> > > jms  
> > >   
> > >   
> > > javax.mail  
> > > mail
> 
> > > Note: If I remember correctly then those are used because  
> > > of  
> > > log4j.1.2.16 dependencies (these transitive dependencies are not needed  
> > > and  
> > > are problematic w/t maven dependency mechanism as there are some  
> > > licencing  
> > > issues on the Sun/Oracle side).
> 
> > > If you want to use sonatype repository as opposed to local repository  
> > > then  
> > > there are many ways how you can tell maven to use it. Probably the most  
> > > explicit one is to add sonatype repository directly into your pom.xml  
> > > file.  
> > > The following you can find more info about how to do it:  
> > > [http://maven.apache.org/guides/introduction/introduction-to-repositor](http://maven.apache.org/guides/introduction/introduction-to-repositor)...
> 
> > > Regards,  
> > > Lukas
> 
> > > On Tue, Aug 24, 2010 at 8:42 PM, Paul [ppea...@gmail.com](mailto:ppea...@gmail.com) wrote:
> > > 
> > > > Hopefully a quick question...
> 
> > > > I get that the Java APIs are in a maven repository hosted by sonatype.  
> > > > I've spent a few minutes reading around on maven and how it uses  
> > > > repositories, but don't feel any closer to answering my question. I'm  
> > > > sure I could figure this out eventually...
> 
> > > > Can somebody give me details on the correct way to pull these down?
> 
> > > > Thanks,  
> > > > Paul

---

<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, 4:20am UTC](https://discuss.elastic.co/t/java-api-noob-question/3253/6 "2017-07-06T04:20:20Z")

</div>


