In maven, what is the difference between main/resources and main/config?
Solution 1:
The email exchange at http://www.mail-archive.com/[email protected]/msg90985.html says:
"This is all theory... Perhaps while writing the docs, someone involved with Maven development thought it might be useful to have a src/main/config directory and so it was included in docs, but since it was never implemented in the code, it is not being used today."
and
"The directory [src/main/config] doesn't show up on the classpath so the application or test classes can't read anything in it."
So just use src/main/resources
.
Note: I don't know if this is true (I'm the question asker), but that would explain why so many people on the web recommend src/main/resources
for log4j.properties. If people agree this is the right answer could you let me know (comment or vote) I put it here to save other people the typing.
Solution 2:
scr/main/resources
is a place where you put your images, sounds, templates, language bundles, textual and binary files used by the source code. All config files like excache.xml, log4j.properties, logback.xml and others go to src/main/config
.
Add to your pom.xml
:
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<directory>src/main/config</directory>
</resource>
</resources>
</build>
Solution 3:
The inclusion of src/main/config
in Maven's standard directory layout has been removed due in part to the confusion caused between src/main/config
and src/main/resources
. This very stackoverflow question is actually referenced in the JIRA ticket for the removal of src/main/config
from Maven's standard.
Short answer: Use src/main/resources
not src/main/config
. It's the (new) Maven way.