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-8588] Add activated profiles to Project interface #2119

Conversation

Giovds
Copy link
Contributor

@Giovds Giovds commented Feb 21, 2025

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a MNG-8588 filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] SUMMARY,
    where you replace MNG-XXX and SUMMARY with the appropriate JIRA issue.
  • Also format the first line of the commit message like [MNG-XXX] SUMMARY.
    Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@Giovds
Copy link
Contributor Author

Giovds commented Feb 21, 2025

I'm trying to move the maven-help-plugin forward into a 4.0.0 release. It currently (3.x) uses a method to get the activated profiles from the project. This method is not yet available on the new interface. I think it is necessary to introduce this method in order to properly get the activated profiles from the build without needing to rebuild the project again.

I've decided to keep the interface the same for now, but I can imagine that we would want a better representation such as a new class or making use of the Profile class.

@Giovds Giovds changed the title Add activated profiles to Project interface [MNG-8588] Add activated profiles to Project interface Feb 21, 2025
@Giovds Giovds force-pushed the add-activated-profiles-to-project-interface branch from bd1072e to 5d9eb9c Compare February 21, 2025 14:18
@cstamas cstamas requested a review from gnodet February 21, 2025 14:46
@gnodet
Copy link
Contributor

gnodet commented Feb 21, 2025

@Giovds I see the tests are using getActiveProfiles() instead of getInjectedProfileIds().
Is that because you wanted to use that method instead ?
Is that why you were saying that Profiles do not report their source correctly ? What happens exactly ?

@Giovds
Copy link
Contributor Author

Giovds commented Feb 21, 2025

@gnodet I think it is time for weekend for me. I was adding missing tests to the getActiveProfiles() and ended up forgetting to add the tests for the getInjectedProfileIds() 🙈. I'll add those in the next commit.


Thinking out loud / alternative:

While testing though, it might be better to replace the getInjectedProfileIds() with getActiveProfiles() in the DefaultProject and utilise the Locations. We could reference the actual file used for the external profiles instead of hardcoding "external". We could also reference the line number of the active profile as well.

image

maven-help-plugin 3.5.1
image

Instead of - staged-releases (source: external)

we could do something like - staged-releases (source: settings.xml) and fall back to "external" if not present.

and - run-its (source: org.apache.maven.plugins:maven-help-plugin:maven-plugin:4.0.0-SNAPSHOT line 224) if "pom".

I'd have to do some more testing to see if this would work.

@gnodet
Copy link
Contributor

gnodet commented Feb 25, 2025

@gnodet I think it is time for weekend for me. I was adding missing tests to the getActiveProfiles() and ended up forgetting to add the tests for the getInjectedProfileIds() 🙈. I'll add those in the next commit.

Thinking out loud / alternative:

While testing though, it might be better to replace the getInjectedProfileIds() with getActiveProfiles() in the DefaultProject and utilise the Locations. We could reference the actual file used for the external profiles instead of hardcoding "external". We could also reference the line number of the active profile as well.

image **maven-help-plugin 3.5.1** image

Instead of - staged-releases (source: external)

we could do something like - staged-releases (source: settings.xml) and fall back to "external" if not present.

and - run-its (source: org.apache.maven.plugins:maven-help-plugin:maven-plugin:4.0.0-SNAPSHOT line 224) if "pom".

I'd have to do some more testing to see if this would work.

If that works, that would be even better and allow a leaner API imho.

@gnodet
Copy link
Contributor

gnodet commented Feb 25, 2025

@gnodet I think it is time for weekend for me. I was adding missing tests to the getActiveProfiles() and ended up forgetting to add the tests for the getInjectedProfileIds() 🙈. I'll add those in the next commit.
Thinking out loud / alternative:
While testing though, it might be better to replace the getInjectedProfileIds() with getActiveProfiles() in the DefaultProject and utilise the Locations. We could reference the actual file used for the external profiles instead of hardcoding "external". We could also reference the line number of the active profile as well.
image
maven-help-plugin 3.5.1 image
Instead of - staged-releases (source: external)
we could do something like - staged-releases (source: settings.xml) and fall back to "external" if not present.
and - run-its (source: org.apache.maven.plugins:maven-help-plugin:maven-plugin:4.0.0-SNAPSHOT line 224) if "pom".
I'd have to do some more testing to see if this would work.

If that works, that would be even better and allow a leaner API imho.

We should definitely try it instead. Adding getActiveProfiles() to Project should be sufficient to cover both mojos usage I think.

@gnodet
Copy link
Contributor

gnodet commented Feb 25, 2025

Btw, are you working on top of apache/maven-help-plugin#121 or did you start from scratch ?

@Giovds
Copy link
Contributor Author

Giovds commented Feb 25, 2025

@gnodet

Btw, are you working on top of apache/maven-help-plugin#121 or did you start from scratch ?

Yes, I took the mvn4 branch as baseline. Did have to do some changes after bumping to beta-5, and I’m not sure if it is going to be comparable with the rc releases.

We should definitely try it instead. Adding getActiveProfiles() to Project should be sufficient to cover both mojos usage I think.

I believe so too!

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.

2 participants