我正在尝试m2eclipse,Maven的Eclipse插件,并注意到资源现在被排除在我所有项目的构建路径之外.
我在M2Eclipse常见问题解答页面上看到了一个似乎处理这个确切问题的问题,但答案(解释)似乎是说这是故意允许资源过滤,一切都应该正常工作.
但是,当我从Eclipse中运行我的应用程序时,依赖项目中的大量资源无法被我的应用程序找到.
我尝试过我常用的Eclipse挥动 - 橡皮鸡动作(清洁所有项目,从-clean开始)无济于事.我敢肯定我错过了一些相当简单的东西.有没有人有什么建议?
编辑:m2控制台中的一些挖掘显示其中一个项目没有正确构建.ClassNotFoundException
当它试图找到org.apache.maven.plugin.MojoFailureException
用于构建其中一个项目的自定义插件时,我得到了一个.
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'ourdemain:ourcustomplugin:2.0:process': Mojo execution failed. at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:505) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149) at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223) at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1) at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904) at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304) at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1) at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant$1.execute(DefaultBuildParticipant.java:130) at org.maven.ide.eclipse.internal.project.MavenProjectManagerImpl.execute(MavenProjectManagerImpl.java:986) at org.maven.ide.eclipse.internal.project.MavenProjectFacade.execute(MavenProjectFacade.java:320) at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant.executePostBuild(DefaultBuildParticipant.java:116) at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant.build(DefaultBuildParticipant.java:80) at org.maven.ide.eclipse.internal.builder.MavenBuilder.build(MavenBuilder.java:84) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:633) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: org.apache.maven.plugin.PluginExecutionException: Mojo execution failed. at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:601) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498) ... 27 more Caused by: org.apache.maven.plugin.MojoExecutionException: org/apache/maven/plugin/MojoFailureException at org.codehaus.mojo.ruby.DefaultRubyMojo.execute(DefaultRubyMojo.java:98) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579) ... 28 more Caused by: java.lang.NoClassDefFoundError: org/apache/maven/plugin/MojoFailureException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.getConstructor(Class.java:1657) at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:587) at org.jruby.javasupport.Java.new_proxy_instance(Java.java:570) at org.jruby.javasupport.JavaInvokerSnew_proxy_instancexx1.call(Unknown Source) at org.jruby.runtime.callback.InvocationCallback.execute(InvocationCallback.java:49) at org.jruby.internal.runtime.methods.FullFunctionCallbackMethod.internalCall(FullFunctionCallbackMethod.java:79) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79) at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:577) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:206) at org.jruby.evaluator.EvaluationState.setupArgs(EvaluationState.java:2182) at org.jruby.evaluator.EvaluationState.attrAssignNode(EvaluationState.java:481) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:191) at org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:522) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:200) at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:167) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:125) at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:564) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:206) at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:544) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:206) at org.jruby.evaluator.EvaluationState.localAsgnNode(EvaluationState.java:1230) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:285) at org.jruby.evaluator.EvaluationState.rescueNode(EvaluationState.java:1522) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:349) at org.jruby.evaluator.EvaluationState.ensureNode(EvaluationState.java:980) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:246) at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:167) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:125) at org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1019) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:252) at org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:522) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:200) at org.jruby.evaluator.EvaluationState.rootNode(EvaluationState.java:1622) at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:355) at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:163) at org.jruby.Ruby.eval(Ruby.java:274) at org.codehaus.plexus.component.jruby.JRubyRuntimeInvoker.runInterpreter(JRubyRuntimeInvoker.java:392) at org.codehaus.plexus.component.jruby.JRubyRuntimeInvoker.invoke(JRubyRuntimeInvoker.java:313) at org.codehaus.mojo.ruby.DefaultRubyMojo.execute(DefaultRubyMojo.java:81) ... 29 more Caused by: java.lang.ClassNotFoundException: org.apache.maven.plugin.MojoFailureException at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) ... 75 more
Rich Seller.. 5
只要在项目上运行Maven构建器,就会运行FAQ中提到的资源过滤.在实践中,我发现这比它的价值更麻烦,因为Maven构建器运行速度非常慢,并且仅在配置时运行(默认情况下仅在完整版本上运行),让你抓住头脑并想知道为什么你的没有接受更改.
我倾向于修改Eclipse类路径以包含src/main/resources.这对于大多数用例来说已经足够了.
对于那些简单的方法是行不通的(例如,如果一个相关项目有一些复杂的资源处理)的情况下,我做的罗伯特建议和关闭工作空间分辨率,然后安装依赖于本地资源库中,因此也包括在Maven类路径容器.
只要在项目上运行Maven构建器,就会运行FAQ中提到的资源过滤.在实践中,我发现这比它的价值更麻烦,因为Maven构建器运行速度非常慢,并且仅在配置时运行(默认情况下仅在完整版本上运行),让你抓住头脑并想知道为什么你的没有接受更改.
我倾向于修改Eclipse类路径以包含src/main/resources.这对于大多数用例来说已经足够了.
对于那些简单的方法是行不通的(例如,如果一个相关项目有一些复杂的资源处理)的情况下,我做的罗伯特建议和关闭工作空间分辨率,然后安装依赖于本地资源库中,因此也包括在Maven类路径容器.