Home > database >  Error "The Specified Jar file not exists" when executed mvn install:install on my local ja
Error "The Specified Jar file not exists" when executed mvn install:install on my local ja

Time:05-06

I have a jar file local to my project and I need to install the jar as a 3rd party file or just install this jar using mvn install:install command so that the jar will be available in .m2 folder (under repositories) and later I can declare the dependency in pom.xml which will not throw error, tried to execute in different ways but throws the below error.

Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.5 .2:install-file (default-cli) on project sampl-project: The specified file 'E:\sample-11.jar' not exists

The below combinations I tried to run mvn install:install but failed miserably.

mvn install:install-file -DgroupId=sample.groupId -DartifactId=samplefields -Dpackaging=jar -Dversion=11 -D file=E:\sample-11.jar -DgeneratePom=true

mvn install:install-file -DgroupId=sample-groupId -DartifactId=samplefields -Dpackaging=jar -Dversion=11 -D file=E:\sample-11.jar -DgeneratePom=true

mvn install:install-file "-DgroupId=sample.groupId" -DartifactId=samplefields -Dpackaging=jar -Dversion=11 -D file=E:\sample-11.jar -DgeneratePom=true

mvn install:install-file "-DgroupId=sample.groupId" "-DartifactId=samplefields" "-Dpackaging=jar" "-Dversion=11" "-D file=E:\sample-11.jar" "-DgeneratePom=true"

Further, I also tried to place my jar in different locations and different names and run maven install:install but same error I get

enter image description here

Maven Version -

Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)

Links I gone thru, but they are of different issue: enter image description here

CodePudding user response:

  1. In this error you see that the name of the artifact is not found :

the specified file 'E:\ -11.jar' not exists.

  1. make sure that you have the permission to copy this file.

  2. for all commands, i see that you have an space between -D and the file=E:\sample-11.jar.

So you shoud remove the space and run the command line like this :

mvn install:install-file -DgroupId=sample.groupId -DartifactId=samplefields -Dpackaging=jar -Dversion=11 -Dfile=E:\sample-11.jar -DgeneratePom=true
  • Related