cstamas commented on code in PR #32: URL: https://github.com/apache/maven-install-plugin/pull/32#discussion_r917761382
########## src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java: ########## @@ -158,48 +165,36 @@ @Parameter( property = "localRepositoryPath" ) private File localRepositoryPath; - /** - * Used for attaching the artifacts to install to the project. - */ - @Component - private MavenProjectHelper projectHelper; - - /** - * Used for creating the project to which the artifacts to install will be attached. - */ - @Component - private ProjectBuilder projectBuilder; - - /** - * Used to install the project created. - */ - @Component - private ProjectInstaller installer; - - /** - * @see org.apache.maven.plugin.Mojo#execute() - */ + @Override public void execute() throws MojoExecutionException, MojoFailureException { - if ( !file.exists() ) { String message = "The specified file '" + file.getPath() + "' does not exist"; getLog().error( message ); throw new MojoFailureException( message ); } - ProjectBuildingRequest buildingRequest = session.getProjectBuildingRequest(); - - // ---------------------------------------------------------------------- - // Override the default localRepository variable - // ---------------------------------------------------------------------- + RepositorySystemSession repositorySystemSession = session.getRepositorySession(); if ( localRepositoryPath != null ) { - buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); - - getLog().debug( "localRepoPath: " + repositoryManager.getLocalRepositoryBasedir( buildingRequest ) ); + // "clone" repository session and replace localRepository + DefaultRepositorySystemSession newSession = new DefaultRepositorySystemSession( + session.getRepositorySession() ); + // Clear cache, since we're using a new local repository + newSession.setCache( new DefaultRepositoryCache() ); + // keep same repositoryType + String contentType = newSession.getLocalRepository().getContentType(); + if ( "enhanced".equals( contentType ) ) + { + contentType = "default"; + } Review Comment: https://issues.apache.org/jira/browse/MRESOLVER-267 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org