That's a sticky problem. Manually-included JARs would simply go into the project resources folder and not even be mentioned in the POM. The POM dependencies control dynamic downloading of JARs that are not explicitly included in the project. But to do that, you need to know where the original copies are located.
First, you need to know the repository, if it's not the standard one.
Secondly, you need to know the group, artifact ID and version of each JAR that you want added to POM control.
I suppose this COULD be done. You'd need to build up a database, however, since the group and artifact IDs aren't easily predictable. Given that, you could create an app that scanned the project tree for JARs, ripped out the Maven-controlled ones, and added a corresponding dependency to the POM file. There are probably some subtleties beyond that, but that's the basics.
Customer surveys are for companies who didn't pay proper attention to begin with.
Sorry to jump into the middle of the conversation, but this thread is addressing one of my questions exactly. I am a total newb here, but Katrina Owen (who is a very active member) said this was THE place to find great help with Java, so here I am.
Is what you are saying true?
I used Maven1 about 15 years ago and was impressed with the approach. That was about the last time I wrote any appreciable Java code as well (been doing Smalltalk, C++, C#/VB.NET, PHP, Perl, and a bit of Python since then). Now I find myself in an architect role at a Java-shop, successfully recommending that we move away from Ant and toward Maven, which I am very excited about. BUT... I am having a hell of a time knitting the pieces together.
I have a very simple existing project called "library," which is exactly what it sounds like - a collection of classes defining commonly used functionality. It has no inter-project dependencies, but relies on several 3rd-party JARs (like dnsjava, commons-lang, jmagick, etc.). I have been trying to figure out (by scouring a dozen solid Maven-related websites, the O'Reilly "Maven - The Definitive Guide" and "Maven - A Developer's Journal" books) how to add these JARs as dependencies.
Am I just missing the point of a dependency from Maven's POV? Are these just resources? If so, how do we use Maven to manage them when new versions come out? For instance, the Maven Repository has dnsjava in it, but only up to 2.0.1, and we are using the 2.0.2 JAR.
Any illumination you or anyone else can shed on this would be tremendously helpful.
Thanks, and apologies if I stepped on any forum posting protocols here.
"It is our choices, much more than our abilities, that make us who we are."
- Albus Dumbledore
Yes from Maven's POV they are dependencies. If you cannot find them on the Maven central repo (or the couple of other major repos out there, e.g. Java.net and jboss) then you need to probably use a local repository manager. The two documents you mention discuss this, in particular Artifactory and Nexus are quite good.
Sorry if this posts twice... didn't look like my first attempt took.
Sorry to be so obtuse about this, but I think I am missing some key bit of information. I am using Nexus' Repo Manager and am connected to Maven Central, Apache Snapshots, and Codehaus, all of which are downloading remote indexes and added to Public Repositories. I will try adding Artifactory, JBoss, and Java.net as well.
I think what I am not getting is simply how you differentiate a "dependency" from a "resource." How do you?
I saw something (maybe in "Maven: The Definitive Guide") that said something to the effect that any local JARs should be placed in the resources folder of the project, but that seems counter-intuitive to Maven's handling of the dependency graph... And it brings up the question of what do you do when you cannot find a JAR in a repo using Maven coordinates? Do you throw your own copy of the JAR into the resources folder, or SHOULD it be added as a dependency?
For instance the project I am working on uses the JMagick JAR, but I cannot find it in the repos I have available. What is the common way (or best practice) for handling that?
Thanks for bearing with me on this. I really appreciate the help.
In this case you would manually add this to your local repository _via_ the repository manager (in your case Nexus). You'll add it with a group id, artifact id and version of your choice when you add it, Nexus should have a nice UI for you to do this and will create the extra meta data etc automatically. You then reference that jar in your pom like you would with any other dependency.
Joined: Oct 21, 2008
Ok, great. That is my understanding, but that blurb about resources threw me.
Are resources any non-archive project-related items like traditional C++ resources (images, config files, properties pages, etc.)?