30
votes

In general, what is the best strategy for finding the groupId and artifactId for a well-known dependency for use in a Maven POM? For example, how would I find the correct entry for the MySQL JDBC driver? It's not mentioned on the mysql.com site, so I would usually spend time looking for another POM that already uses the Maven repository version of the jar. This can't be the best way.

7

7 Answers

11
votes
10
votes

M2Eclipse, the maven integration of eclipse, supports local searchable indexes of maven repositories. So you can right-click a project or a pom.xml and do

Maven -> Add Dependency

A dialog appears where you can search for artifacts from your local indexes. Wouldn't want to miss it.

If that's not an option, use mvnrepository.com

2
votes

Most of the time my IDE does this for me. But when I'm not sure I search manually; Google really helps.

You can also search on maven search engines like this mvnrepository.com.

1
votes

Maven site suggests to browse biblio to get maven co-ordinates; http://www.ibiblio.org/ .

Say for log4j

First, we need to know what the groupId, artifactId, and version are for log4j. We can browse ibiblio and look for it, or use Google to help by searching for "site:www.ibiblio.org maven2 log4j".

Maven metadata for log4j: http://mirrors.ibiblio.org/maven2/log4j/log4j/maven-metadata.xml

0
votes

In my experience the best option is mvnrepository.com. for example in your case, just type mysql in the search text field. you will find all available artifacts that contain mysql string. in your case the one fit your needs is: mysql-connector-java for each artifact you have a general description that helps you decide what is best for you. once you click it you get all the available versions and once you click on a version you have all sort of information about it like the code you need to add to your pom.xml, the artifact dependencies and so on...

0
votes

1. Go to http://search.maven.org

2. Search in the required jar with groupId/artifactId or Just with basic text.

Like for your case

enter image description here