maven - 使用 pom 安装 Maven jar 到本地存储库

标签 maven

我有一个旧 jar (jsf-api-2.0.2.jar)。在这个 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

最佳答案

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

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

关于maven - 使用 pom 安装 Maven jar 到本地存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21497607/

相关文章:

java - License Maven Plugin更改第三方的许可证名称

maven - “mvn -P”有什么作用?

Spring boot starter parent 2.0.0 未找到依赖项

java - Maven 程序集插件 NoClassDefFoundError

java - net.sf.jasperreports.engine.JRRuntimeException : Could not load the following font

java - 如何获取 Maven 插件的当前执行情况?

java - 是否有可用的 Google App Engine 源代码和 JavaDoc JAR bundle ?

scala - 从SBT发布到本地Maven存储库

java - m2Eclips 集成错误

java - 抛出异常时 IT 测试不会失败 Arquillian TestNG maven