Spring Boot incorrectly loads test configuration when running from eclipse+gradle

£可爱£侵袭症+ 提交于 2019-12-05 12:51:49

The thing is that it works for maven based builds correctly, but not for gradle.

Yes, unfortunately that is the case. Gradle doesn't deal properly with configuring eclipse's runtime classpath at all. This is even the case with Gradle's own new BuildShip eclipse plugin.

See this issue I recently raised: https://bugs.eclipse.org/bugs/show_bug.cgi?id=482315

The resolved bug you found is indeed resolved, but it only concerned the maven/m2e case, which is in fact fixable (m2e does this correcty for "Run As >> Java Project" and we adopted a similar fix for "Run As >> Spring Boot App"). However, that fix is maven-specific as the gradle case is not really fixable until this Gradle tooling-api issue ticket is resolved:

https://issues.gradle.org/browse/GRADLE-1777

I had to introduce separation with profiles for this. Having all test marking with @ActiveProfiles("srv-test") and main configuration with @Profile({"local", "docker"})

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!