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.
Maven uses a set of identifiers, also called coordinates, to uniquely identify a project and specify how the project artifact should be packaged: groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project.
artifactId is the name of the jar without version. If you created it, then you can choose whatever name you want with lowercase letters and no strange symbols. If it's a third party jar, you have to take the name of the jar as it's distributed.
Maven Dependency Tree in Eclipse IDExml “Dependency Hierarchy” tab shows the dependency tree of the project. It has two sides - the left side shows verbose output and the right side shows the resolved dependencies. We can use the “Filter” option to look for a specific dependency.
Sometimes it makes more sense to group similar dependencies together and reference a pom dependency. This way, your project can reference as many of these consolidated dependency POMs as it needs. Maven uses the depth of a dependency in the tree when resolving conflicts using a nearest-wins approach.
Maven uses the depth of a dependency in the tree when resolving conflicts using a nearest-wins approach. Using the dependency grouping technique above pushes those dependencies one level down in the tree. Keep this in mind when choosing between grouping in a pom or using dependencyManagement in a parent POM
One of Maven’s main jobs is to handle your Java project’s dependencies. So when Maven runs, it builds a “tree” of all dependencies in your project. If you tell Maven to print a dependency tree, you will be able to see all of the dependencies in your project. Drop to a terminal.
For example, the entire Maven core runs through a single base POM org.apache.maven:maven, so building the Maven project can be executed by a single command: mvn compile. However, an aggregator project and a parent project are both POM projects, they are not one and the same and should not be confused.
I would suggest to use http://search.maven.org
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With