Package org.apache.maven.internal.impl
Class DefaultProjectManager
java.lang.Object
org.apache.maven.internal.impl.DefaultProjectManager
- All Implemented Interfaces:
Service
,ProjectManager
@Named
@Typed
@SessionScoped
public class DefaultProjectManager
extends Object
implements ProjectManager
-
Constructor Summary
ConstructorDescriptionDefaultProjectManager
(InternalMavenSession session, ArtifactManager artifactManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCompileSourceRoot
(Project project, ProjectScope scope, Path sourceRoot) Add a compilation source root to the given project for the given scope.void
addResource
(Project project, ProjectScope scope, Resource resource) Add a resource set to the given project for the given scope.void
attachArtifact
(Project project, ProducedArtifact artifact, Path path) Attaches a produced artifact to the project at the specified 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 scopevoid
setProperty
(Project project, String key, String value) Set a given project property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.api.services.ProjectManager
attachArtifact, attachArtifact
-
Constructor Details
-
DefaultProjectManager
-
-
Method Details
-
getPath
Description copied from interface:ProjectManager
Returns the path to the built project artifact file, if the project has been built.- Specified by:
getPath
in interfaceProjectManager
- Returns:
- the path of the built project artifact
-
getAttachedArtifacts
Description copied from interface:ProjectManager
Returns an immutable collection of attached artifacts for given project.- Specified by:
getAttachedArtifacts
in interfaceProjectManager
-
getAllArtifacts
Description copied from interface:ProjectManager
Returns 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()
andProjectManager.getAttachedArtifacts(Project)
methods.- Specified by:
getAllArtifacts
in interfaceProjectManager
- See Also:
-
attachArtifact
Description copied from interface:ProjectManager
Attaches a produced artifact to the project at the specified path. This is the base method that the other attachArtifact methods delegate to.- Specified by:
attachArtifact
in interfaceProjectManager
- Parameters:
project
- the project to attach the artifact toartifact
- the produced artifact to attachpath
- the path to the artifact file
-
getCompileSourceRoots
Description copied from interface:ProjectManager
Obtain an immutable list of compile source roots for the given project and scope. Paths are absolute.- Specified by:
getCompileSourceRoots
in interfaceProjectManager
- Parameters:
project
- the projectscope
- the scope, i.e. usually main or test- Returns:
- the list of compile source roots
-
addCompileSourceRoot
Description copied from interface:ProjectManager
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.- Specified by:
addCompileSourceRoot
in interfaceProjectManager
- Parameters:
project
- the projectscope
- the scope, i.e. usually main or testsourceRoot
- the new source root
-
getResources
Description copied from interface:ProjectManager
Get the list of resources for the given project and scope- Specified by:
getResources
in interfaceProjectManager
- Parameters:
project
- the projectscope
- the scope, i.e. usually main or test- Returns:
- the list of resources
-
addResource
public void addResource(@Nonnull Project project, @Nonnull ProjectScope scope, @Nonnull Resource resource) Description copied from interface:ProjectManager
Add a resource set to the given project for the given scope.- Specified by:
addResource
in interfaceProjectManager
- Parameters:
project
- the projectscope
- the scope, i.e. usually main or testresource
- the resource set to add
-
getRemoteProjectRepositories
Description copied from interface:ProjectManager
Returns an immutable list of project remote repositories (directly specified or inherited).- Specified by:
getRemoteProjectRepositories
in interfaceProjectManager
- Parameters:
project
- the project
-
getRemotePluginRepositories
Description copied from interface:ProjectManager
Returns an immutable list of project remote plugin repositories (directly specified or inherited).- Specified by:
getRemotePluginRepositories
in interfaceProjectManager
- Parameters:
project
- the project
-
setProperty
Description copied from interface:ProjectManager
Set a given project property.- Specified by:
setProperty
in interfaceProjectManager
- Parameters:
project
- the project to modifykey
- they property's keyvalue
- the value ornull
to unset the property
-
getProperties
Description copied from interface:ProjectManager
Returns an immutable map of the project properties.- Specified by:
getProperties
in interfaceProjectManager
- See Also:
-
getExecutionProject
- Specified by:
getExecutionProject
in interfaceProjectManager
-