In SourceJarMojoTest.java:93-97 and TestSourceJarMojoTest.java:80-84:
public void testNoSources(AbstractSourceJarMojo mojo) throws Exception {
mojo.execute();
final File expectedFile = getTestTargetDir("project-005");
assertFalse(
expectedFile.exists(),
"Source archive should not have been created[" + expectedFile.getAbsolutePath() + "]");
}
getTestTargetDir("project-005") returns /basedir/target/test-classes/unit/project-005/target — a directory, not the jar file itself. If the test environment pre-creates this directory (e.g., from a previous test run or build scaffolding), the assertion would fail even though no source archive was created.
A more robust check would verify the specific jar file does not exist.
In
SourceJarMojoTest.java:93-97andTestSourceJarMojoTest.java:80-84:getTestTargetDir("project-005")returns/basedir/target/test-classes/unit/project-005/target— a directory, not the jar file itself. If the test environment pre-creates this directory (e.g., from a previous test run or build scaffolding), the assertion would fail even though no source archive was created.A more robust check would verify the specific jar file does not exist.