Home > Enterprise >  Maven Local file installation
Maven Local file installation

Time:09-27

I am trying to install a local jar file to be used as a dependency using the following command

mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=<path-to-file>

Getting the following result

The goal you specified requires a project to execute but there is no POM in this directory

CodePudding user response:

To install the file in the local maven repository, you have to provide also the group ID, artifact ID, and the version for that file. Without them, Maven does not know in what directory to store the file.

See also: https://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html.

CodePudding user response:

Maven need the so called GAV coordinates: groupId, artifactId, version and packaging to store the artefact.

You can name them wiht the install command

mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file 
   -Dfile=<path-to-file> 
   -Dpackaging=jar
   -DgeneratePom=true
   -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version>
  • Related