Package org.apache.maven.api.services
Interface ProjectManager
- All Superinterfaces:
- Service
- All Known Implementing Classes:
- DefaultProjectManager
Interface to manage the project during its lifecycle.
- Since:
- 4.0.0
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCompileSourceRoot(Project project, ProjectScope scope, Path sourceRoot) Add a compilation source root to the given project for the given scope.voidaddResource(Project project, ProjectScope scope, Resource resource) Add a resource set to the given project for the given scope.voidattachArtifact(Project project, Artifact artifact, Path path) default voidattachArtifact(Session session, Project project, String type, Path path) default voidattachArtifact(Session session, Project project, Path path) getAllArtifacts(Project project) Returns project's all artifacts as immutable collection.getAttachedArtifacts(Project project) Returns an immutable collection of attached artifacts for given project.getCompileSourceRoots(Project project, ProjectScope scope) Obtain an immutable list of compile source roots for the given project and scope.getExecutionProject(Project project) Returns the path to the built project artifact file, if the project has been built.getProperties(Project project) Returns an immutable map of the project properties.getRemotePluginRepositories(Project project) Returns an immutable list of project remote plugin repositories (directly specified or inherited).getRemoteProjectRepositories(Project project) Returns an immutable list of project remote repositories (directly specified or inherited).getResources(Project project, ProjectScope scope) Get the list of resources for the given project and scopevoidsetProperty(Project project, String key, String value) Set a given project property.
- 
Method Details- 
getPathReturns the path to the built project artifact file, if the project has been built.- Returns:
- the path of the built project artifact
 
- 
getAttachedArtifactsReturns an immutable collection of attached artifacts for given project.
- 
getAllArtifactsReturns project's all artifacts as immutable collection. The list contains all artifacts, even the attached ones, if any. Hence, the list returned by this method depends on which lifecycle step of the build was it invoked. The head of returned list is result ofProject.getArtifacts()method, so same applies here: the list can have minimum of one element. The maximum number of elements is in turn dependent on build configuration and lifecycle phase when this method was invoked (i.e. is javadoc jar built and attached, is sources jar built attached, are all the artifact signed, etc.).This method is shorthand for Project.getArtifacts()andgetAttachedArtifacts(Project)methods.- See Also:
 
- 
attachArtifact
- 
attachArtifact
- 
attachArtifact
- 
getCompileSourceRootsObtain an immutable list of compile source roots for the given project and scope. Paths are absolute.- Parameters:
- project- the project
- scope- the scope, i.e. usually main or test
- Returns:
- the list of compile source roots
 
- 
addCompileSourceRootvoid addCompileSourceRoot(@Nonnull Project project, @Nonnull ProjectScope scope, @Nonnull Path sourceRoot) Add a compilation source root to the given project for the given scope. The path will be transformed into an absolute path and added to the list for the given scope, if not already present.- Parameters:
- project- the project
- scope- the scope, i.e. usually main or test
- sourceRoot- the new source root
 
- 
getResourcesGet the list of resources for the given project and scope- Parameters:
- project- the project
- scope- the scope, i.e. usually main or test
- Returns:
- the list of resources
 
- 
addResourceAdd a resource set to the given project for the given scope.- Parameters:
- project- the project
- scope- the scope, i.e. usually main or test
- resource- the resource set to add
 
- 
getRemoteProjectRepositoriesReturns an immutable list of project remote repositories (directly specified or inherited).- Parameters:
- project- the project
 
- 
getRemotePluginRepositoriesReturns an immutable list of project remote plugin repositories (directly specified or inherited).- Parameters:
- project- the project
 
- 
getPropertiesReturns an immutable map of the project properties.- See Also:
 
- 
setPropertySet a given project property.- Parameters:
- project- the project to modify
- key- they property's key
- value- the value or- nullto unset the property
 
- 
getExecutionProject
 
-