MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
trant
Post subject: How to add dependency?  PostPosted: May 03, 2011 - 09:49 PM
Registered Member
Registered Member


Joined: Mar 14, 2007
Posts: 46

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:

Code:

[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?
 
 View user's profile Send private message  
Reply with quote Back to top
support-swapna
Post subject: RE: How to add dependency?  PostPosted: May 04, 2011 - 06:42 AM



Joined: Nov 11, 2010
Posts: 2491

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.

_________________
Swapna
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
support-tony
Post subject: RE: How to add dependency?  PostPosted: May 06, 2011 - 11:01 AM



Joined: Mar 09, 2011
Posts: 916

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.

_________________
Tony
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits