Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] Disabling artifact installation to local-repo?

Hi Manfred,

Thanks for the reply. I cannot do as you suggest because I don't control the artifacts.

As I mentioned in my previous mail, I'm working on Cursive, an IDE for working with Clojure code based on IntelliJ. When Cursive users open a Leiningen project, I call lein for each module (which corresponds to a lein/Maven/Aether artifact) to resolve its dependencies via Aether and attach the artifacts from those dependencies to the module as libraries so that symbol resolution works correctly. This all works fine in simple cases.

However in more complex projects, they are generally made up of multiple lein/Maven modules with dependencies between them. If the user opens one of these projects for the first time before compiling it, the resolution will fail for the modules which depend on other modules from the project because the dependencies are not installed in the local repo yet and may not be published anywhere public. Since the resolution fails, Cursive cannot attach any libraries to the modules and nothing works in the IDE.

In addition to the on-first-open use case, when working with these projects it's useful for the IDE to be able to resolve modified code across modules without requiring the user to continually compile and install the dependent modules into their local repo. I do this by adding dependencies between the IntelliJ modules and removing the library dependencies for the inter-module dependencies within the project.

Currently I achieve all this by fiddling with the project.clj (lein's equivalent to a pom) before calling into lein. I collect all the project.clj files for the whole project, work out the dependencies between them and remove those dependencies from the project.clj files before passing them to lein. However this has subtle side effects, mostly that occasionally the incorrect version of a dependency will be attached - I assume this is due to slightly different versions of dependencies coming out of the transitive dependency calculations with some of the dependencies removed. I'd like to avoid this, and the temporary repository solution I described seems like a cleaner solution to this.

Obviously this is all very complicated - if I'm missing a simpler solution to it, I'd love to hear it.

Cheers,
Colin

On 7 August 2015 at 23:31, Manfred Moser <manfred@xxxxxxxxxxxxxxxx> wrote:

Why are you trying to do that? 

In the Maven world if you dont want users to have to compile and install dependencies you just ensure that they are available via a remote repository.

E,g, a CI build creates them automatically and installs them into a repository manager like Sonatype Nexus. 

Then any other build that needs it just downloads them.

The same works with Leiningen. What is the problem you are trying to solve with your approach? 

manfred

Colin Fleming wrote on 2015-08-07 14:13:

I dug into the code a little bit to see if I could figure out how this works. I was hoping to be able to have a DelegatingLocalRepositoryManager which accepted two local repos and read from both but only wrote to one, but I don't think it's possible. LocalRepositoryManager seems to only handle relative paths which are then calculated relative to its LocalRepository, of which there can be only one. And the LocalRepository doesn't know the context for which it's being called, so I can't mock anything out there. I also couldn't see a way to use a custom RemoteRepository for this - perhaps there's no way to do what I want?
 
Cheers,
Colin
 
On 7 August 2015 at 18:12, Colin Fleming <colin.mailinglist@xxxxxxxxx> wrote:
Hi all,
 
I'm working on a Clojure IDE which uses Leiningen, a Clojure build tool, which uses Aether under the hood. The IDE resolves the Leiningen artifacts and then adds their dependencies as libraries to the project. I'm trying to develop some functionality to help users work with projects containing multiple interdependent Leiningen artifacts (each of which is an Aether artifact) without having to have them compiled and installed into their local repo.

In order to do this, I'm deploying fake artifacts from the project (empty jars) to a temporary repository on the file system. I then put the temporary repository first in the list of repositories I pass to Aether, and everything resolves correctly. The fact that the jars for the artifacts from the project are fake doesn't matter, since I trim them out and don't add libraries for them.
 
The one issue I can't solve is that when artifacts are resolved from the temporary repository, they're cached in the local ~/.m2 repository. Is there any way to disable this for a particular repo or for particular artifacts? Or can I set up multiple local repositories such that writes go to the first (temporary) one but reads pass through to the second (~/.m2) one?
 
Thanks for any advice,
Colin

 

_______________________________________________
aether-users mailing list
aether-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aether-users


Back to the top