【问题标题】:installing 3rd party JARs安装第 3 方 JAR
【发布时间】:2018-02-26 19:10:58
【问题描述】:

我在 Eclipse 中有一个名为 TdkUtils 的 maven 项目,带有这个 pom.xml: 这是一个实用程序项目。所以我想创建一个jar,放到repository中,在其他项目中使用。

...
<groupId>com.tdk</groupId>
  <artifactId>tdkUtils</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>tdkUtils</name>
...

但是我在安装插件时遇到了这些错误:

MacBook-Pro-de-nunito:tdkUtils nunito$ mvn install:install-file -Dfile=target/tdkUtils-0.0.1-SNAPSHOT.jar
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building tdkUtils 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ tdkUtils ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.353 s
[INFO] Finished at: 2017-09-18T11:29:58+02:00
[INFO] Final Memory: 9M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project tdkUtils: 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

【问题讨论】:

  • 你确定你的 pom.xml 的语法对吗?

标签: java maven spring-boot maven-2 maven-3


【解决方案1】:

您可以在没有 pom.xml 的情况下将 jar 安装到本地 repo,如下所示: mvn install:install-file -Dfile=target/tdkUtils-0.0.1-SNAPSHOT.jar -DgroupId=com.tdk -DartifactId=tdkUtils -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

【讨论】:

    【解决方案2】:

    如果您只是在与 util pom.xml 文件相同的目录中执行 mvn install,maven 会将 jar 文件安装到用户的本地存储库中。

    之后,该jar文件可以被其他项目的同一用户使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-13
      • 1970-01-01
      • 2018-02-05
      • 1970-01-01
      • 1970-01-01
      • 2016-12-10
      • 1970-01-01
      • 2010-10-21
      相关资源
      最近更新 更多