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
ConstructorsConstructorDescriptionDefaultProjectManager(InternalMavenSession session, ArtifactManager artifactManager) -
Method Summary
Modifier 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, 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 scopevoidsetProperty(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, waitMethods inherited from interface org.apache.maven.api.services.ProjectManager
attachArtifact, attachArtifact
-
Constructor Details
-
DefaultProjectManager
-
-
Method Details
-
getPath
Description copied from interface:ProjectManagerReturns the path to the built project artifact file, if the project has been built.- Specified by:
getPathin interfaceProjectManager- Returns:
- the path of the built project artifact
-
getAttachedArtifacts
Description copied from interface:ProjectManagerReturns an immutable collection of attached artifacts for given project.- Specified by:
getAttachedArtifactsin interfaceProjectManager
-
getAllArtifacts
Description copied from interface:ProjectManagerReturns 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:
getAllArtifactsin interfaceProjectManager- See Also:
-
attachArtifact
Description copied from interface:ProjectManagerAttaches a produced artifact to the project at the specified path. This is the base method that the other attachArtifact methods delegate to.- Specified by:
attachArtifactin 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:ProjectManagerObtain an immutable list of compile source roots for the given project and scope. Paths are absolute.- Specified by:
getCompileSourceRootsin 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:ProjectManagerAdd 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:
addCompileSourceRootin interfaceProjectManager- Parameters:
project- the projectscope- the scope, i.e. usually main or testsourceRoot- the new source root
-
getResources
Description copied from interface:ProjectManagerGet the list of resources for the given project and scope- Specified by:
getResourcesin 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:ProjectManagerAdd a resource set to the given project for the given scope.- Specified by:
addResourcein interfaceProjectManager- Parameters:
project- the projectscope- the scope, i.e. usually main or testresource- the resource set to add
-
getRemoteProjectRepositories
Description copied from interface:ProjectManagerReturns an immutable list of project remote repositories (directly specified or inherited).- Specified by:
getRemoteProjectRepositoriesin interfaceProjectManager- Parameters:
project- the project
-
getRemotePluginRepositories
Description copied from interface:ProjectManagerReturns an immutable list of project remote plugin repositories (directly specified or inherited).- Specified by:
getRemotePluginRepositoriesin interfaceProjectManager- Parameters:
project- the project
-
setProperty
Description copied from interface:ProjectManagerSet a given project property.- Specified by:
setPropertyin interfaceProjectManager- Parameters:
project- the project to modifykey- they property's keyvalue- the value ornullto unset the property
-
getProperties
Description copied from interface:ProjectManagerReturns an immutable map of the project properties.- Specified by:
getPropertiesin interfaceProjectManager- See Also:
-
getExecutionProject
- Specified by:
getExecutionProjectin interfaceProjectManager
-