Skip to content
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

X-Pack Transport Client POM does not include all dependencies #31946

Closed
tvernum opened this issue Jul 11, 2018 · 7 comments · Fixed by #32180
Closed

X-Pack Transport Client POM does not include all dependencies #31946

tvernum opened this issue Jul 11, 2018 · 7 comments · Fixed by #32180
Assignees
Labels
blocker >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v6.3.2 v6.4.0

Comments

@tvernum
Copy link
Contributor

tvernum commented Jul 11, 2018

In 6.2 and earlier, the x-pack-transport POM had a dependency on x-pack-api which pulled in 3rd party dependencies such as the UnboundId LDAP SDK and Bouncy Castle (for reading TLS keys)

The (abbreviated) dependency tree was:

+- org.elasticsearch.client:x-pack-transport:jar:6.2.4:compile
|  +- org.elasticsearch.plugin:x-pack-api:jar:6.2.4:compile
|  |  +- com.unboundid:unboundid-ldapsdk:jar:3.2.0:compile
|  |  +- org.bouncycastle:bcprov-jdk15on:jar:1.58:compile
|  |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.58:compile

Since 6.3 the x-pack-api POM no longer exists, and x-pack-transport simply depends on x-pack-core which does not include any 3rd party dependencies.
As far as I can tell from grepping, none of our generated POM files include a dependency for the ldapsdk (nor, I assume, bouncy castle).

This means that the published dependency in our docs is insufficient

 <dependencies>
      <!-- add the x-pack jar as a dependency -->
      <dependency>
         <groupId>org.elasticsearch.client</groupId>
         <artifactId>x-pack-transport</artifactId>
              <version>{version}</version>
      </dependency>
      ...
   </dependencies>

There is a qa test for transport client with ML, but because it uses gradle with local project dependencies, it pulls in the transitive dependency list from x-pack-core including the LDAP sdk, etc

+--- project :x-pack:plugin:core
|    [ snip ]
|    +--- com.unboundid:unboundid-ldapsdk:3.2.0
|    +--- org.bouncycastle:bcprov-jdk15on:1.58
|    +--- org.bouncycastle:bcpkix-jdk15on:1.58
@tvernum tvernum added >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts labels Jul 11, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@rjernst rjernst self-assigned this Jul 12, 2018
@rjernst
Copy link
Member

rjernst commented Jul 18, 2018

I've finally figured out what's happening here, and I think the fix is straightforward, but I want to double check with others on my assumptions.

Previously we built a jar named "x-pack-api". There were a couple reasons for this, both to allow for a reduced set of classes in the future that xpack plugins would have access to, as well as to differentiate the pom file name for this jar from that which PluginBuildPlugin builds for the zip. It is the latter reason here that has caused the breakage, because x-pack-core is a "plugin", even though it is not really a plugin (it is a module, we just use the normal plugin build and the distribution build unzips the plugin zip).

I see 3 possible solutions:

  1. Remove pom generation from PluginBuildPlugin altogether (for the zip file at least). This is left over from replicating what we did in 1.x/2.x for plugins, in that the zip files were published to maven central. However, the plugin installer now downloads these from the elastic download service, and the pom is unused as far as I can tell. Note there is the "client jar" case, but we already name this differently, so the pom for that would not be affected.

  2. Build modules differently so they do not generate a pom. This would be a smaller step towards 1, but probably more work as it would mean carefully changing the pom generation configuration to not be added when the plugin is a module (we already have some hardcoded logic to determine that condition).

  3. Add back the "x-pack-api" jar. This was pretty hacky to do, and just added bloat and hard to read configuration in the gradle build file, so IMO it is a last resort.

@nik9000
Copy link
Member

nik9000 commented Jul 18, 2018

I like the idea of removing the pom from the plugins. As much as I like having the zips available in maven central that seems like the simplest change to be honest.

rjernst added a commit to rjernst/elasticsearch that referenced this issue Jul 18, 2018
In 1.x and 2.x, plugins were published to maven and the plugin
installer downloaded them from there. This was later changed to install
from the download service, and in 5.0 plugin zips were no longer
published to maven. However, the build still currently produces an
unused pom file. This is troublesome in the special case when the main
jar of a plugin needs to be published (and thus needs a pom file of
the same name).

closes elastic#31946
rjernst added a commit that referenced this issue Jul 19, 2018
In 1.x and 2.x, plugins were published to maven and the plugin
installer downloaded them from there. This was later changed to install
from the download service, and in 5.0 plugin zips were no longer
published to maven. However, the build still currently produces an
unused pom file. This is troublesome in the special case when the main
jar of a plugin needs to be published (and thus needs a pom file of
the same name).

closes #31946
rjernst added a commit that referenced this issue Jul 19, 2018
In 1.x and 2.x, plugins were published to maven and the plugin
installer downloaded them from there. This was later changed to install
from the download service, and in 5.0 plugin zips were no longer
published to maven. However, the build still currently produces an
unused pom file. This is troublesome in the special case when the main
jar of a plugin needs to be published (and thus needs a pom file of
the same name).

closes #31946
rjernst added a commit that referenced this issue Jul 19, 2018
In 1.x and 2.x, plugins were published to maven and the plugin
installer downloaded them from there. This was later changed to install
from the download service, and in 5.0 plugin zips were no longer
published to maven. However, the build still currently produces an
unused pom file. This is troublesome in the special case when the main
jar of a plugin needs to be published (and thus needs a pom file of
the same name).

closes #31946
@silvia19941025
Copy link

How about Maven project? Does anyone know what to do using x-pack-transport 6.3.0 client in a maven project????
sorry about my poor expression , but here is the only place I found the same problem I have

@ZQbd
Copy link

ZQbd commented Mar 4, 2019

@rjernst

  1. Add back the "x-pack-api" jar. This was pretty hacky to do, and just added bloat and hard to read configuration in the gradle build file, so IMO it is a last resort.

I used maven,how to Add back the "x-pack-api" jar。 Please talk in detail。

@tvernum
Copy link
Contributor Author

tvernum commented Mar 5, 2019

@ZQbd This is an issue for tracking how we fixed the problem in an updated release, it is not intended to explain how to set up your own builds.
If you need assistance, please ask on our forums.

@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
@hlqian42
Copy link

hlqian42 commented May 5, 2022

i fix this problem with change version,here is my right pom

<dependency>
			<groupId>org.elasticsearch</groupId>
			<artifactId>elasticsearch</artifactId>
			<version>${elasticsearch.version}</version>
		</dependency>
		<dependency>
			<groupId>org.elasticsearch.client</groupId>
			<artifactId>transport</artifactId>
			<version>${elasticsearch.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.elasticsearch</groupId>
					<artifactId>elasticsearch</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.elasticsearch.client</groupId>
			<artifactId>x-pack-transport</artifactId>
			<version>${elasticsearch.version}</version>
			<exclusions>
				<exclusion>
					<artifactId>transport-netty4-client</artifactId>
					<groupId>org.elasticsearch.plugin</groupId>
				</exclusion>
			</exclusions>
		</dependency>

<elasticsearch.version>6.3.2</elasticsearch.version>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team v6.3.2 v6.4.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants