Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
908 views
in Technique[技术] by (71.8m points)

java - Maven and Eclipse problem - looking for resources

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...