If you are developing a maven plugin you need often to install artifacts into the local repository which is a little bit cumbersome. This can be easily done via the following code parts.
@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( project ).setUpdateReleaseInfo( updateReleaseInfo ); installer.install( session.getProjectBuildingRequest(), pir ); ... }