开发者

Files in src/main/resources not copied when using maven and eclipse

开发者 https://www.devze.com 2023-01-18 23:13 出处:网络
I use maven and eclipse (with m2eclipse) for Java projects. I usually start with $ mvn archetype:create \\

I use maven and eclipse (with m2eclipse) for Java projects. I usually start with

$ mvn archetype:create \
  -DarchetypeGroupId=org.apache.maven.archetypes \
  -DgroupId=com.whatever.app \
  -DartifactId=wonderapp
$ mvn eclipse:eclipse

and then import the project into eclipse. The build path in eclipse now contains an "Excluded: **" pattern for the src/main/resource path. If I put for example the log4j.properties file in src/main/resources, it will not be copied to the output path and hence log4j won't work properly.

Files in src/main/resources not copied when using maven and eclipse

(source: skitch.com)

After I ran mvn eclipse:eclipse, the .classpath file in the root dire开发者_开发问答ctory contains this line:

<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>

After importing in eclipse, it has changed to:

<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>

I end up having to manually remove the "**" pattern. Is there any way so that I don't have to do this?


I use maven and eclipse (with m2eclipse) for Java projects. I usually start with (...) and then import the project into eclipse.

Why do you use mvn eclipse:eclipse with m2eclipse? Just create your project and then Import... > Existing Maven Project.

0

精彩评论

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