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

Remove --allow-incomplete-classpath from native-image.properties #397

Closed
ppalaga opened this issue Jun 18, 2021 · 7 comments
Closed

Remove --allow-incomplete-classpath from native-image.properties #397

ppalaga opened this issue Jun 18, 2021 · 7 comments
Assignees
Milestone

Comments

@ppalaga
Copy link

ppalaga commented Jun 18, 2021

--allow-incomplete-classpath is suitable for debugging but nor for running production code. Its presence in arangodb-java-driver enables it for all projects depending on it. The maintainers of those projects thus may get mislead into believing that their code is correct (because otherwise the native compilation would have failed) but in reality the code is broken and may fail in production.

@rashtao
Copy link
Contributor

rashtao commented Jun 29, 2021

This parameter has been added to avoid compilation failure when optional maven dependencies (httpclient and jackson-dataformat-velocypack) are not present. I think the impact of this flag on projects depending on it will be mitigated by oracle/graal#3491 (comment)

@ppalaga how would you suggest to fix it for the moment? I would like to avoid including all the optional dependencies...

@ppalaga
Copy link
Author

ppalaga commented Jun 29, 2021

I do not know all the necessary details about arangodb-java-driver, but from what you say it sounds like moving the code requiring those deps to new artifacts (maven modules) could be a solution? In the core arangodb-java-driver you could perhaps define SPIs that would be implemented in those new ancillary modules (call them arangodb-java-driver-http and arangodb-java-driver-jackson-dataformat-velocypack). arangodb-java-driver-http and arangodb-java-driver-jackson-dataformat-velocypack would non-optionally depend on httpclient and jackson-dataformat-velocypack respectivelly. arangodb-java-driver would not have to depend on any of the ancillary modules.
End users would have to depend on arangodb-java-driver-http and arangodb-java-driver-jackson-dataformat-velocypack in their apps instead of httpclient and jackson-dataformat-velocypack.

Depending on how much your API is soaked by httpclient and jackson-dataformat-velocypack, this might or might not be a backwards compatible change.

Does this proposal make any sense?

@rashtao
Copy link
Contributor

rashtao commented Jun 30, 2021

I agree, thanks for sharing @ppalaga .
We could implement SPIs for CommunicationProtocol and ConnectionFactory, and this would remove the need for optional maven dependencies and related native-image errors.
Nonetheless this would result in breaking API changes, so we will implement this change in the next major release.

@ppalaga
Copy link
Author

ppalaga commented Jun 30, 2021

We will implement this change in the next major release.

Thanks a lot, that sounds like a good plan to me!

@rashtao
Copy link
Contributor

rashtao commented Jan 20, 2023

@rashtao rashtao added this to the 7.0 milestone Mar 21, 2023
@rashtao
Copy link
Contributor

rashtao commented Mar 21, 2023

Since version 7.0.0 the driver can compile to native image with --link-at-build-time. Modules are discovered via SPI. Note that when using http-protocol additional substitutions might be needed, due to incomplete classpath in Netty transitive dependency, see https://github.com/arangodb/arangodb-java-driver/blob/v7/docs/v7_detailed_changes.md#graalvm-native-image

https://github.com/arangodb/arangodb-java-driver/releases/tag/v7.0.0-RC.4

@rashtao
Copy link
Contributor

rashtao commented Apr 20, 2023

Closing as fixed in version 7.0.0.
Related documentation can be found at (PR): https://github.com/arangodb/docs/blob/113c2351a0153171adfc74c313454af6bb5c7f08/drivers/java.md?plain=1#L62-L68

Please reopen in case of further problems or questions.

@rashtao rashtao closed this as completed Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants