Maven和Eclipse问题 - 寻找资源 [英] Maven and Eclipse problem - looking for resources
问题描述
这是说:
找不到此文件:file:/ C:/eclipse/eclipse/src/main/resources/config/spring/applicationContext.xml
虽然我的工作区位于 c:/ Work / Core /
和 src / main / resources
。
是否有任何pom.xml配置命令从它的位置看相对? ?
编辑#1:
我从Eclipse运行Maven从命令行它编译没有问题。
我正在尝试运行Junit测试。
编辑#2:
所有依赖项,web.xml,...都可以 - 我知道这是因为其他开发人员在Linux和Idea上使用的文件和项目正在工作没有问题。使用我的项目设置junit测试不起作用,编译wsdl文件不起作用 - 因为它无法找到资源。
编辑#3:
找到答案 - 这是发布在这里。
得到它...最后..我不知道为什么,但Eclipse只是不会从Mavens刷新自己的设置。
我不得不更改.classpath:
<?xml version =1.0encoding =UTF-8?>
< classpath>
< classpathentry kind =srcoutput =target / classespath =src / main / java/>
< classpathentry exclud =**kind =srcoutput =target / classespath =src / main / resources/>
< classpathentry kind =srcoutput =target / test-classespath =src / test / java/>
< classpathentry kind =conpath =org.eclipse.jdt.launching.JRE_CONTAINER / org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType / JavaSE-1.6/>
< classpathentry kind =conpath =org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER>
<属性>
< attribute name =org.eclipse.jst.component.dependencyvalue =/ WEB-INF / lib/>
< / attributes>
< / classpathentry>
< classpathentry kind =conpath =org.eclipse.jst.j2ee.internal.web.container/>
< classpathentry kind =conpath =org.eclipse.jst.j2ee.internal.module.container/>
< classpathentry kind =outputpath =target / classes/>
< / classpath>
在第四行, exclud =**
- 我删除了这个,它的工作。
此后,我也有项目名称的问题。在pom.xml中
< groupId> core-maven< / groupId>
< artifactId> core-maven< / artifactId>
和build标签< finalName> core-maven< / finalName>
我想在核心中改变,但是它没有起作用,直到找到并替换为.settings文件夹下的文件。
I have a problem, that maven is looking for resources inside of Eclipse installation folder.
It is saying:
This file was not found: file:/C:/eclipse/eclipse/src/main/resources/config/spring/applicationContext.xml
While my workspace is in c:/Work/Core/
and inside src/main/resources
.
Is there any configuration for pom.xml to order it to look relative from its position??
EDIT #1:
I am running Maven from Eclipse. From command line it compiles without problems.
I am trying to run Junit tests.
EDIT #2:
All dependencies, web.xml,... are OK - I know this because the same files other developer is using on Linux and with Idea and there the project is working without problems. With my project settings junit tests are not working, compiling wsdl files is not working - both because it can not find resources.
EDIT #3:
Found the answer - it is posted here down.
Got it... Finally.. I don't know why, but Eclipse just does not refresh its own settings from Mavens.
I had to change .classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
In the fourth line, there excluding="**"
- I removed this, and it worked.
After this, I also had problems with name of the project. In pom.xml was
<groupId>core-maven</groupId>
<artifactId>core-maven</artifactId>
and in build tag <finalName>core-maven</finalName>
which I wanted to change in just "core", but it did not work, until I found it and replace in files under .settings folder.
这篇关于Maven和Eclipse问题 - 寻找资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!