解决maven构建eclipse项目中的错误
由于最近把开发环境进行了升级,如svn、eclipse、和maven,都升级到了最新版本。感觉效果很好。但是今天在利用maven构建之前的一个版本的项目时报如下错误:
mvn eclipse:eclipse -e
[INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Request to merge when ‘filtering’ is not identical. Original=resource src/main/resources: output=target/classes, include=[**/*.properties], exclude=[**/*.java], test=false, filtering=true, merging with=resource src/main/resources: output=target/classes, include=[], exclude=[**/*.java], test=false, filtering=false
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
atorg.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
atorg.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
atorg.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
atorg.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
atorg.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
atorg.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
atorg.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
atorg.apache.maven.cli.MavenCli.main(MavenCli.java:362)
atorg.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
atjava.lang.reflect.Method.invoke(Method.java:597)
atorg.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
atorg.codehaus.classworlds.Launcher.launch(Launcher.java:255)
atorg.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)我查找相关资料,知道是由于升级导致的错误。利用降低maven到2.6即可:
mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse
这样就可以成功构建了。
也可以修改pom文件:
<build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.6</version> </plugin> </plugins> </build>
这样你利用
mvn eclipse:eclipse也可以构建成功。
参考文档:
http://stackoverflow.com/questions/1397903/setting-project-for-eclipse-using-maven