facebook

How to add dependency?

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #316498 Reply

    trant
    Participant

    I am new to Maven and so maybe I am misunderstanding this but the dependencies are in reference to your project, correct?

    Because I created a new project and included Maven support and then I want to use log4j in my app so I thought I need to do it through Maven, I right click the pom.xml and under MyElcipse4Maven I choose Add Dependency. In the window I search for “log4j” and find an entry simply labeled “log4j” with latest version 1.2.16.

    I pick it and close the dialog and then the Maven build updates itself automatically but quickly outputs an error:

    5/3/11 4:43:27 PM EDT: Missing artifact log4j:log4j:bundle:1.2.16:compile

    If I right-click the pom.xml and choose Run As… Maven install then it throws this error:

    
    [ERROR] Failed to execute goal on project myapp: Missing:
    ----------
    1) log4j:log4j:bundle:1.2.16
    
      Try downloading the file manually from the project website.
    
      Then, install it using the command: 
          mvn install:install-file -DgroupId=log4j -DartifactId=log4j -Dversion=1.2.16 -Dpackaging=bundle -Dfile=/path/to/file
    
      Alternatively, if you host your own repository you can deploy the file there: 
          mvn deploy:deploy-file -DgroupId=log4j -DartifactId=log4j -Dversion=1.2.16 -Dpackaging=bundle -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
    
      Path to dependency: 
          1) com.mycompany:myapp:pom:pom:0.0.1
          2) log4j:log4j:bundle:1.2.16
    

    So whats the point of this dependency thing?

    It cant even find something as widespread as log4j?

    #316507 Reply

    support-swapna
    Moderator

    trant,

    Here is a screencast which shows how to manage dependency :
    http://www.myeclipseide.com/documentation/quickstarts/maven/mavenJavaTutorial/
    http://www.myeclipseide.com/documentation/quickstarts/maven_tips/

    You can find more support material for Maven at this link :
    http://myeclipseide.com/module-htmlpages-display-pid-7.html

    Let me know how this works for you.

    #316615 Reply

    support-tony
    Keymaster

    trant,

    It looks like you’ve done everything right but the problem seems to be in the dependency definition for the log4j artifact. An artifact type of “bundle” isn’t being properly dealt with by the maven code. The type comes directly from the definitions in the central maven repository.

    A problem report has been raised for us to investigate it further. In the meantime, it looks like simply removing the type parameter from the dependency definition in the POM xml will fix the problem. This is the line that should be removed:

    <type>bundle</type>

    Alternatively, delete the log4j dependency and add a previous version as a dependency (the latest version of log4j seems to be the first to use a bundle type).

    I hope this helps.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How to add dependency?

You must be logged in to post in the forum log in