maven_logo_1024

Launch a Maven build with a temporary empty local repository

Sometime you may want to check that your Maven build is passing with an empty repo.

To “quickly” (not so quickly as Maven will download all the earth) do it you can just call such command (that you may reuse in a shell alias or function) : REPO_PATH=/tmp/local-repo-$(date +"%m%d%Y-%H%M%S"); mkdir -p $REPO_PATH; mvn clean install -Dmaven.repo.local=$REPO_PATH

HTH

GD Star Rating
loading...
GD Star Rating
loading...
Launch a Maven build with a temporary empty local repository, 9.0 out of 10 based on 1 rating

2 thoughts on “Launch a Maven build with a temporary empty local repository”

  1. I never though to use `date` in my temp repository names, Thanks.

    You don’t need to `mkdir` your new repository. If it doesn’t exist, Maven will create it for you. Also, put the `date` command in a variable is not necessary. It could have been fun if we could put the `REPO_PATH` in environment variable but in that case, `date` is only executed when we set the variable. So `mvn clean install -Dmaven.repo.local=/tmp/repo-$(date +”%m%d%Y-%H%M%S”)` could be enough, no?

    GD Star Rating
    loading...
    GD Star Rating
    loading...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>