technomancy/leiningen — Issue #328: Maven POM package dependencies don't resolve properly
Author: klauern
Created: 2011-11-16 05:16:18+00:00
State: open

I have an internal Maven server that I deployed a [POM packaing dependency][1], which basically groups a number of dependencies together which get resolved when the POM is downloaded and inspected.

I've done this for my own projects and for simpler reuse in some ugly enterprise apps, but I'd like to leverage the work for this in Leinginen. However, whenever I try to specify a dependency like this, it tries to download the `.jar` for it instead of resolving the `.pom`.

I can only guess that since this is a standard feature of Maven, there are other companies/corporations/projects/open-source-thingies that make use of this, but I thought I'd at least report it as something that I currently cannot do with Leiningen that would save me some time/trouble personally.

Here's some rather ugly output of what happens when I try to download the POM package dependency from my internal [Maven Nexus][2] server:

```cmd
PS C:\mydocs\Clojure\korma-emo> type .\project.clj
(defproject korma-emo "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]
[korma "0.3.0-alpha"]
;;[korma "0.2.1"]
[com.oracle/ojdbc6 "11.2.0.2.0"]
[klauer.pom.things.together/glommed-vendor-deps "4.6.00.0277"]
]
:dev-dependencies [
[swank-clojure "1.3.3"]
[vimclojure/server "2.3.0"]
]
:omit-default-repositories true
:repositories { "corporate-nexus" "http://mavenrepo:8081/nexus/content/groups/public/" }
)
```

now, the `klauer.pom.things.together/glommed-vendor-deps` is actually a `pom.xml` file and not a `.jar`, so what i see below when running `lein deps` immediately triggered to me that it either didn't know what to do or defaulted to `jar` downloads for everything.

```cmd
PS C:\mydocs\Clojure\korma-emo> lein deps
Downloading: klauer/pom/things/together/glommed-vendor-deps/4.6.00.0277/glommed-vendor-deps-4.6.00.0277.jar from corporate-nexus
Downloading: klauer/pom/things/together/glommed-vendor-deps/4.6.00.0277/glommed-vendor-deps-4.6.00.0277.jar from central
An error has occurred while processing the Maven artifact tasks.
Diagnosis:

Unable to resolve artifact: Missing:
----------
1) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

----------
1 required artifact is missing.

for artifact:
org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
central (http://mavenrepo:8081/nexus/content/groups/public/),
corporate-nexus (http://mavenrepo:8081/nexus/content/groups/public/)

Exception in thread "main" Unable to resolve artifact: Missing:
----------
1) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

----------
1 required artifact is missing.

for artifact:
org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
central (http://mavenrepo:8081/nexus/content/groups/public/),
corporate-nexus (http://mavenrepo:8081/nexus/content/groups/public/)

(NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: Unable to resolve artifact: Missing:
----------
1) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

----------
1 required artifact is missing.

for artifact:
org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
central (http://mavenrepo:8081/nexus/content/groups/public/),
corporate-nexus (http://mavenrepo:8081/nexus/content/groups/public/)

at org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.java:175)
at org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:678)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:90)
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:265)
at leiningen.deps$do_deps.invoke(deps.clj:134)
at leiningen.deps$deps.doInvoke(deps.clj:198)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:259)
at leiningen.core$_main.doInvoke(core.clj:325)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:328)
at user$eval291.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more
Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
----------
1) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=klauer.pom.things.together -DartifactId=glommed-vendor-deps -Dversion=4.6.00.0277 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) klauer.pom.things.together:glommed-vendor-deps:jar:4.6.00.0277

----------
1 required artifact is missing.

for artifact:
org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
central (http://mavenrepo:8081/nexus/content/groups/public/),
corporate-nexus (http://mavenrepo:8081/nexus/content/groups/public/)

at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:324)
at org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.java:170)
... 34 more
PS C:\mydocs\Clojure\korma-emo>
```

[1]: http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html#pom-relationships-sect-grouping-deps
[2]: http://nexus.sonatype.org/