Interface ProjectManager

All Superinterfaces:
Service
All Known Implementing Classes:
DefaultProjectManager

@Experimental public interface ProjectManager extends Service
Interface to manage the project during its lifecycle.
Since:
4.0.0
  • Method Details

    • getPath

      @Nonnull Optional<Path> getPath(Project project)
      Returns the path to the built project artifact file, if the project has been built.
      Returns:
      the path of the built project artifact
    • getAttachedArtifacts

      @Nonnull Collection<Artifact> getAttachedArtifacts(Project project)
      Returns an immutable collection of attached artifacts for given project.
    • getAllArtifacts

      Collection<Artifact> getAllArtifacts(Project project)
      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 of Project.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() and getAttachedArtifacts(Project) methods.

      See Also:
    • attachArtifact

      default void attachArtifact(Session session, Project project, Path path)
    • attachArtifact

      default void attachArtifact(Session session, Project project, String type, Path path)
    • attachArtifact

      void attachArtifact(Project project, Artifact artifact, Path path)
    • getCompileSourceRoots

      @Nonnull List<Path> getCompileSourceRoots(@Nonnull Project project, @Nonnull ProjectScope scope)
      Obtain 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
    • addCompileSourceRoot

      void 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
    • getResources

      List<Resource> getResources(@Nonnull Project project, @Nonnull ProjectScope scope)
      Get 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
    • addResource

      void addResource(@Nonnull Project project, @Nonnull ProjectScope scope, @Nonnull Resource resource)
      Add 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
    • getRemoteProjectRepositories

      @Nonnull List<RemoteRepository> getRemoteProjectRepositories(@Nonnull Project project)
      Returns an immutable list of project remote repositories (directly specified or inherited).
      Parameters:
      project - the project
    • getRemotePluginRepositories

      @Nonnull List<RemoteRepository> getRemotePluginRepositories(@Nonnull Project project)
      Returns an immutable list of project remote plugin repositories (directly specified or inherited).
      Parameters:
      project - the project
    • getProperties

      @Nonnull Map<String,String> getProperties(@Nonnull Project project)
      Returns an immutable map of the project properties.
      See Also:
    • setProperty

      void setProperty(@Nonnull Project project, @Nonnull String key, @Nullable String value)
      Set a given project property.
      Parameters:
      project - the project to modify
      key - they property's key
      value - the value or null to unset the property
    • getExecutionProject

      @Nonnull Optional<Project> getExecutionProject(@Nonnull Project project)