Maven 和 Eclipse 问题——寻找资源 [英] Maven and Eclipse problem - looking for resources

查看:13
本文介绍了Maven 和 Eclipse 问题——寻找资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,maven 正在 Eclipse 安装文件夹中寻找资源.

I have a problem, that maven is looking for resources inside of Eclipse installation folder.

它是说:

This file was not found: file:/C:/eclipse/eclipse/src/main/resources/config/spring/applicationContext.xml

虽然我的工作区在 c:/Work/Core/src/main/resources 内.

While my workspace is in c:/Work/Core/ and inside src/main/resources.

pom.xml 是否有任何配置可以让它从它的位置看起来是相对的??

Is there any configuration for pom.xml to order it to look relative from its position??

编辑 #1:

我从 Eclipse 运行 Maven.从命令行编译没有问题.

I am running Maven from Eclipse. From command line it compiles without problems.

我正在尝试运行 Junit 测试.

I am trying to run Junit tests.

编辑#2:

所有依赖项、web.xml、...都可以 - 我知道这是因为其他开发人员在 Linux 和 Idea 上使用的文件相同,并且项目在那里工作没有问题.我的项目设置 junit 测试不起作用,编译 wsdl 文件也不起作用 - 两者都是因为它找不到资源.

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.

编辑 #3:

找到答案 - 已发布在此处.

Found the answer - it is posted here down.

推荐答案

明白了……终于……我不知道为什么,但 Eclipse 只是没有从 Maven 刷新它自己的设置.

Got it... Finally.. I don't know why, but Eclipse just does not refresh its own settings from Mavens.

我不得不更改 .classpath:

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>

在第四行,有 exclude="**" - 我删除了它,它起作用了.

In the fourth line, there excluding="**" - I removed this, and it worked.

在此之后,我也遇到了项目名称的问题.在 pom.xml 是

After this, I also had problems with name of the project. In pom.xml was

<groupId>core-maven</groupId>
<artifactId>core-maven</artifactId>

和在构建标记 core-maven 中,我想在核心"中更改它,但它不起作用,直到我找到它并在文件中替换在 .settings 文件夹下.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆