Skip to content

testNoSources checks directory existence instead of jar file absence #308

Closed

Description

@elharo

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.

Activity

  1. added
    bugSomething isn't working
    priority:trivialCosmetic problem like misspelled words or misaligned text
    on Jul 20, 2026
  2. added a commit that references this issue on Aug 6, 2026
    65cc352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:trivialCosmetic problem like misspelled words or misaligned text

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions