On mvnrepositry, when you search for a certain module, there's a link to download the binary. For some versions it has a pom.xml file available for download instead of the jar. What are you supposed to do with that pom.xml? It seems like if I specify a version that does not have a downloadable jar, but instead downloadable pom.xml, my maven build will fail. Is what I'm seeing correct?
2 Answers
Modules that only have pom files are maven modules with pom packaging. They are used to aggregate multiple modules into one unit. You can use such a module as a dependency for your maven project. Maven will download the pom file, analyze the dependencies included in that pom file and download those & add it to your automatically.
Even modules that have jars (jar packaging) have a pom file associated with them. This pom file defines the other dependencies that are required for using it. Maven will automatically process and fetch those dependencies (transitive dependencies).
This makes specifying and managing dependency for any project. You will specify the top level modules that your projects directly depends on and other things required will automatically figured out and downloaded. It also makes it easier when you have upgrade to a new version - all the transitive dependencies will get upgraded automatically.

- 20,777
- 4
- 60
- 57
-
But right now it seems like if I use a module with pom files only in my pom.xml, I can't do a successful build with `mvn install`. Is that expected or I'm doing something wrong? – Glide May 31 '13 at 07:12
-
1No it should not give an error. Check the pom file - does it have packaging element as pom are something else. If it is something other than pom then the entry in the repository is wrong. Can you add details of dependency that is causing an issue - groupId/artifactId/version. – gkamal May 31 '13 at 07:19
-
@gkamal there are lots of case that there is only a POM but not JAR, but that POM is not in "pom" type. e.g. http://search.maven.org/#artifactdetails|jta|jta|1.0.1b|jar – Adrian Shum May 31 '13 at 07:57
-
This is a redirect - there is a relocation element that points to http://search.maven.org/#artifactdetails%7Cjavax.transaction%7Cjta%7C1.0.1B%7Cjar which unfortunately doesn't have the jars. Use 1.1 or use an alternate repo - http://stackoverflow.com/questions/9003298/missing-javax-transaction-jta-artifact. – gkamal May 31 '13 at 08:09
-
@AdrianShum I don't get your comment about "there is only a POM but not JAR, but that POM is not in "pom" type" Why do you mean by there is only a POM but not JAR? – Glide May 31 '13 at 22:38
One of the reason that cause this is because of licensing issue.
License for such JARs prohibit public redistribution in such approach. So someone provide only the POM so that you can get the JAR yourself and install it to your local maven repo/ internal repo, together with the POM provided.

- 38,812
- 10
- 83
- 131
-
So in order to get those jars from the maven repository, I would have to download the pom provided manually and then call mvn install on it? Also, if the maven repository only provide the pom file, that will prevent from me specifying that dependency in my pom.xml? – Glide May 31 '13 at 07:09
-
The preferred way is: 1. Have a local maven repo (e.g. nexus), 2. Download the corresponding JAR, 3. Download the POM 4. Deploy the JAR + POM to your local maven repo. For your last question, I don't quite get your meaning, but things will go smooth if you deployed the JAR in your repo in Maven, you are searching from the repo. – Adrian Shum May 31 '13 at 07:55
-
Of course, you need to make sure that the POM is actually of type JAR instead of POM – Adrian Shum May 31 '13 at 07:58
-
Sorry for not being clear. My last question was that, if module I need in the central maven repository has `
pom ` then in order to get it to work, I just have to specify `pom ` in `` for that module in my pom.xml, right? – Glide May 31 '13 at 22:35 -
1@Glide Yes, you are right. Type by default is "JAR". "POM-type POM" and "JAR-type POM without actual JAR" are two different scenarios though. You need to be clear on which scenario you are dealing with. – Adrian Shum Jun 03 '13 at 06:20