Interface ProjectInstaller


public interface ProjectInstaller
This defines the interface to install a single Maven Project.
Author:
Karl Heinz Marbaise khmarbaise@apache.org
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    install(org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest, ProjectInstallerRequest projectInstallerRequest)
    This will install a single project which may contain several artifacts.
  • Method Details

    • install

      void install(org.apache.maven.project.ProjectBuildingRequest projectBuildingRequest, ProjectInstallerRequest projectInstallerRequest) throws IOException, ArtifactInstallerException, NoFileAssignedException
      This will install a single project which may contain several artifacts. Those artifacts will be installed into the appropriate repository.
        @Parameter( defaultValue = "${session}", required = true, readonly = true )
        private MavenSession session;
        @Parameter( defaultValue = "${project}", required = true, readonly = true )
        private MavenProject project;
        ..
        @Component
        private ProjectInstaller installer;
        ...
        public void execute()
        {
          ProjectInstallerRequest pir =
            new ProjectInstallerRequest()
               .setProject( mavenProject );
       
          installer.install( session.getProjectBuildingRequest(), pir );
        }
       
      To set a different local repository than the current one in the Maven session, you can inject an instance of the RepositoryManager and set the path to the local repository, called localRepositoryPath, as such:
       @Component
       private RepositoryManager repositoryManager;
       
       buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath );
       
      Parameters:
      projectBuildingRequest - ProjectBuildingRequest
      projectInstallerRequest - ProjectInstallerRequest
      Throws:
      IOException - In case of problems related to checksums.
      ArtifactInstallerException - In case of problems to install artifacts.
      NoFileAssignedException - If no file has been assigned to the project.
      IllegalArgumentException - in case of parameter projectBuildingRequest is null or parameter projectInstallerRequest is null.