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

Add lifecycle mapping for maven-toolchains-plugin #1637 #1638

Conversation

G-Ork
Copy link
Contributor

@G-Ork G-Ork commented Jan 3, 2024

For #1637

@G-Ork G-Ork mentioned this pull request Jan 3, 2024
Copy link
Contributor

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, the general intend looks good, but the lifecycle mappings should not be added to the m2e.apt.core plugin (see the comments).

.gitignore Outdated Show resolved Hide resolved
org.eclipse.m2e.apt.core/lifecycle-mapping-metadata.xml Outdated Show resolved Hide resolved
org.eclipse.m2e.apt.core/lifecycle-mapping-metadata.xml Outdated Show resolved Hide resolved
@G-Ork G-Ork force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from cdfe098 to 94367bb Compare January 6, 2024 12:50
@HannesWell HannesWell force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from 94367bb to 6e52c6f Compare January 6, 2024 13:08
@G-Ork G-Ork force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from 6e52c6f to 81728e8 Compare January 6, 2024 13:20
@HannesWell HannesWell force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from 81728e8 to 84fa618 Compare January 6, 2024 13:28
Copy link
Contributor

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution.
Looks good now. Lets wait for the result of the CI.

Copy link

github-actions bot commented Jan 6, 2024

Test Results

107 files  ±0  107 suites  ±0   6m 44s ⏱️ -4s
662 tests ±0  652 ✅ ±0  10 💤 ±0  0 ❌ ±0 
662 runs  ±0  651 ✅ ±0  11 💤 ±0  0 ❌ ±0 

Results for commit 298b181. ± Comparison against base commit 98dbefe.

♻️ This comment has been updated with latest results.

@HannesWell
Copy link
Contributor

@G-Ork it looks like this causes new test-failures. Could you have a look at them?

@G-Ork
Copy link
Contributor Author

G-Ork commented Jan 8, 2024

I will. Seemed to be code thats generated somehow. Can not find the test classes mentioned.

@G-Ork G-Ork force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch 3 times, most recently from 5788ac0 to 3d9e308 Compare January 8, 2024 21:42
@HannesWell HannesWell force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from 3d9e308 to 141dd0d Compare January 8, 2024 21:56
@HannesWell
Copy link
Contributor

I will. Seemed to be code thats generated somehow. Can not find the test classes mentioned.

These tests live in another repository, i.e. https://github.com/tesla/m2e-core-tests/, which is included as sub-module of this repository. Unfortunately, for legal reasons we are not allowed to add these tests to this repository. :/

The contribution guide explains how to do that manually: https://github.com/eclipse-m2e/m2e-core/blob/master/CONTRIBUTING.md#%EF%B8%8F-setting-up-the-development-environment-manually
or you just use the provided Oomph setup.

Anyway, it looks you already found a hot candidate for being the cause of the failures. 🚀

@G-Ork
Copy link
Contributor Author

G-Ork commented Jan 8, 2024

Is the check Build M2Eclipse / build (macos-latest) (pull_request) related to m2e-core-tests or is this another problem? Looks like it was executed before my last fixes and not again afterwards.

@HannesWell
Copy link
Contributor

Is the check Build M2Eclipse / build (macos-latest) (pull_request) related to m2e-core-tests or is this another problem? Looks like it was executed before my last fixes and not again afterwards.

This is unrelated, to your change. All tests look good now. 👍🏽

Could you please just revert the version bumps in org.eclipse.m2e.core/META-INF/MANIFEST.MF and org.eclipse.m2e.core/pom.xml. This plugin's version has already been bumped since the last release so bumping it again should not be necessary.
Then this PR is ready for submission.

@G-Ork G-Ork force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from 141dd0d to 4d52fd0 Compare January 9, 2024 07:11
@G-Ork
Copy link
Contributor Author

G-Ork commented Jan 9, 2024

Thank you for the patience. I have removed the version bumps.
I've read it but did not check it 🤦‍♂️

@HannesWell HannesWell force-pushed the Add_lifecycle_mapping_for_maven-toolchains-plugin_#1637 branch from 4d52fd0 to 298b181 Compare January 9, 2024 08:57
Copy link
Contributor

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patience. I have removed the version bumps. I've read it but did not check it 🤦‍♂️

No problem, you are welcome.
Thanks again for this contribution.

@HannesWell HannesWell merged commit d889db1 into eclipse-m2e:master Jan 9, 2024
6 of 7 checks passed
@laeubi
Copy link
Member

laeubi commented Feb 7, 2024

@G-Ork now we have even UI for toolchans do you like to look into why ~/.m2/toolchains.xml is not found in the embedded context of m2e?

In maven CLI this happens with org.apache.maven.cli.MavenCli.toolchains(CliRequest) and is just a matter of org.apache.maven.execution.MavenExecutionRequest.setGlobalToolchainsFile(File) / org.apache.maven.execution.MavenExecutionRequest.setUserToolchainsFile(File) but m2e seems to not perform this currently in org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.createExecutionRequest(IMavenConfiguration, IComponentLookup, Settings) this would be much more appropriate than disable the execution of the mojo.

@HannesWell HannesWell added this to the 2.6.0 milestone Feb 17, 2024
@HannesWell
Copy link
Contributor

but m2e seems to not perform this currently in org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.createExecutionRequest(IMavenConfiguration, IComponentLookup, Settings) this would be much more appropriate than disable the execution of the mojo.

Actually this was implement as part of the PR that added the UI:
https://github.com/eclipse-m2e/m2e-core/pull/1643/files#diff-796a271293c65b5cac9c04a4dccddff344e43fd10f474a5cd2992c2333325704

and is now performed at

if(mavenConfiguration.getUserToolchainsFile() != null) {
userToolchainsFile = new File(mavenConfiguration.getUserToolchainsFile());
}
request.setUserToolchainsFile(userToolchainsFile);

So should we consider reverting this? @G-Ork what's your opinion about that?

@G-Ork
Copy link
Contributor Author

G-Ork commented Feb 17, 2024

Hi, i am currently preparing a PR with unit tests as asked for the change of the UI. The tests are finished and where necessary because the settings where not applied to the maven launcher. My fault. My Plan was to create the PR for the UI and the unit tests. The PR Should be ready today or at least this weekend.

After this i would dig into the open questions about the internal launch. This relate to the code you quoted. My opinion is that we should try to make it work. Or make it work somehow. I stumbled already over the code that configures different JVMs based on the enforcer plugin. That feature was added last year. I didn't test it yet but i guess i will help.

In my opinion this is quite hacky as the enforcer plugin is a assertion plugin and not for configuration. I was surprised as another developer mention that. Also found inside the hidden releasenotes. I would prefer a toolchain approach. I also run into this requirement this week by trying to migrate a project to java 21. Eclipse used the start JRE and i wasn't able to build with the internal build. Workaround was to use the Maven launcher and configure a 21 JDK.

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

Successfully merging this pull request may close these issues.

None yet

3 participants