Is there a nice easy way to find out the Maven information for a library specified in an import statement in Java code?
For example, if I see some random piece of Java code on the internet that looks useful (happens often!), and I want to copy it into a Maven project, how do I find out what that dependency information is (i.e. the groupId, artifactId and version) to place into the POM.xml file?
e.g. If I see this:
import wow.magiclibrary.net.*;
public class Magic
{
public static void main ( String[] args ) throws IOException
{
try
{
MagicLibrary ml = new MagicLibrary( args[0] );
ml.doSomethingAmazing();
...
... where can I find the information to put into the POM.xml file to make Maven download the wow.magiclibrary.net library as a dependency from whatever repository it comes from?
<dependency>
<groupId>wow.magiclibrary.net</groupId>
<artifactId>magiclibrary</artifactId>
<version>2.0.0</version>
</dependency>
Do I just have to use Google to search for a repo on the web that has the library, download jars manually and install them into my local maven repo?
Just curious. I'm lazy. I know I can do something like this after downloading a jar file:
mvn install:install-file -DgroupId=wow.magiclibrary -DartifactId=magiclibrary \
-Dversion=2.0.0 -Dpackaging=jar -Dfile=magiclibrary2.0.0.jar -DgeneratePom=true
... but if there was a way to automate the search and install process through Maven then that would rock.