efegokdemir commented on code in PR #712:
URL: 
https://github.com/apache/maven-checkstyle-plugin/pull/712#discussion_r4249565902


##########
src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java:
##########
@@ -507,6 +507,11 @@ public void execute() throws MojoExecutionException, 
MojoFailureException {
             return;
         }
 
+        if (!skipExec && "pom".equalsIgnoreCase(project.getPackaging())) {
+            getLog().info("Not executing Checkstyle for a pom project.");

Review Comment:
   The skip message now uses debug level, and the focused and full unit suites 
pass (27 tests, 1 skipped).



##########
src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojoTest.java:
##########
@@ -92,6 +95,19 @@ public void testNoOutputFile(CheckstyleViolationCheckMojo 
mojo) throws Exception
         mojo.execute();
     }
 
+    @InjectMojo(goal = "check", pom = 
"src/test/resources/plugin-configs/no-source-check-plugin-config.xml")
+    @Test
+    public void 
testNoSourceDoesNotCreateOutputFiles(CheckstyleViolationCheckMojo mojo) throws 
Exception {
+        project.setPackaging("pom");
+        mojo.execute();
+
+        File outputDirectory = new 
File("target/test-harness/checkstyle/no-source-check");
+        assertFalse(new File(outputDirectory, 
"checkstyle-cachefile").exists());
+        assertFalse(new File(outputDirectory, 
"checkstyle-checker.xml").exists());
+        assertFalse(new File(outputDirectory, 
"checkstyle-header.txt").exists());
+        assertFalse(new File(outputDirectory, 
"checkstyle-result.xml").exists());
+    }

Review Comment:
   The test now uses an output path under the fixture’s basedir, removes stale 
output first and asserts that the directory remains absent. The full unit suite 
passed (27 tests, 1 skipped); the Invoker harness could not finish under local 
Java 27 because Groovy rejects class-file version 71.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to