0

I am doing some project based in Spring framework and using maven for building. I need to clear some understanding for the following concepts:

Basically i referred to spring.io's quick guide (sample codes as how-to).

1) If we have an import statement e.g.import org.springframework.stereotype.*,how do we know what maven artifacts we have to provide in pom.xml?

2) Given an import statement e.g. above, how do we know which jar (and hence the artifacts) we have to use in as maven dependency. The short cut that i think of is to use a shell script which does jar -xvf and does look for the package which matches which the import statement in the code.

Any answers highly appreciated.

Thanks!

CuriousMind
  • 8,301
  • 22
  • 65
  • 134
  • possible duplicate of [Maven - How to find correct groupId/artifactId to include dependency in POM](http://stackoverflow.com/questions/3565889/maven-how-to-find-correct-groupid-artifactid-to-include-dependency-in-pom) – Joe Sep 06 '14 at 13:41

1 Answers1

0

1) If we have an import statement e.g.import org.springframework.stereotype.*,how do we know what maven artifacts we have to provide in pom.xml?

2) Given an import statement e.g. above, how do we know which jar (and hence the artifacts) we have to use in as maven dependency. The short cut that i think of is to use a shell script which does jar -xvf and does look for the package which matches which the import statement in the code.

use findjar.com and then determine GAV parameters OR use http://search.maven.org/#advancedsearch|gav type in class name

jmj
  • 237,923
  • 42
  • 401
  • 438
  • Thanks for your reply. I tried to do this search for "org.springframework.stereotype.Controller", however didn't get any result (search.maven.org). Is there any other method or we have to restore to hit and trial method? – CuriousMind Sep 05 '14 at 19:58
  • I ran the same search and it returned : http://search.maven.org/#search|ga|1|fc%3A%22org.springframework.stereotype.Controller%22 – jmj Sep 05 '14 at 19:59
  • Thanks for your info. Is there any other way we can get this info, or we have to look into net to get the info? – CuriousMind Sep 05 '14 at 20:04
  • its a central maven repository GUI with search feature, you can look it up as well or ask it up here – jmj Sep 05 '14 at 20:05