The source code to reproduce the described behavior can be found in this repository.
It was originally created to test and solve problems when creating a Gradle Multi project.
Because of the multi project, the code is too extensive to be included in this question.
The funny thing is, the project works excellently in Eclipse. Both when starting as a Spring application and when running it from Eclipse on the local Tomcat.
However, if you want to build a WAR and call the Gradle war task, this message appears.
Working Directory: C:\Users\Martin Burchard\Entwicklung\2018\SpringRestart
Gradle User Home: C:\Users\Martin Burchard\.gradle
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 4.3
Java Home: c:\Program Files\Java\jdk1.8.0_144
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: war
:SpringRestart-API:compileJava
:SpringRestart-API:processResources NO-SOURCE
:SpringRestart-API:classes
:SpringRestart-API:jar SKIPPED
:SpringRestart-Web:compileJavaC:\Users\Martin Burchard\Entwicklung\2018\SpringRestart\prj_web\src\main\java\de\mbur\SpringRestart\SpringRestartApplication.java:5: error: package de.mbur.mypage.domain does not exist
import de.mbur.mypage.domain.User;
^
1 error
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':SpringRestart-Web:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
2 actionable tasks: 2 executed
I wonder why : SpringRestart-API: jar SKIPPED
appears there.
Furthermore, I just noticed that in the API project only the dependencies from the main build.gradle appear. If I add additional dependencies to the API project, they will not be resolved. I thought io.spring.dependency-management
was supposed to take care of it?
Update: it looks like the unsuccessful resolution of dependencies in the API project doesn't affect all dependencies. joda-time, for example, is resolved. commons-text only if you specify the version.