-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[MNG-8052] New Lifecycle API #1411
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/After.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.maven.api.plugin.annotations; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Inherited; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| import org.apache.maven.api.annotations.Experimental; | ||
|
|
||
| /** | ||
| * Specifies that the mojo should be run after the specific phase. | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
| @Experimental | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target(ElementType.TYPE) | ||
| @Inherited | ||
| public @interface After { | ||
|
|
||
| /** | ||
| * Type of pointer. | ||
| * @see org.apache.maven.api.Lifecycle.Pointer.Type | ||
| */ | ||
| enum Type { | ||
| PROJECT, | ||
| DEPENDENCIES, | ||
| CHILDREN | ||
| } | ||
|
|
||
| /** | ||
| * The phase name. | ||
| */ | ||
| String phase(); | ||
|
|
||
| /** | ||
| * The type of this pointer. | ||
| */ | ||
| Type type(); | ||
|
|
||
| /** | ||
| * The scope for dependencies, only if {@code type() == Type.Dependencies}. | ||
| */ | ||
| String scope() default ""; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really used anymore in this PR, so I'll remove those new concepts and I'll defer their addition to #1429.
For the record, it's used for the new lifecycle definition supporting dynamic phases and a fully concurrent build, see https://github.com/apache/maven/pull/1429/files#diff-dbccda410d9433bca88c9821a2ebd7ecb3b759738a2599a85748766c34658547R224-R252
In this PR, the phases are more fine-grained with inter-phases dependencies and more fine-grained inter-project dependencies. The lifecycle is not a simple list anymore, but looks more like a tree.
So
readyrepresents the state of a project which is ready to be used as a dependency. This usually means that resources have been processed and classes compiled. The main point is that thecompilephase should not have to be executed after theresourcesphase, as they both execute on different input and output and can be executed in parallel. Socompilephase depends onsourcesphase, andreadydepends oncompileandresources, thenpackagedepends onready.The benefits (in addition to supporting dynamic phases with pre/post steps) is that we can have a
packagephase which does not depend on running tests, whileverifywould package and run unit/integration tests. This also cleanly solves problems coming from runningmvn compilewhere some post processing can be mapped to thatreadyphase. So the definition of the tree-lifecycle above is not well defined yet, especially, the problem is how to bring those new features and keep a good level of compatibility.I'd rather have a clean set of inter-phase and inter-project dependencies (for example,
installanddeploydo depend onpackage, but should not depend on running unit-tests and integration-tests).Anyway, this can be deferred and discussed in the context of #1429, so I'll trim the
Lifecycleinterface to what is currently in Maven 3 (keeping in mind it can be extended in the future).