-
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
Associate (possibly empty) build output dir (target/classes) with upstream projects rather than local m2 repository #1570
Associate (possibly empty) build output dir (target/classes) with upstream projects rather than local m2 repository #1570
Conversation
This approach simply tries to adjust for the fact that the CompilerMojo happens to not associate the "target/classes" dir with the dependency Artifact in the special case that there is no source to compile.... causing core Maven resolver function to resolve this Artifact against the local repo, (leading to the fix in #1207 we're now revisiting). Not sure of the downside in my approach. Presumably there may be some (or if not we might imagine proposing a change in CompilerMojo , though my guess is the community wouldn't think it worth the risk). But within the more narrow dev mode usage it seems like adding our own custom behavior could be worth it. I did try to understand why a multi-module TODO
|
@@ -1173,15 +1175,22 @@ protected void doExecute() throws Exception { | |||
if (isEar) { | |||
runMojo("org.apache.maven.plugins", "maven-ear-plugin", "generate-application-xml"); | |||
runMojo("org.apache.maven.plugins", "maven-resources-plugin", "resources"); | |||
|
|||
installEmptyEarIfNotFound(project); | |||
} else if (project.getPackaging().equals("pom")) { | |||
log.debug("Skipping compile/resources on module with pom packaging type"); | |||
} else { | |||
purgeLocalRepositoryArtifact(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still need to purge the local repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops... bad rebase... I fixed it. Let me test again though , when I get a chance, to make sure I didn't mess this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I could take this to the next step, which I forgot to mention and make sure the watcher compile fails as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By make sure the watcher compile fails as well, do you mean making sure the watcher compile has target/classes
in its artifacts list to resolve against?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. I updated the PR for this just now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for taking a quick look. Sorry for the formatting changes that I see snuck in here.
2ceb61f
to
e534881
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you @scottkurz (and thanks for fixing the formatting)
Should we disable this test for now - https://github.com/OpenLiberty/ci.maven/blob/main/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleM2InstalledTest.java (just add @Ignore
) and we can rework it in a follow up issue
Thanks for taking a look. We could just disable the test .... |
27b34b6
to
bf660a5
Compare
@kathrynkodama A note on the inability of the logs to capture the failing output. There's a problem with a pattern like: assertTrue(getLogTail(logFile), <condition> , timeout)); We're going to do the getLogTail() immediately, but there's no log yet.. the separate mvn liberty:dev process is just starting up. It looks like this has been addressed in JUnit 5 by adding a Supplier to defer message calculation. I at least added a failure TestWatcher..... which might help a bit locally (the test afterXXX cleans up the logs) but won't help in say the GHA environment. |
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
bf660a5
to
a73572a
Compare
4893028
to
b59866b
Compare
File outputDir = Paths.get(mavenProject.getBuild().getOutputDirectory()).toFile(); | ||
artifactToUpdate.setFile(outputDir); | ||
try { | ||
outputDir.createNewFile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any concern with creating an output directory for modules without any src/main/java
code, ie. for ear modules? I can't think of any downside to doing this and just having the empty directory...
fc94069
to
9bf566d
Compare
@kathrynkodama your comment jogged my memory that we were doing the install empty EAR thing. So I went back and made a similar change in that path, so we can programmatically conjure up a "workspace" (i.e. reactor) EAR artifact without having to install one. So we can kind of avoid touching the local .m2 repo altogether it would seem. I added a path to use 'target' rather than 'target/classes' in case that is a bit less weird. I left the purge/install code in, just in case we need to resort to it in the case that there are some file permission issues with creating directories. So this ends up fixing #1203 and providing an alternate solution to #1176 |
…ile because compilation wasn't done Signed-off-by: Scott Kurz <skurz@us.ibm.com>
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
9bf566d
to
a8870cf
Compare
…ile because compilation wasn't done
Signed-off-by: Scott Kurz skurz@us.ibm.com
Fixes #1569 (or at least starts the effort).