Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Maven archetype from local JAR and POM, and also update local catalog

Tags:

maven

I want to distribute a custom archetype JAR and POM, without deploying them to a Maven repository, so that someone can grab them and install in their local repository with something like a mvn install:install-file -Dfile <file> -DpomFile <pom>.

But if one just does:

mvn install:install-file -Dfile=./my-archetype-1.0.jar -DpomFile=./my-archetype-1.0.pom

the local catalog doesn't get updated.

Though there are similar questions like this, this and this, they left me missing a small step.

I'm not sure how to run the mvn archetype:update-local-catalog that they mention. Where's the pom.xml?

like image 455
Scott Kurz Avatar asked Jul 20 '16 20:07

Scott Kurz


1 Answers

Simply run mvn -f <archetypePomFile> archetype:update-local-catalog doing a mvn -f pointing to the archetype pom.

So altogether it's:

  1. Install archetype

    mvn install:install-file -Dfile=./my-archetype-1.0.jar -DpomFile=./my-archetype-1.0.pom
    
  2. Update local catalog

    mvn -f my-archetype-1.0.pom archetype:update-local-catalog
    

Maybe that's obvious to others reading the doc but I spent enough time on this that I thought I'd write it up.

like image 154
Scott Kurz Avatar answered Nov 17 '22 01:11

Scott Kurz