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

[MNG-8586] Expose Maven version segments as properties #2116

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Feb 17, 2025

@cstamas cstamas self-assigned this Feb 17, 2025
@slawekjaranowski
Copy link
Member

What do you think about to add to org.apache.maven.rtinfo.RuntimeInformation

@cstamas
Copy link
Member Author

cstamas commented Feb 17, 2025

IMO not needed, that one is used for "programmatic access" and there caller can do with version string whatever he wants. The main idea behind this PR is to be able to create profile in POM that is active in Maven4 only, and have it done in Maven3 compatible way (as Model 4.1.0 already have advanced expressions like inrange(${maven.version}, '[4,)'))

@cstamas
Copy link
Member Author

cstamas commented Feb 17, 2025

Example with this merged:

  • maven3: profile with property activation like <name>!maven.version.major</name> -- not even defined => this is Maven3 or older
  • maven4: profile with property action like <name>maven.verson.major</name> and <value>4</value>.

@cstamas
Copy link
Member Author

cstamas commented Feb 18, 2025

@gnodet @slawekjaranowski given maven.version.major "does the job" (for use case explained above) am tinkering to we want maybe to lower what we expose here? Is minor/patch/snap really needed? For example, snap may be useful (i can imagine some IT with it that changes something or not), but patch and minor?

@Bukama
Copy link

Bukama commented Feb 18, 2025

@gnodet @slawekjaranowski given maven.version.major "does the job" (for use case explained above) am tinkering to we want maybe to lower what we expose here? Is minor/patch/snap really needed? For example, snap may be useful (i can imagine some IT with it that changes something or not), but patch and minor?

I'm neither one of the two, but I would publish all three. Allows more flexibility, use cases we are not aware of yet and even more: Prevents confusion on the users side.

@slawekjaranowski
Copy link
Member

@gnodet @slawekjaranowski given maven.version.major "does the job" (for use case explained above) am tinkering to we want maybe to lower what we expose here? Is minor/patch/snap really needed? For example, snap may be useful (i can imagine some IT with it that changes something or not), but patch and minor?

can be all for consistency

@cstamas cstamas added this to the 4.0.0-rc-3 milestone Feb 19, 2025
if (versionElements.length != 3) {
throw new IllegalStateException("Maven version is expected to have 3 segments: '" + mavenVersion + "'");
}
systemProperties.setProperty("maven.version.major", versionElements[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Those need to be in Constants so that they are documented properly.

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.

4 participants