-
Notifications
You must be signed in to change notification settings - Fork 692
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
Split package problem when using java modules #1066
Comments
To address the split package issue you're encountering with
Given your project's Maven structure, it might be most straightforward to refactor the Additionally, there's an open issue related to Java module system support ([FEATURE] Support Java9+ module system) and a closed issue that dealt with a similar problem by moving If you need more detailed advice or further clarification, don't hesitate to ask.
|
In our project, we used the hints by Nicolai Parlog to have a workaround: + '--add-exports=langchain4j/dev.langchain4j.model.chat=org.jabref',
+ '--add-exports=langchain4j/dev.langchain4j.model.chat=org.jabref.merged.module',
...
+modularity.patchModule("langchain4j", "langchain4j-core-0.28.0.jar")
+modularity.patchModule("langchain4j", "langchain4j-embeddings-0.28.0.jar")
+modularity.patchModule("langchain4j", "langchain4j-embeddings-all-minilm-l6-v2-0.28.0.jar") |
Hi @hendrikebbers, thanks a lot for reporting! Since |
|
Oh :( |
I assume we have two problems here:
|
This is also a problem in osgi environment. The preferred way to wire bundles are import/export packages but this is not working with split packages. The solution is require bundle in the manifest, but it is tighter coupling. I think either langchain and langchain-core should be merged or the package names should be changed. As I see the most recent issues, there will be breaking changes in the near future, so maybe this is the time when it is possible to done. |
@langchain4j if you want / need help in that refactoring or just for review please ping me. Happy to help |
Hi @hendrikebbers, |
@konczdev could you please elaborate on breaking changes in the near future? We usually try to avoid breaking changes as much as possible. |
I think it's already confusing what the role of the langchain4j and langchain4j-core modules are. Whatever wil be the solution, each module should have its own package namespace and the api and implementation modules should not share the same package. |
@konczdev #1042 and #1044 are not supposed to be breaking changes. #1048 and #1049 are, but this functionality is not widely used AFAIK, so it is OKish. #1050 is not decided yet how to proceed. But I agree that there should be no split-packages. Let's see how to fix this problem with as less breaking changes as possible. |
@langchain4j For me those are breaking changes too because I have to wrap non-OSGi dependencies into OSGi bundles. Maybe after the resolution of this issue I will make some contribution to generate the proper OSGi manifests at compile time. |
@langchain4j Don't get me wrong, I didn't mean to criticize anything :) langchain4j is a wonderful project, I follow its development day by day. |
@konczdev all good, constructive criticism is always welcome! And you are providing very valuable feedback, so thank you! I will have a bit more time next week to look into this problem more closely, so we can continue this discussion then, ok? My only concern is to avoid introducing unnecessary breaking changes as much as possible, but of course some breaking changes will have to be done sooner or later, so let's do that sooner. I just need a bit more time to analyze it. |
Sounds reasonable! It is better to have a set of breaking changes in 1 release than to have new breaking changes in every release. |
## Issue Related to #1066 ## Change Move judge0 code execution engine package from `dev.langchain4j.code` to `dev.langchain4j.code.judge0` ## General checklist <!-- Please double-check the following points and mark them like this: [X] --> - [ ] There are no breaking changes - [ ] I have added unit and integration tests for my change - [ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green - [ ] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green <!-- Before adding documentation and example(s) (below), please wait until the PR is reviewed and approved. --> - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features) ## Checklist for adding new model integration <!-- Please double-check the following points and mark them like this: [X] --> - [ ] I have added my new module in the [BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml) ## Checklist for adding new embedding store integration <!-- Please double-check the following points and mark them like this: [X] --> - [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT` - [ ] I have added my new module in the [BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml) ## Checklist for changing existing embedding store integration <!-- Please double-check the following points and mark them like this: [X] --> - [ ] I have manually verified that the `{NameOfIntegration}EmbeddingStore` works correctly with the data persisted using the latest released version of LangChain4j
langchain4j can not be used in a Java project that is working on the module path. By doing so the following error happens:
error: the unnamed module reads package dev.langchain4j.retriever from both langchain4j and langchain4j.core
That is based on having the same package
dev.langchain4j.retriever
(with content) in both moduleslangchain4j
andlangchain4j.core
.A project like langchain4j should be 100% compatible with the Java module system since that is used by more and more libs over time.
I did a lot of work in that area and happy to help if you want to work on that topic.
The text was updated successfully, but these errors were encountered: