pom file not installed in repo #1

Closed
metajack opened this Issue Jan 5, 2012 · 9 comments

Projects

None yet

5 participants

@metajack

Perhaps I'm misunderstanding the purpose of this plugin, but installing something in the localrepo does not also install the pom file. This means that while maven can find the specific artifact, it cannot figure out the transitive dependencies.

Am I doing something wrong, or is this an unintentional omission?

@kumarshantanu

This plugin is meant for installing only freestanding artifacts, such as closed-source JAR files (provided by proprietary vendors) or artifacts not available on some Maven repo to the local repository. Should the artifact need dependencies, you must mention them in the :dependencies or :dev-dependencies in your project.clj file.

Transitive dependencies are always mentioned by a human in a pom file, something that the plugin cannot infer on its own even if it were to auto-generate the POM file based on groupId, artifactId and version. A POM file without dependencies and other information would not be useful to anybody - hence that is not auto-generated.

Is there a use-case that can benefit from the auto-generated POM file? Or do you already have the pom.xml file for the artifact you want to install?

@metajack

I have two leiningen projects, one which depends on the other. Neither of these projects is ready for publishing yet, so they do not exist on clojars. I just want to specify the dependency in the toplevel project and have lein deps do the right thing.

I have a pom file generated by leiningen, and if I copy this alongside the jar that localrepo installs (and rename it appropriately) everything works as expected. It seems like it would be relatively easy for localrepo to copy the pom as well if the artifact is from the leiningen project.

Is there some other way these kind of dependencies should be resolved?

@kumarshantanu

Okay, that is a missing feature then. Will take up in the next version.

BTW, you can run lein install on the dependency project to have it installed to your local repo too. Is that something that works for you?

@metajack

lein install does exactly what I wanted. I'm not sure how I missed that. Thanks much for that pointer.

Perhaps the best fix for localrepo is just to document the difference in behavior so that if anyone runs into this they will see immediately the right way to do it.

@mrowe

"Is there a use-case that can benefit from the auto-generated POM file?

Yes, I believe there is. I have a proprietary JAR that has no dependencies of its own, I just want to use it in my project. (It's an SDK for a hardware product.)

lein localrepo install puts the JAR in ~/.m2 correctly, but without a POM. And with no POM, lein doesn't seem to be able to find the library in the repo.

@kumarshantanu

@mrowe Which version of Leiningen are you using? It has worked for me and several other people so far. It would help if you can let me know how to reproduce the issue you described. Also, I will add in the POM support in the next version.

@mrowe

I'm using Leiningen 2.0.0-preview7 (current as of this week I believe). The steps I followed were:

lein localrepo coords ~/tmp/fit-2.00.jar  | xargs lein localrepo install

and add to my project.clj:

:dependencies [
             [org.clojure/clojure "1.4.0"],
             [fit/fit "2.00"]
             ]

which failed until I created a minimal ~/.m2/repository/fit/fit/2.00/fit-2.00.pom

@paxan

Hi, I haven't noticed this issue, before I submitted #3. Take a look at that pull request, please.

Basically in my case, I had dependency on elasticsearch which is not published via Maven mechanism. But it has perfectly well-formed POM file that has all dependencies that are in Central.

My fix provides a simple mechanism to install the POM alongside the jar file. All you do is make sure you have foo-1.2.3.pom right next to foo-1.2.3.jar and when you do lein localrepo install foo-1.2.3.jar grp/art_id 1.2.3, it will install both the jar and the pom.

@kostafey

I have clojure-complete-0.2.2.jar and clojure-complete-0.2.2.pom files in the same directory.
When I run lein localrepo install clojure-complete-0.2.2.jar clojure-complete/clojure-complete 0.2.2
the ony clojure-complete-0.2.2.jar occurs in the
~/.m2/repository/clojure-complete/clojure-complete/0.2.2/ folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment