0

I am using apache maven 3.1.1. I was trying to install a 3rd party Jar file in my local repository using the following command

mvn install:install-file -Dfile=<path-to-file>

However, I am getting an error saying there is no Pom file in the current directory where the maven is ran from. According to Maven install plug-in if the jar file is created using Maven it will have POM xml in it (and in this case the POM is there in the jar file in a sub-dir of META-INF) and you will not need to supply the path to the POM file.

Did I miss something here?

Here is the error.

$ mvn install:install-file -Dfile=JDBM-3.0-alpha2.jar -ex
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.076s
[INFO] Finished at: Fri Nov 29 22:23:58 EST 2013
[INFO] Final Memory: 5M/147M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this     directory (/home/ars/Downloads). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/home/ars/Downloads). Please verify you invoked Maven from the correct directory.
atorg.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]     http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
AR5HAM
  • 1,220
  • 11
  • 19
  • Does `mvn -X install:install-file -Dfile=JDBM-3.0-alpha2.jar` give you more information? – Elliott Frisch Nov 30 '13 at 04:11
  • Yes here is the error part of the debug info with the -X flag turned on: [ERROR] Failed to execute goal org.apache.maven.plugins:maven- install-plugin:2.4:install-file (default-cli) on project standalone- pom: The artifact information is incomplete or not valid:[ERROR] [0] 'groupId' is missing. [ERROR] [1] 'artifactId' is missing. [ERROR] [2] 'packaging' is missing. [ERROR] [3] 'version' is missing. [ERROR] -> [Help 1] – AR5HAM Nov 30 '13 at 04:20

1 Answers1

2

I know this question is quite old but this is what works for me:

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

By fully specifying the plugin, you can get around not having a project POM in that directory.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
Alexander Aavang
  • 209
  • 3
  • 11