Why does maven keep resources in a separate "source folder" from the Java sources?
From my experience, in Java the resource files are mostly treated like Java source files which, when "compiled", just need to be copied as-is with the classes, and eventually packaged in the jar, and accessed by the classloader's methods getResource
/getResourceAsStream
, via the classpath
.
Personally I find it a useless complexity to keep resource files separate from Java sources.
- What do you think?
- Is there a good reason why maven keeps resources separate from sources?
- Is there any counter indication in not using
src/main/resources
and src/test/resources
and keeping
resources in src/main/java
and src/test/java
using maven?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…