开发者

Problems with classpath and resources

开发者 https://www.devze.com 2023-03-09 06:49 出处:网络
I have a project that has 5 modules (I\'m using maven) In my module A I have 2 source folders: src/main/java and arc/main/resources

I have a project that has 5 modules (I'm using maven)

In my module A I have 2 source folders: src/main/java and arc/main/resources

In my folder src/main/java I have a simple App.java (console app) that when I try to Run As -> Application in Eclipse doesn't find anything in my resources folder.

It doesn't find my log4.properties (which is in src/main/resources/log4j.properties) and it doesn't find a resources file app_es_ES.properties (wic开发者_开发问答h is in src/main/resources/app_es_ES.properties)

How can I set my app to find in the resources folder my properties files? Could it be a problem with maven? Should I run my app in a different way?


You have to configure your eclipse project to match your maven configuration. This can be accomplished by either using the

  • maven eclipse plugin - mvn eclipse:eclipse to generate the eclipse project artifacts. Then import the generated project into the workspace.
  • m2eclipse eclipse plugin - much nicer (IMHO) as it integrates your maven and eclipse workspace. Thus your pom is used to manage your dependencies and eclipse .project and .classpath is kept in sync with maven.
0

精彩评论

暂无评论...
验证码 换一张
取 消