简体   繁体   English

安装第三方JAR

[英]installing 3rd party JARs

I have a maven project in Eclipse called TdkUtils, with this pom.xml: This is a utils project. 我在Eclipse中有一个名为TdkUtils的maven项目,带有以下pom.xml:这是一个utils项目。 So I want to create a jar, put it in the repository and use it in another projects. 因此,我想创建一个jar,将其放入存储库中,并在其他项目中使用它。

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

  <name>tdkUtils</name>
...

But I got these errors when installing the plugin: 但是在安装插件时出现了以下错误:

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

If you just execute mvn install while inside the same directory with the util pom.xml file, maven will install the jar file into local repository for the user. 如果只是在与util pom.xml文件位于同一目录中执行mvn install ,则maven会将jar文件安装到用户的本地存储库中。

After that, the jar file can be used by the same user from other projects. 之后,同一用户可以从其他项目中使用jar文件。

您可以像这样不使用pom.xml将jar安装到本地存储库: mvn install:install-file -Dfile=target/tdkUtils-0.0.1-SNAPSHOT.jar -DgroupId=com.tdk -DartifactId=tdkUtils -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM