Skip to content

Tests not found via classpath scanning within nested JAR in Spring Boot JAR #1724

@ferstl

Description

@ferstl

We are providing a test suite for our applications as Spring Boot application. The test suite is basically a set of regular JUnit 5 tests that are launched in the Spring Boot application.
The application is packaged as Spring Boot JAR (created with the spring-boot-maven-plugin).

We do now have the problem, that the tests are not found when we are using DiscoverySelectors.selectPackage() and run the application as Spring Boot JAR. Everything works fine, when we select the tests by classname. Executing the application within an IDE works fine as well.

The problem seems to be in ClasspathScanner#findClassesForPath()). Files.walkFileTree() does not work with nested JAR files. A similar problem was already reported in #399.

Steps to reproduce

I created a project on GitHub to reproduce this issue. When the Application is run within the IDE, everything works fine. When it is executed as Spring Boot JAR, the test is not found.

Context

  • Used versions (Jupiter/Vintage/Platform): junit-bom 5.3.2
  • Build Tool/IDE: Maven, OpenJDK11, IntelliJ
  • Spring Boot: 2.1.1.RELEASE

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions