New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spring Boot Starter Test includes dependencies with split packages which causes compilation failures when testing using the module path #15967
Comments
Thanks for the sample. The problem is that there are two split packages in the dependencies of
In short, In Hamcrest 2.1, the Regardless of the above, please note that classpath scanning does not work for module path-based testing: spring-projects/spring-framework#21515. As such, it's hard to justify making changes to the test starter to accommodate module path-based testing and I would recommend using the class path instead. |
Thanks for the link to the module path-based testing issue. Do you think that the Spring Initializr should generate a sample project with Java modules and maven/gradle scripts that work including tests (using classpath)? I could create an issue for this there. |
@rajeshja Spring Initializr is not meant to generate sample projects, in the sense of showing how to do something. A guide is usually what we aim for though I am not sure one on the modules path would be accepted. |
We've discussed this and agreed that we don't want to make any changes to the starter. @rajeshja You may want to raise an issue against |
Five years on it appears unlikely that the practically dead-in-the-water + <json-unit.version>3.2.7</json-unit.version>
@@ ... @@
+ <dependency>
+ <groupId>net.javacrumbs.json-unit</groupId>
+ <artifactId>json-unit-spring</artifactId>
+ <version>${json-unit.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ </exclusion>
+ </exclusions>
</dependency> +import static net.javacrumbs.jsonunit.spring.JsonUnitResultMatchers.json;
@@ ... @@
final var requestJson = get("/foo").contentType(MediaType.APPLICATION_JSON);
- final var matchingJsonBody = content().json(read("/foo.json"));
+ final var matchingJsonBody = json().when(Option.IGNORING_EXTRA_FIELDS).isEqualTo(read("/foo.json")); It seems likely that The |
I'm using Gradle 5.2 on Java 11.0.1 with a very simple project that adds a controller and an entity package to the base starter created with Spring 2.1.2. The code in
src/main/java
is setup as a Java module. He is my module definition (I only have one at this time)Running
gradlew build
breaks atcompileTestJava
with 100 errors of the form:Replacing the
org.springframework.boot:spring-boot-starter-test
dependencies with individual imports of the following works. Importing the failing code into Intellij IDEA and running the SpringBootApplication in the IDE also works.A sample project to replicate the issue is at:
https://github.com/rajeshja/springboot2.1-java11-gradle-bug
The text was updated successfully, but these errors were encountered: