cstamas commented on code in PR #32: URL: https://github.com/apache/maven-install-plugin/pull/32#discussion_r917684531
########## 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: This is resolver (actually one of oldest Sonatype Aether) thing: the "enhanced" repository was introduced after the "simple" repository and was promoted as default (so priority-wise both act on "default" content type, but enhanced has higher priority), and enhanced repo reports content type enhanced. Is mess and inconsistent, but this is like it due legacy (in resolver). Refs: https://github.com/apache/maven-resolver/blob/master/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManagerFactory.java#L98 https://github.com/apache/maven-resolver/blob/master/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/EnhancedLocalRepositoryManager.java#L79 -- 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