-
Notifications
You must be signed in to change notification settings - Fork 91
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
Multi-module liberty dev mode fails when there exists a test-jar dependency #1561
Comments
I'll also note that the documented
However, using the "reactor" syntax (prefixing the module name with a I opened https://github.com/OpenLiberty/ci.maven/pull/1562/files to update the docs accordingly, but let me know if you'd like me to open a separate issue for that.
|
Thanks @lmsurpre, I am able to reproduce this issue. Looks as though dev mode is unable to resolve the module1 dependency in this case because of the tests classifier: <dependency>
<groupId>io.openliberty.guides</groupId>
<artifactId>module1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency> In dev mode we should support classifiers when resolving dependencies for multi module projects.
The documentation for the More details on |
I just encountered this problem as well today. To me it seems related to 'maven-dependency-plugin:purge-local-repository' being called during execution of 'liberty-maven-plugin:dev' and I am wondering why this is being done. Does anyone have a pointer for me ? |
Hi @maroschutte, hot deployment through dev mode is made possible because the application is installed as a loose application. A loose application loads the associated files directly from the workspace rather than being exported. Dev mode calls Unfortunately we do not yet have a workaround for this sort of project configuration. More on loose applications in Liberty here: https://www.ibm.com/docs/en/was-liberty/base?topic=liberty-loose-applications |
It really worries me that liberty-maven-plugin clears artifacts from the local repository. At the very least it is really confusing to have artifacts that you put there using a 'mvn install' just disappear, but it could actually mean that existing setups that rely on artifacts being present in the localrepo break once you run dev mode. The test jars are a good example of this. |
That's a good question @maroschutte. I'm looking over the logic behind the change we made in #1201 and trying to understand better. If the purpose is just to surface a warning message to the user then messing with someone's local .m2 repo seems a bit disruptive. Will let you know what we find and create a new issue if necessary (since this one has already identified a primary issue with the use of the classifier). Thank you for bringing this up. |
I opened a new issue #1569 to consider an alternative to doing the purge since I have a prototype which may solve the problem in a better way. |
I saw #1569 is marked as completed now... are we expecting that to also address the issue presented here? |
@lmsurpre good question. The #1569/#1570 change will get past the error in the recreate use case you mentioned, where you did the So from that perspective, the problem will be fixed in the next release. You could also achieve something similar by doing: However, I wonder what your intention was in declaring the test dependency and I wonder if you are going to be happy with the dev mode behavior here. I can forsee a potential problem: if the idea was to provide failsafe configuration in module2 with a test packaged in module1 then I think this could be a gotcha, since I believe dev mode would likely run the module1 tests using the module1 pom config. Perhaps I'm getting ahead of myself though. In any case, when the next release is available, please let us know if you have other issues, either by an issue on this repo or on Gitter at: https://gitter.im/OpenLiberty/developer-experience. Thanks. |
I'd actually like to learn how to set up a test like that :-) |
We are planning for a release the third week of September as of right now. |
Continuing my comment: #1561 (comment) I was able to verify the original problem as reported is fixed in 3.7... though no rush to close if we want to wait for @lmsurpre to have a chance to try it out too. To follow-up some of the issues raised.... first, I think we can ignore my comment about trying to provide
The example in the original post here involved extending a base class in module1 with a subclass in module2 and configuring this in module2. That should work fine, and as there are other issues or concerns, let's worry about that when they arise. FOLLOW-UP ISSUEHowever, there's another problem, which is there should be a way to resolve the artifact used in the 'module1' dependency with just a: There are two ways to deal with this issue
The problem with doing the install first is that you end up "stuck" with the previously-built version of the dependency artifact. You miss out on one of the whole values of dev mode. The second one will work better, the problem is that it's simply not all that obvious that this is what you need to do. I looked to see if there was a simple fix and there doesn't seem to be. It might even require a bit of a hack to make this work and to get the artifacts to resolve correctly within dev mode. I believe some of the artifact resolution actually is designed to behave differently in the compile phases (which we don't participate in doing just I'm not sure it's worth opening a new issue just yet, though we could. It's probably enough of a corner case that we might not prioritize it for awhile. But hopefully this analysis has been useful to capture here at least. |
@scottkurz Hi Scott, we're starting up a new project and considering using OpenLiberty. My colleague is experiencing some pain related to your "FOLLOW-UP ISSUE" writeup above. Is that expected to still be an issue? Is there any plan to address it?
Agree? |
@lmsurpre Scott is on vacation for the next week. I will go ahead and open a separate issue for the "FOLLOW-UP ISSUE". Nothing has been done to resolve it yet, and it wasn't on our current radar of things to address in the near term. I will tag Scott in the new issue and have him follow up when he gets back. Thanks for reaching out. |
Thanks @cherylking now that we have that one open, I'll go ahead and close this one out. Feel free to reopen if you disagree. |
I have an existing multi-module web application and I want to use liberty dev mode with it.
One of the modules has some test utilities which are used in the tests of the other modules.
Maven supports that through the use of a build plugin configuration like this:
Then, in the modules that depend on it, we declare the dependency with a type of
test-jar
(or, equivalently, with a classifier oftests
)This builds fine with a command like
mvn clean install -f parent
. However, if one of those modules has our liberty config and we try usingmvn liberty:dev -f parent
then we end up with an error like the following:Attached is a minimal reproducer that adapts the OpenLiberty getting started example to demonstrate the issue.
multimodule-testjar-reproducer.zip
After unzipping, run the following to see the error:
The text was updated successfully, but these errors were encountered: