• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Eclipse and Maven: How I know which dependency I have to put in the project

 
Ranch Hand
Posts: 591
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI, I would like to know how can I know when I have an error at runtime, if there is a rule of thumb to understand that the error is due to a missing dependency. The IDE does not adress me at the dependency that I need. Also I would like to know how can I know which dependency implement every time. Should i look up everytime in the internet or should i go through the extensive documentation? I find the documentation great, but if there would be a kind of cheatsheet just to understand which dependency i have to add in a particular context would be great, because I am afraid this is the best way to prevent errors, in the machine. THank you and sorry for the apparent ingenuity of the question, for me represent a considerable obstacle at this newbe stage.
 
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not quite sure what you are asking, and you probably already know this, but Maven will search the web for you and pull in any classes you need on the fly. So if you would need to use an import statement for a class or package, this is when you would want to add a dependency to your pom.xml file.

Sorry for the simplified answer, maybe a second pass at asking the question would help to understand what the issue is?
 
Giovanni Montano
Ranch Hand
Posts: 591
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sal jefferson wrote:I am not quite sure what you are asking, and you probably already know this, but Maven will search the web for you and pull in any classes you need on the fly. So if you would need to use an import statement for a class or package, this is when you would want to add a dependency to your pom.xml file.

Sorry for the simplified answer, maybe a second pass at asking the question would help to understand what the issue is?


Thank you for your interest. I have three challenges to overtake to understand the core spring concepts using an IDE as Eclipse, and one of this is to understand the errors of the compiler at runtime, and one that left me a bit baffled was when I was missing to add a dependency ad the pom project, and this is the reason why I am asking which dependencies need to be implemented.

For Example I do not recognize the console error if i call the db without having jdbc. Or the same in an hallo world program if i miss spring-core or spring-context. Troubleshooting that was difficult. Instead I understood that I have to use an approach not logical based on the simple common sense, but LEARN which dependencies are needed for a specifical steps on a cheatsheet. Now with the practice I am getting better and i know for instance that if I am deploying a web service probably should add for instance spring web and spring webmvc

But know giggling around a bit, changing randomly the values in my projects I am understanding which behaviour cause which error.
Said that I found really difficult that when there is an exception, if I google the exception it appears on the internet not a way I could manage that exception in general, and what are the root causes, but dozens of pages that trait only one specific user error log case.
 
sal jefferson
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I miss spoke in my first response. I said if you need to import a class or package, what I meant to say was if you have to download a .jar file and add that to your class path, use Maven instead. You will still need to use import statements, but with Maven, you do not want to download .jar files and add them to the project. This is wha Maven is for.
 
Giovanni Montano
Ranch Hand
Posts: 591
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sal jefferson wrote:I miss spoke in my first response. I said if you need to import a class or package, what I meant to say was if you have to download a .jar file and add that to your class path, use Maven instead. You will still need to use import statements, but with Maven, you do not want to download .jar files and add them to the project. This is wha Maven is for.


thank you this was clear from the beginning, I need just to get familiarity with this new environment, I recognize mine was really a stupid question after few days. The official documentation is overwhelming to me, so now i found some tutorial more synthetic and simple, and I will use the documentation only to dive into particular topics. Thank you again Sal


 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finding the JAR that contains a particular class is a common enough problem, especially with large frameworks that split up their classes into multiple JAR modules (Spring and Lucene are the examples that jump to my mind) .
What I do is I use JBoss's Tattletale command line tool.
Just run it on a directory containing all the framework's JARs to generate a HTML report. Every class and its container JAR gets listed in that report.
 
Saloon Keeper
Posts: 26538
187
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another options with Eclipse is that the Maven jars will all list in the Project pane and can be expanded to show what's in them. Usually you have a pretty good guess what jars to look at. For example, an org.springframework class isn't likely to be found in a com.sun jar.

A bgger problem is keeping Eclipse and Maven in sync. If the POM has a dependency reference, but the Eclipse project hasn't detected it, you can get IDE error displays for stuff that will compile perfectly from Maven. The reverse is less common, but no less true.

Sometimes, however, I think that getting this desired state of affairs is more art than science. I've been known to have to thump things a few times before they all line up.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic