Anatch
Anatch

Reputation: 453

Maven dependencies missing in Eclipse project

I have created a maven project on Eclipse but the maven dependencies library is missing but when I go to project->properties: Java Build Path I can see the maven dependencies library.

So because the maven dependencies is missing when I want to generate to project, I have BUILD SUCCESS but nothing is created.

Upvotes: 7

Views: 43660

Answers (9)

user13987919
user13987919

Reputation: 11

This simply means your settings.xml file is corrupted. Just replace that file with valid content and your issue is resolved.

Upvotes: 0

Harika Mudiam
Harika Mudiam

Reputation: 11

Right Click on the project. Click on "Build Project". It worked for me besides restart, refresh and all. Hope it works for you. Lemme know if it does.

Upvotes: 1

bigbadmouse
bigbadmouse

Reputation: 186

One extra thing to try:

I got this today using eclipse RAD when I did have a Maven nature and facets, and had followed all remedial steps listed above.

Eclipse had simply decided that I had no valid maven dependencies, and didn't show the "Maven Dependencies" element in the navigator window, even as an empty node. Rectifying the version on my one POM dependency to a version that it could find made the "Maven Dependencies" element magically appear with the one expected child.

Upvotes: 0

WesternGun
WesternGun

Reputation: 12728

Convert the project to Maven project in context menu. That is how I fixed it.

Upvotes: 1

Aaron Digulla
Aaron Digulla

Reputation: 328536

Open the context menu for the project -> Maven -> Update Projects... and select your project. Maven will then refresh everything.

If this item isn't available, The m2e plugin of Eclipse hasn't recognized your project as a Maven project. If so, go to the context menu -> Configure -> Maven Nature.

Also try to build the project from the command line to make sure your POM actually works.

If you're missing dependencies, then check you POM (pom.xml) and make sure they are in there. To verify your dependencies, open the POM editor and select the "Dependency Hierarchy" tab (at the bottom) to get an overview.

Upvotes: 8

yeaaaahhhh..hamf hamf
yeaaaahhhh..hamf hamf

Reputation: 788

Open the .classpath file inside your eclipse project. Insert the following lines:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
</classpathentry> 

Then, rebuild your project at eclipse.
Project->Clean/Build

Upvotes: 3

BK Batchelor
BK Batchelor

Reputation: 457

When you attempt to convert a Java project into a Maven project,Eclipse sometimes hoses the project and classpath files. Also, double check if Maven plugin (m2e) is installed. The plugin is a default for Eclipse Java, but not Eclipse EE.

Check you ".project" file if contains the following Maven reference.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>sample</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
    </natures>
</projectDescription>

Also, double check your classpath.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

Upvotes: 6

Jaroslav Z&#225;ruba
Jaroslav Z&#225;ruba

Reputation: 4876

Check out whether your Maven dependencies are listed in Project properties -> Deployment Assembly, it should look something similar to this: enter image description here

Upvotes: 1

SmilinMadJack
SmilinMadJack

Reputation: 11

Unfortunately, there is not much information here, I would suggest adding you pom.xml file if it is possible so that we can look at that to diagnose the exact issue.

As a stab in the dark, if you are not using a jar as your packaging eclipse can move the maven dependencies into a different folder in the interface. and example is 'war' packages have their maven dependencies moved to under "java resources/Libraries"

Usually the built project is under the 'target' file.

These are just guesses and I cant really tell you anything conclusive without additional information, sorry

Upvotes: 0

Related Questions