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

Improve test jar dependency resolution for multi-module scenario #1721

Open
cherylking opened this issue Aug 25, 2023 · 1 comment
Open

Improve test jar dependency resolution for multi-module scenario #1721

cherylking opened this issue Aug 25, 2023 · 1 comment
Labels

Comments

@cherylking
Copy link
Member

Taken from issue #1561 as a follow-up remaining issue - @scottkurz @lmsurpre

There should be a way to resolve the test artifact used in one module dependency but contained in another module with just a:
mvn liberty:dev -f parent.

There are two ways to deal with this issue:

  1. Do a mvn install of the dependency first before running dev mode

  2. Do a mvn test-compile liberty:dev -f parent

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.
It would be a nice story too from the perspective that it generally shouldn't be necessary to do a mvn install before a multi-module build.

Scott 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. Scott believes some of the artifact resolution actually is designed to behave differently in the compile phases (which we don't participate in doing just mvn liberty:dev).

@scottkurz
Copy link
Member

Has the dev mode design ever considered using the @Execute annotation to execute earlier goals/phases?

I tried quick and noticed that if we were to add something like this

import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;

@Execute(phase = LifecyclePhase.PROCESS_TEST_CLASSES)
public class DevMojo extends LooseAppSupport {

the problem seems to go away.

Now, before I feel too good about this, let me note that the doc here suggests this annotation should be used to set up and it says:

parallel build .....that isn’t going to affect the current build.

Whereas I'm suggesting that we could use it precisely because it WOULD AFFECT the current build, by forcing the artifact resolution.

Perhaps something to look into. It seems like this could turn out to be a big change to dev mode..or perhaps it really wouldn't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants