Skip to content

REST client pom.xml has runtime dependencies #19835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dadoonet opened this issue Aug 5, 2016 · 6 comments · Fixed by #19876
Closed

REST client pom.xml has runtime dependencies #19835

dadoonet opened this issue Aug 5, 2016 · 6 comments · Fixed by #19876
Labels
>bug :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team

Comments

@dadoonet
Copy link
Member

dadoonet commented Aug 5, 2016

With alpha5-SNAPSHOT, here is an extract of the generated pom.xml. See https://oss.sonatype.org/content/repositories/snapshots/org/elasticsearch/client/rest/5.0.0-alpha5-SNAPSHOT/rest-5.0.0-alpha5-20160805.100826-168.pom

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpcore</artifactId>
  <version>4.4.5</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpasyncclient</artifactId>
  <version>4.1.2</version>
  <scope>runtime</scope>
</dependency>

Which basically means that you can't use OOTB the apache classes:

RestClient restClient = RestClient.builder(
        new HttpHost("http", "localhost", 9200),
        new HttpHost("http", "localhost", 9201)).build();

This won't compile.

Note that it was working well with alpha4. I did not try a "final" released version of alpha5 though.

@dadoonet dadoonet added the :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch label Aug 5, 2016
@dadoonet
Copy link
Member Author

dadoonet commented Aug 5, 2016

The workaround for now is to add in the project which uses a REST client:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.4.5</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpasyncclient</artifactId>
    <version>4.1.2</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.1.2</version>
    <scope>compile</scope>
</dependency>

@nik9000
Copy link
Member

nik9000 commented Aug 5, 2016

Hmm - I think it'd be much more friendly to call them compile dependencies. We mostly want them to be. If the user really wants them to be runtime dependencies they can override the scope in their pom.

@javanna
Copy link
Member

javanna commented Aug 5, 2016

I have no idea where this runtime thing comes from, they are declared compile in our build.gradle. https://github.com/elastic/elasticsearch/blob/master/client/rest/build.gradle#L34

@nik9000 nik9000 added >bug :Delivery/Build Build or test infrastructure labels Aug 5, 2016
@nik9000
Copy link
Member

nik9000 commented Aug 5, 2016

I expect it is a pom generation thing.

@javanna
Copy link
Member

javanna commented Aug 5, 2016

@rjernst do you know where this may come from? let me know if I can help.

@javanna javanna removed their assignment Aug 8, 2016
rjernst added a commit to rjernst/elasticsearch that referenced this issue Aug 8, 2016
This change works around a known issue with using the maven-publish
gralde plugin. All deps are marked in the generated pom as runtime. With
this change, they are set back to compile time. This also simplified the
transitive dependencies exclusion to work the same as how it was fixed in
gradle 2.14 (wildcard exclusions).

closes elastic#19835
@rjernst
Copy link
Member

rjernst commented Aug 8, 2016

This is an issue with the maven-publish plugin in gradle, which the unified release uses. In alpha5, we generated the poms for the client jars using the new mechanism, while the old jar poms were still built using the maven plugin.

I opened a PR to fix: #19876

@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Clients/Java Low Level REST Client Minimal dependencies Java Client for Elasticsearch :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants