簡體   English   中英

Maven安裝第3方Jar文件

[英]Maven installing 3rd party Jar file

我正在使用Apache Maven 3.1.1。 我試圖使用以下命令在本地存儲庫中安裝第3方Jar文件

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

但是,我收到一條錯誤消息,說運行maven的當前目錄中沒有Pom文件。 根據Maven 安裝插件,如果使用Maven創建jar文件,它將在其中包含POM xml(在這種情況下,POM位於META-INF子目錄中的jar文件中),您將不需要提供POM文件的路徑。

我在這里想念什么嗎?

這是錯誤。

$ 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

我知道這個問題已經很老了,但這對我有用:

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

通過完全指定插件,您可以避免在該目錄中沒有項目POM。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM