简体   繁体   中英

maven project not recognizing some artifacts

I am new to Maven, It might be stupid question. My problem is I have created dynamic web project in Eclipse Luna version. I have added some artifacts in pom. JAXRS and DOM4J. It downloaded all jars.

I am able to import JAXRS class in my code with out adding jaxrs in lib file. but i am not able to access DOM4J class. I am using web-sphere as my server.

Please help me to fix dom4j issue. Thanks in advance.

POM file.. I have removed some entries 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 Class path

<?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 am using Websphere 8 as my server.

If Jar is downloaded as you mentioned then simply do this, in eclipse if you added Maven from Market place then it well and good if not then add this and then

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

It will resolve the issue related to dependency.

OR

try this command

mvn clean -U

mvn clean install -U

mvn eclipse:eclipse -U

See Maven: The Complete Reference, 6.1.11. Downloading and Verifying Dependencies or mvn --help :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM