Using Maven to build a JAR from source in the Subversion trunk

There is a Java library in there that I would like to use in my project. My project uses Maven to hang up and it works great for everything except this library. The problem is that there are never any releases in this library. The author maintains the source in the Subversion repository and makes changes to the trunk.

Is there any way I can tell Maven to

  • Update (or check) the original library tree from Subversion
  • Build it according to your POM
  • Use the resulting jar as a dependency for this project
  • Do this regularly (possibly with every build)
  • For bonus points, check which version of Subversion for this library I want to use

Thank!

+2


source to share


5 answers


If you don't control anything, you cannot ... control it. So I would:

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


You really don't want to automate this any more than that (what if the author does 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 same library). Place it under source control and manage the release yourself.

0


source


It wouldn't be a much simpler but effective solution to be the following:



  • you write a shell script / bat file that checks the source code, builds the artifact and deploys to a maven repo under your control.
  • by using the snapshot dependency, you will get a timestamp in the artifact, ensuring that every build of your project uses the latest version of the artifacts and you don't have to update your project's pom.xml at all.
  • you can use the ant task in the pom.xml project, which will hook into the project's build loop and execute a shell script that builds and deploys the artifact.
0


source


Make the source code:

You can contact the author of the library. I bet he's happy to get feedback. Let him know what you need, he can just do it. In addition, you can help master the library or help with the release. In this way, other users also make a profit.

As a developer on some open source projects, I like this kind of feedback.

0


source


You can try using Hudson, a continuous integration solution, with the Subversion Plug-in to check the source periodically.

After Hudson has successfully checked out the source, you can let him run a modified Ant script to create the source and deploy it to your local / remote Maven repository.

0


source


In the interest of creating a reproducible build, I would recommend checking out and building the open source project yourself and installing it into your Maven repository. This way you can reference a specific version of your POM, so your assembly will always be reproducible.

0


source







All Articles