cstamas commented on code in PR #26: URL: https://github.com/apache/maven-remote-resources-plugin/pull/26#discussion_r1147254220
########## src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java: ########## @@ -495,46 +490,66 @@ protected ProcessRemoteResourcesMojo lookupProcessMojo() protected ProcessRemoteResourcesMojo lookupProcessMojoWithSettings( final MavenProject project, - String[] bundles ) - throws Exception + String[] bundles ) + throws Exception { return lookupProcessMojoWithSettings( project, new ArrayList<>( Arrays.asList( bundles ) ) ); } protected ProcessRemoteResourcesMojo lookupProcessMojoWithSettings( final MavenProject project, - ArrayList<String> bundles ) - throws Exception + ArrayList<String> bundles ) + throws Exception { final ProcessRemoteResourcesMojo mojo = lookupProcessMojo(); - ArtifactRepository localRepository = mojo.repositorySystem.createLocalRepository( new File( LOCAL_REPO ) ); DefaultRepositorySystemSession reposession = MavenRepositorySystemUtils.newSession(); reposession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory() .newInstance( reposession, new LocalRepository( new File( LOCAL_REPO ) ) ) ); DefaultMavenExecutionRequest request = new DefaultMavenExecutionRequest(); - request.setLocalRepository( localRepository ); - request = new DefaultMavenExecutionRequest(); request.setUserProperties( null ); - request.setLocalRepository( localRepository ); - request.setGoals(Collections.singletonList( "install" ) ); + //request.setLocalRepository( reposession.getLocalRepository() ); + request.setGoals( Collections.singletonList( "install" ) ); request.setBaseDirectory( project.getBasedir() ); request.setStartTime( Calendar.getInstance().getTime() ); - MavenSession session = new MavenSession( getContainer(), reposession, request, new DefaultMavenExecutionResult() ); + + // TODO: get rid of this uglyness/legacy + MavenArtifactRepository localRepository = new MavenArtifactRepository(); + localRepository.setId( "local" ); + localRepository.setUrl( new File( LOCAL_REPO ).toURI().toASCIIString() ); + localRepository.setLayout( new DefaultRepositoryLayout() ); + request.setLocalRepository( localRepository ); + MavenSession session = + new MavenSession( getContainer(), reposession, request, new DefaultMavenExecutionResult() ); session.setProjects( Collections.singletonList( project ) ); - setVariableValueToObject( mojo, "project", project ); setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory() ) ); setVariableValueToObject( mojo, "resourceBundles", bundles ); setVariableValueToObject( mojo, "mavenSession", session ); - setVariableValueToObject( mojo, "remoteArtifactRepositories", project.getRemoteArtifactRepositories() ); - setVariableValueToObject( mojo, "resources", project.getResources() ); return mojo; } protected ProcessRemoteResourcesMojo lookupProcessMojoWithDefaultSettings( final MavenProject project ) - throws Exception + throws Exception { return lookupProcessMojoWithSettings( project, new ArrayList<>() ); } + + private String pathOf( Artifact artifact ) + { + String path = LOCAL_REPO + artifact.getGroupId().replaceAll( "\\.", "/" ) + "/" Review Comment: fixed ########## src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java: ########## @@ -445,40 +371,69 @@ @Parameter( defaultValue = "${project.build.outputTimestamp}" ) private String outputTimestamp; + @Component + protected RepositorySystem repositorySystem; + /** + * Filtering support, for local resources that override those in the remote bundle. */ - @Component( hint = "default" ) - protected ProjectDependenciesResolver dependencyResolver; + @Component + private MavenFileFilter fileFilter; + + @Component + private ResourceManager locator; + + @Component + private ProjectBuilder projectBuilder; + + @Component + private ArtifactHandlerManager artifactHandlerManager; + + /** + * TODO: move off this deprecated component. + */ + @Component + private ArtifactFactory artifactFactory; + + /** + * Map of artifacts to supplemental project object models. + */ + private Map<String, Model> supplementModels; + + /** + * Merges supplemental data model with artifact metadata. Useful when processing artifacts with + * incomplete POM metadata. + */ + private final ModelInheritanceAssembler inheritanceAssembler = new ModelInheritanceAssembler(); private VelocityEngine velocity; @Override - @SuppressWarnings( "unchecked" ) public void execute() throws MojoExecutionException { if ( skip ) { - getLog().info( "Skipping remote resources execution." ); + LOGGER.info( "Skipping remote resources execution." ); Review Comment: fixed -- 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