将带有pom的Maven jar安装到本地存储库中

时间:2014-02-01 11:46:17

标签: maven

我有一个旧罐子(jsf-api-2.0.2.jar)。在这个罐子里有一个/META-INF/maven - 文件夹。

如何将jar安装到本地存储库中?

install:install-file说我需要自己指定artifactId。如何强制它使用jsf-api-2.0.2.jar!\META-INF\maven\com.sun.faces\jsf-api\pom.xml中的信息?

输出:

mvn install:install-file -Dfile=jsf-api-2.0.2.jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.410s
[INFO] Finished at: Sat Feb 01 12:52:34 CET 2014
[INFO] Final Memory: 13M/368M
[INFO] ------------------------------------------------------------------------
[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]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoExecutionException

1 个答案:

答案 0 :(得分:4)

参见http://maven.apache.org/plugins/maven-install-plugin/examples/custom-pom-installation.html 只需确保您至少使用了2.5版,它引入了此功能。

顺便说一句:目标是install-file,而不是install-jar