@Component(role=ProjectInstaller.class) class DefaultProjectInstaller extends java.lang.Object implements ProjectInstaller
Modifier and Type | Field and Description |
---|---|
private ArtifactInstaller |
installer |
private static org.slf4j.Logger |
LOGGER |
private RepositoryManager |
repositoryManager |
Constructor and Description |
---|
DefaultProjectInstaller() |
Modifier and Type | Method and Description |
---|---|
private void |
addMetaDataFilesForArtifact(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.Artifact artifact,
java.util.Collection<java.io.File> targetMetadataFiles) |
private java.io.File |
getLocalRepoFile(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.metadata.ArtifactMetadata metadata)
Gets the path of the specified artifact metadata within the local repository.
|
void |
install(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
ProjectInstallerRequest installerRequest)
This will install a single project which may contain several artifacts.
|
private void |
validateParameters(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
ProjectInstallerRequest installerRequest) |
private static final org.slf4j.Logger LOGGER
@Requirement private ArtifactInstaller installer
@Requirement private RepositoryManager repositoryManager
public void install(org.apache.maven.project.ProjectBuildingRequest buildingRequest, ProjectInstallerRequest installerRequest) throws java.io.IOException, ArtifactInstallerException, NoFileAssignedException, java.lang.IllegalArgumentException
@Parameter( defaultValue = "${session}", required=true, readonly = true) private MavenSession session; @Parameter( defaultValue = "${project}", required=true, readonly = true) private MavenProject project; .. @Component private ProjectInstaller installer; 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 );
install
in interface ProjectInstaller
buildingRequest
- ProjectBuildingRequest
installerRequest
- ProjectInstallerRequest
java.io.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.java.lang.IllegalArgumentException
- in case of parameter projectBuildingRequest
is null
or
parameter projectInstallerRequest
is null
.private void validateParameters(org.apache.maven.project.ProjectBuildingRequest buildingRequest, ProjectInstallerRequest installerRequest)
private void addMetaDataFilesForArtifact(org.apache.maven.project.ProjectBuildingRequest buildingRequest, org.apache.maven.artifact.Artifact artifact, java.util.Collection<java.io.File> targetMetadataFiles)
private java.io.File getLocalRepoFile(org.apache.maven.project.ProjectBuildingRequest buildingRequest, org.apache.maven.artifact.metadata.ArtifactMetadata metadata)
buildingRequest
- The project building request, must not be null
.metadata
- The artifact metadata whose local repo path should be determined, must not be null
.null
.