Maven and Eclipse Problem - Resource Search

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

They say:

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

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

Is there any configuration for pom.xml so that it looks relative from its position?

EDIT # 1:

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

I am trying to run Junit tests.

EDIT # 2:

All the dependencies, web.xml, ... are fine - I know this because the same files as other developers use on Linux with the idea, and there the project works without problems. When configuring the junit project parameters, the tests do not work, the compilation of the wsdl files does not work - and because it cannot find the resources.

EDIT No. 3:

Found the answer - it is published here.

+3
6

... .. , Eclipse Mavens.

.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>

, excluding="**" - , .

. pom.xml

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

build <finalName>core-maven</finalName>, "", , .settings.

+6

web.xml? spring applicationContext.xml web.xml - :

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>...</param-value>
</context-param>

(EDIT: , maven web.xml... jUnit, - , .)

EDIT 2: linux Windows , . , , , . , Linux- spring, applicationContext.xml /usr/local/myide/myproject/src...? Windows .

+1

. .

  • : ( , ), " Maven Build" .
  • - ( , ).
  • Eclipse (... > Maven).
  • Maven.

P.S.: , m2eclipse, , .

+1

. , , , , .

SpringSource Tool Suite (sts) http://www.springsource.com/products/sts

IDE, Eclipse, SpringSource, Maven. , . Eclipse, IDE, , Eclipse, STS

+1

, pom.xml?

Ideally, any reference link in pom.xml should be relative to the location of the pom.xml file.

0
source

An attractive way to solve Maven problems with Eclipse is to migrate to Netbeans. It is easier to use and has built-in support for Maven projects.

-3
source

Source: https://habr.com/ru/post/1733005/


All Articles