Open BoykoAlex opened 1 year ago
This is a long standing issue (that personally annoys me as well): #764
This is still an issue. The only workaround seems to have two differently named application.(yml/properties). Like:
Then with use of Spring @ActiveProfiles("test")
on Your test class, buildship would pick the right one.
Consider the following project https://github.com/BoykoAlex/buildship-test-resources
DemoApplication
as Java ApplicationSome port = '2222'
in the output in the Console view. This value comes fromsrc/main/resources/application.properties
which is on the classpath.DemoApplicationTest
and JUnit TestSome port = '2222'
and test failure expecting the value to be8888
rather than2222
Note that there is a file
src/test/resources/application.properties
present with value8888
that is supposed to end up on the classpath for the test run making the unit test pass and printSome port = '8888'
in the output. However, this is not the case.Executing
./gradlew clean build
from the terminal runs successfully which means the test passes with Gradle build. Therefore must be something off with Buildship. Converting this project to a maven project, importing into Eclipse with m2e and running the above works as expected as well.