Spring Boot + Eclipse is excluded from Java – .classpath : why application. Attribute?
I created a basic SpringBoot 1.5.7 application (Java, Maven) from http://start.spring.io/ and I’m dealing with using mvn Eclipse:
An Eclipse project created by Eclipse.
I’ve noticed that if I modify my application.properties
file and then run the Junit tests (all from inside Eclipse), the new version isn’t used.
Digging a bit, I found that the new application.properties
file was not copied from src/main/resources
/ to target/classes/
built by Eclipse. It seems that the reason is that it is marked as “Excluded” in the Eclipse project settings. In fact, my (auto-generated) .classpath
file says:
<classpath>
<classpathentry kind="src" path="src/test/java" output="target/test-classes"
including="**/*.java"/>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources"
excluding="**/*.java|**/application*.yml|**/application*.yaml|**/application*.properties"/>
...
Of course, when I run the Maven spring-boot:run
target, the files are actually copied.
So why is it excluded from Eclipse’s classpath? Is that right?
Solution
MVN Eclipse
: Eclipse
seems to be bad. Instead of not depending, simply < a href="https://stackoverflow.com/a/36064664/277304" rel="noreferrer noopener nofollow">import as Maven Project from Eclipse and be happy.