michael-o commented on code in PR #26:
URL: 
https://github.com/apache/maven-remote-resources-plugin/pull/26#discussion_r1130903437


##########
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:
   Wouldn't just `replace()` suffice here? We don't need regex.



-- 
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

Reply via email to