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

#166: consider all clean-lifecylce phases and add release-notes entry #172

Merged

Conversation

@HannesWell
Copy link
Contributor

@HannesWell HannesWell commented Jul 3, 2021

This PR adds an release-notes entry for issue #166 and extends the first solution for that issue by additionally considering the other two phases of the clean life-cycle.

What makes me wonder is that maven usually talks about phases when referring to the different 'steps' of a lifecycle.
But the session (and its request) only provides a List of goals. Are specified phases considered as goals in Maven?
The content of the goals list seems to be as expected when I attached a debugger and I did not find the word 'phase' in the MavenSession or MavenExecutionRequest class.

@laeubi
Copy link
Contributor

@laeubi laeubi commented Jul 3, 2021

Its confusing but maybe this helps a bit?
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#a-build-phase-is-made-up-of-plugin-goals

A plugin goal represents a specific task (finer than a build phase) which contributes to the building and managing of a project. It may be bound to zero or more build phases. A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.

Co-authored-by: Mickael Istria <mistria@redhat.com>
@HannesWell
Copy link
Contributor Author

@HannesWell HannesWell commented Jul 3, 2021

If this is fine, please squash and merge the commits. I think there is no value in keeping the changes as single commits.

@HannesWell
Copy link
Contributor Author

@HannesWell HannesWell commented Jul 3, 2021

If this is fine, you can squash in merge the commits. I think there is no value in keeping the changes as single commits.

Its confusing but maybe this helps a bit?
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#a-build-phase-is-made-up-of-plugin-goals

A plugin goal represents a specific task (finer than a build phase) which contributes to the building and managing of a project. It may be bound to zero or more build phases. A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.

Thanks for the link, but this only confirms my understanding of goals and phases.
For example clean, verify, package etc. are phases (of the two life-cycles clean and default), while e.g. maven-compiler-plugin:compile is a goal (by default bound to the lifecycle phase compile).
But when I call mvn clean verify the code MavenSession.getGoals() returns a List composed of "clean" and "verify".
From this I expect for a command like mvn clean maven-compiler-plugin:compile verify
that getGoals() returns ["clean", "maven-compiler-plugin:compile", "verify"].

But I actually expected something like MavenSession.getPhases(), that would return ["clean", "verify"] and getGoals() that returns ["maven-compiler-plugin:compile"].

From the example in your link I think the solution of this theoretical problem is likely that the order of goals and phases specified in a Maven command needs to be maintained, even if they are mixed. And this is only possible if you store them together in one list in the model. Therefore I assume that Maven treats phases specified in a command as goals too?

But this theoretical problem is actually not relevant for this PR and the code should work anyways.

@laeubi
Copy link
Contributor

@laeubi laeubi commented Jul 3, 2021

clean is a "life-cycle" see https://maven.apache.org/ref/3.8.1/maven-core/lifecycles.html

In the context of tycho, we define for a packaging-type a custom mapping of Life-cycle Phases depending on the packaging type.

@mickaelistria mickaelistria merged commit ce14ac0 into eclipse:master Jul 5, 2021
2 checks passed
@HannesWell HannesWell deleted the skipDependencyResolutionOnClean2 branch Jul 6, 2021
@laeubi laeubi added this to the 2.5 milestone Sep 21, 2021
@laeubi laeubi removed this from the 2.5 milestone Sep 21, 2021
@laeubi laeubi added this to the 2.4 milestone Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants