views:

156

answers:

5

There's a Java library that I would like to use in my project. My project uses Maven to pull in dependencies and it works great for everything except this one library. The problem is, this library never has releases. The author maintains the source in a Subversion repository and only makes changes in trunk.

Is there a way I can tell Maven to

  1. Update (or check out) the library's source tree from Subversion
  2. Build it according to its POM
  3. Use the resulting jar as a dependency for this project
  4. Do this regularly (possibly at each build)
  5. For bonus points, mark which Subversion revision of that library I want to use

Thanks!

A: 

Wouldn't a much more simpler yet effective solution be the following:

  • you write a shell script/bat file that checks out the source, builds the artifact, and deploys to a maven repo under your control.
  • using a snapshot dependency you'll get a timestamp in the artifact ensuring that each build of your project is using the artifacts latest version and you won't have to update the pom.xml of your project at all.
  • you can use an ant task in your project's pom.xml that would hook into the project build cycle and execute the shell script that builds and deploy the artifact.
Bozhidar Batsov
A: 

Do the open source thing:

You could contact the author of the library. I bet he is happy to get some feedback. Let him know what you need, he might just do it. Alternatively offer help mavenizing the library or help with a release. This way other users profit too.

As a developer of some open source projects I like that kind of feedback.

openCage
A: 

If you don't control something, you can't... control it. So I would:

  • checkout the sources from the project repo
  • put them under version control in your vcs
  • build a release (and tag the library in your vcs)
  • distribute the released artifact through a corporate repository

You don't really want to automate this more than that (what if the author commits something that breaks your code, what if you need to fix a bug in a released version of your code but can't use the exact same library). Put it under source control and manage the release yourself.

Pascal Thivent
That sounds like the sensible thing to do. Would you maintain it separately or bring it in as a submodule?
Anonymouse
@Anonymouse Separately. You don't need to build it as part of your project, it would slow down things for nothing. Just use a binary dependency (on a jar).
Pascal Thivent
A: 

You can try to use Hudson, a Continuous Integration Solution, with its Subversion Plug-in to checkout the source periodically.

After Hudson succesfully check out the source, you can let it running a modified Ant script to build the source and deploy it to your local/remote Maven repository.

CRH
A: 

In the interest of having a reproducible build, I would recommend checking out and building the open source project yourself and installing it to your Maven repository. That way, you can refer to a specific version in your POM, so your build will always be reproducible.

Daniel