@Component(role=ProjectInstaller.class) public class DefaultProjectInstaller extends java.lang.Object implements ProjectInstaller
| Modifier and Type | Field and Description |
|---|---|
private DualDigester |
digester |
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,
boolean createChecksum) |
private java.io.File |
getLocalRepoFile(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.Artifact artifact)
Gets the path of the specified artifact within the local repository.
|
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 request)
This will install a single project which may contain several artifacts.
|
private void |
installChecksum(java.io.File installedFile,
java.lang.String ext,
java.lang.String checksum)
Installs a checksum for the specified file.
|
private void |
installChecksums(java.util.Collection<java.io.File> metadataFiles)
Installs the checksums for the specified metadata files.
|
private void |
installChecksums(java.io.File installedFile)
Installs the checksums for the specified file (if it exists).
|
private void |
installChecksums(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.Artifact artifact,
boolean createChecksum)
Installs the checksums for the specified artifact if this has been enabled in the plugin configuration.
|
private static final org.slf4j.Logger LOGGER
@Requirement private ArtifactInstaller installer
@Requirement private RepositoryManager repositoryManager
private final DualDigester digester
public void install(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
ProjectInstallerRequest request)
throws java.io.IOException,
ArtifactInstallerException,
NoFileAssignedException
@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 )
.setCreateChecksum( false )
.setUpdateReleaseInfo( false );
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 ProjectInstallerbuildingRequest - ProjectBuildingRequestrequest - ProjectInstallerRequestjava.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.private void installChecksums(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.Artifact artifact,
boolean createChecksum)
throws java.io.IOException
ProjectArtifactMetadata did not install
the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the
installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.buildingRequest - The project building request, must not be null.artifact - The artifact for which to create checksums, must not be null.createChecksum - true if checksum should be created, otherwise false.java.io.IOException - If the checksums could not be installed.private void addMetaDataFilesForArtifact(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.Artifact artifact,
java.util.Collection<java.io.File> targetMetadataFiles,
boolean createChecksum)
private void installChecksums(java.util.Collection<java.io.File> metadataFiles)
throws java.io.IOException
metadataFiles - The collection of metadata files to install checksums for, must not be null.java.io.IOException - If the checksums could not be installed.private void installChecksums(java.io.File installedFile)
throws java.io.IOException
installedFile - The path to the already installed file in the local repo for which to generate checksums,
must not be null.java.io.IOException - In case of errors. Could not install checksums.private void installChecksum(java.io.File installedFile,
java.lang.String ext,
java.lang.String checksum)
throws java.io.IOException
installedFile - The base path from which the path to the checksum files is derived by appending the given
file extension, must not be null.ext - The file extension (including the leading dot) to use for the checksum file, must not be
null.checksum - the checksum to writejava.io.IOException - If the checksum could not be installed.private java.io.File getLocalRepoFile(org.apache.maven.project.ProjectBuildingRequest buildingRequest,
org.apache.maven.artifact.Artifact artifact)
buildingRequest - The project building request, must not be null.artifact - The artifact whose local repo path should be determined, must not be null.null.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.