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

Doesn't support properties defined in .mvn/maven.config #549

Closed
segevfiner opened this issue Feb 13, 2024 · 8 comments · Fixed by #552
Closed

Doesn't support properties defined in .mvn/maven.config #549

segevfiner opened this issue Feb 13, 2024 · 8 comments · Fixed by #552

Comments

@segevfiner
Copy link

To create a new structured build/pomless Tycho build for an Eclipse plugin, I have been instructed to look at https://tycho.eclipseprojects.io/doc/4.0.5/StructuredBuild.html, but it seems .mvn/maven.config that I'm instructed to create for this is not being picked up by this plugin and as such I get:

'build.plugins.plugin.version' for org.eclipse.tycho:target-platform-configuration must be a valid version but is '${tycho-version}'.

When opening the pom.xml in Eclipse.

See also eclipse-tycho/tycho#3481 (comment)

@laeubi
Copy link
Member

laeubi commented Feb 14, 2024

I also noticed this today, this is quite annoying, any hints where properties are evaluated so one can probably suggest a fix?

@mickaelistria
Copy link
Contributor

Best is to have a look at Maven code and look for how maven.config file is loaded in the session.

@laeubi
Copy link
Member

laeubi commented Feb 14, 2024

Best is to have a look at Maven code and look for how maven.config file is loaded in the session.

Well this happens as part of MavenCLI, m2e already supports it I just don't know how this could / should be applied to lemminx, e.g you can look at

https://github.com/eclipse-m2e/m2e-core/blob/6f195b7171868d6c5d77a16c1aa7c34bdfbb55c7/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenProperties.java#L278-L288

it extracts the data from the maven config given the Multi Module Directory is known like here:

https://github.com/eclipse-m2e/m2e-core/blob/6f195b7171868d6c5d77a16c1aa7c34bdfbb55c7/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenProperties.java#L222-L236

it would be great if this could be fixed because currently users blame this on m2e even though it actually supports this and it is a language server error...

@mickaelistria
Copy link
Contributor

Just to not set false expectation: neither Victor nor I are very active on this project at the moment, so it's not likely we try to fix it soon. But as usual, we try to make reviews of incoming PRs highest priority ;)

@laeubi
Copy link
Member

laeubi commented Feb 14, 2024

Wel my problem is that I'm not very familiar with the codebase, but you knwo m2e as well, so maybe you can point me to where something similar like the MavenExecutionRequest building happens in lemminx I probably can give it a try :-D

@HannesWell
Copy link
Member

I also looked a bit into this a while ago and I assumed one could start in m2e's InitializationOptionsProvider to feed the language server with the corresponding properties.
Of course changes and different roots have to be considered. But I'm not sure this is really the right place or if something is missing.

@laeubi
Copy link
Member

laeubi commented Feb 16, 2024

This one seems only called once and on config change but not for pom files I open with the editor, as each pom.xml can have different settings this seems not the right location to hook into.

laeubi added a commit to laeubi/lemminx-maven that referenced this issue Feb 16, 2024
Currently lemminx does not consider properties that are defined in the
.mvn/maven.config and therefore gives errors or otherwhise wrong results
when parsing a project.

This adds support for detecting and reading these properties from the
.mvn/maven.config

Fix eclipse#549

Signed-off-by: Christoph Läubrich <[email protected]>
@laeubi
Copy link
Member

laeubi commented Feb 16, 2024

@mickaelistria I started a very basic implementation here:

I have not tested this yet but found already some uncertainties, I added TODO in the code so maybe a lemminx contributor can help here.

laeubi added a commit to laeubi/lemminx-maven that referenced this issue Feb 16, 2024
Currently lemminx does not consider properties that are defined in the
.mvn/maven.config and therefore gives errors or otherwhise wrong results
when parsing a project.

This adds support for detecting and reading these properties from the
.mvn/maven.config

Fix eclipse#549

Signed-off-by: Christoph Läubrich <[email protected]>
mickaelistria pushed a commit that referenced this issue Feb 16, 2024
Currently lemminx does not consider properties that are defined in the
.mvn/maven.config and therefore gives errors or otherwhise wrong results
when parsing a project.

This adds support for detecting and reading these properties from the
.mvn/maven.config

Fix #549

Signed-off-by: Christoph Läubrich <[email protected]>
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 a pull request may close this issue.

4 participants