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 support for externally provided "lifecycle-mapping-metadata.xml" file #3393

Closed
testforstephen opened this issue Nov 20, 2023 · 4 comments · Fixed by #3440 or eclipse-jdtls/eclipse.jdt.ls#3005

Comments

@testforstephen
Copy link
Collaborator

Orginally created by @vitalyla on microsoft/vscode-maven#998

Suggestion

Add support for external provided file "lifecycle-mapping-metadata.xml" per M2E recommendations that allows configuration of lifecycle of Maven's plugins outside of any certain project and have it at system/user/workspace level.

Use Cases

While working on Maven projects it is common that not all plugins undergo changes related to their lifecycle configuration per M2E recommendations, which prohibits execution of those plugins by IDE and as a result required artifacts are not get generated (e.g., generated code) causing compilation and build problems.

Current way to overcome the problem is to manually add relevant m2e annotation (m2e execute onConfiguration) in each "pom.xml" file directly, which is very cumbersome, error prone and problematic approach when working on multiple projects. The impact is bigger when certain files cannot be submitted back to source control system that leads to keeping copies locally creating maintenance overhead.

@odrotbohm
Copy link

Can someone clarify the current behavior? Finding this ticket, I'm assuming that including build plugins in the IDE issued build would either not happen at all, or the build would trigger all build plugins, not matter what. Currently I am inclined to assume the latter as I have projects with the ByteBuddy plugin performing some (required) enhancements and they seem to actually be applied OOTB in VSCode? 🤔

@vitalyla
Copy link

vitalyla commented Jan 2, 2024

Hi @odrotbohm ,
No, it is actually the former. If plugin is not covered by the lifecycle it won't be executed. An example can be swagger/openapi maven plugins that are used to generate artifacts from API specification - without proper configuration of lifecycle these plugins won't be executed that leads to compilation failures of the projects(s) that depend on generated artifacts.

@odrotbohm
Copy link

That's weird, as I see my sample project still running fine after a full rebuild in VSCode, which, in case the Maven Plugin does not run, it definitely shouldn't.

@vitalyla
Copy link

It depends on the Maven Plugin and how build process is executed. Several core Maven plugins, such as compilation, execution, don't have an issue because they are known to be covered. The impact is more on 3rd party plugins such as OpenAPI Swagger code generation as well as on some Maven core's such as "maven dependency". Not all plugins adopted recommended way of configuration provided by M2e, therefore the problem exists.
Depending on how build process gets executed - if explicitly through the terminal then it will run, however those are not get executed by M2e plugin when loading the project into the workspace.
The problem is noticeable in multi-module project where one project generates artifacts such as OpenAPI artifacts and the other one depends on those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment