Can Maven use a git repo as a dependency?

Skip to first unread message

Moandji Ezana

Dec 30, 2012, 3:10:09 AM12/30/12
to illegalargument

In Ruby's Bundler dependency management system, you can use a local path or a remote git/github repo as a dependency.

Build reproducibility is assured because Bundler records the commit ID when the dependency is introduced or updated.

Is this possible in Maven, either natively or via a plugin?

I was thinking of something that would automate the clone & install steps you currently have to do to use an unpublished artifact from Github.


Mark Derricutt

Dec 30, 2012, 3:16:36 AM12/30/12
What you want is essentially what was proposed as the git-workspace-plugin, with some design docs up on the Maven wiki [1], I believe some experimental code had been thrown together but the effort got sidetracked with other things getting in the way.

I've been meaning to chase it up and see if there's currently any code available anywhere for hacking on.

Essentially the aim of the workspace plugin is to have something a bit more saner than, and more maven-like than git submodules - useful for projects that are spread out over several separate repositories.


Moandji Ezana

Jan 12, 2013, 5:54:53 AM1/12/13
to illegalargument

Thanks for the pointer, but to be honest, I barely understand what the wiki is saying.

My usecsase is just to automate what I'm doing manually:

1. grab latest from a Git repo, generally a snapshot, and install it so other projects can depend on it
2. Push a project to github, which depends on other artifacts that exist only in other Git repos. To make it easy for others to use this project, I wouldd like them to be able to execute step 1 via a Maven plugin.

I was thinking about this today, would the following make sense:

- In pom, depend on unpublished artifacts, found in a Git repos.
- In pom plugin, list those repos (and optionally branch/tag to pull from, like Bundler does).
- Other user clones my repo, then runs mvn git-dependencies.
- The listed repos are cloned somewhere and mvn install run against each one.
(Insert caveats about dependencies already in local .m2, ability to force updates, etc. Again, like Bundler.)

Is this madness? Maybe I just write too much code that I never bother releasing to Central...


Reply all
Reply to author
0 new messages