Marcono1234 commented on code in PR #20:
URL: 
https://github.com/apache/maven-jarsigner-plugin/pull/20#discussion_r1564959575


##########
src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java:
##########
@@ -346,6 +350,23 @@ private List<File> findJarfiles() throws 
MojoExecutionException {
         return archives;
     }
 
+    /**
+     * {@linkplain Path#relativize(Path) Relativizes} the path against {@link 
MavenProject#getBasedir()}.
+     * Can be used to shorten or simplify paths before displaying them to the 
user.
+     */
+    private Path relativizePathAgainstBasedir(Path path) {

Review Comment:
   Without this the file paths might be very verbose in case they are already 
absolute, e.g.:
   `C:\Users\user\Documents\my-project\target\custom-artifact.jar`
   vs.
   `target\custom-artifact.jar`
   
   But if you think this 'relativize' is not needed or might be too error-prone 
I can omit it.



##########
src/test/java/org/apache/maven/plugins/jarsigner/JarsignerSignMojoParallelTest.java:
##########
@@ -67,6 +67,7 @@ public class JarsignerSignMojoParallelTest {
     @Before
     public void setUp() throws Exception {
         projectDir = folder.newFolder("dummy-project");
+        when(project.getBasedir()).thenReturn(projectDir);

Review Comment:
   This change in this and the other tests is needed because 
`AbstractJarsignerMojo#relativizePathAgainstBasedir` calls `getBasedir()`, and 
by default the method on the mock object returns `null` leading to a 
`NullPointerException`.



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