将第3方库添加到Maven存储库并在项目中使用

时间:2018-11-17 11:21:48

标签: java eclipse maven

尝试在Java Eclipse Maven项目中使用第三方库。

将库安装到本地jar存储库:

mvn install:install-file -Dfile="C:\Projects\eclipse_ide_workspace\CAENRFIDLibrary.jar" -DgroupId=caen  -DartifactId=CAENRFIDLibrary -Dversion=1 -Dpackaging=jar

看起来不错的输出:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing C:\Projects\eclipse_ide_workspace\CAENRFIDLibrary.jar to C:\Users\vico\.m2\repository\caen\CAENRFIDLibrary\1\CAENRFIDLibrary-1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.472 s
[INFO] Finished at: 2018-11-17T11:45:41+02:00
[INFO] ------------------------------------------------------------------------

尝试将其添加到我的项目pom.xml:

<dependency>
    <groupId>caen</groupId>
    <artifactId>CAENRFIDLibrary</artifactId>
    <version>1.0</version>
</dependency>       

Eclipse pom.xml编辑器抱怨库:

Missing artifact caen:CAENRFIDLibrary:jar:1.0

我做错了什么?

0 个答案:

没有答案