In maven, what is the difference between main/resources and main/config?

前端 未结 4 1098
失恋的感觉
失恋的感觉 2020-12-24 10:48

I want to put a configuration file in my Maven project. Looking at the standard directory layout, there are two places that seem sensible, \"src/main/resources\

4条回答
  •  死守一世寂寞
    2020-12-24 11:31

    The email exchange at http://www.mail-archive.com/users@maven.apache.org/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.

提交回复
热议问题