Maven project does not recognize some artifacts

I'm new to Maven, this might be a dumb question. My problem is that I created a dynamic web project in the Eclipse Luna version. I added some artifacts to the room. JAXRS and DOM4J. He loaded all the cans.

I can import the JAXRS class into my code without adding jaxrs in the lib file. but I cannot access the DOM4J class. I use the web scope as my server.

Please help me fix the dom4j problem. Thanks in advance.

POM file. I deleted some entries from this post.

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.mycompany.app</groupId>
      <artifactId>.......</artifactId>
      <version>1</version>

      <build>
        <defaultGoal>install</defaultGoal>
      </build>
      <dependencies>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
.....
.....
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.5</version>
        </dependency>

      </dependencies>
    </project>

My way to class

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/WebSphere Application Server v8.0 JRE">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path=".apt_generated">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry kind="src" path="src/main/resources"/>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.ibm.ws.ast.st.runtime.runtimeTarget.v80/WebSphere Application Server v8.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </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="WebContent/WEB-INF/classes"/>
</classpath>

I use Websphere 8 as my server.

+4
source share
1 answer

Jar , , , eclipse, Maven Marketplace, , , ,

Right click on your Project->Maven->Update the Project

, .

mvn clean -U

mvn clean install -U

mvn eclipse:eclipse -U

. Maven: , 6.1.11. mvn --help:

-U,--update-snapshots    Forces a check for missing
                         releases and updated snapshots on
                         remote repositories
+2

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


All Articles