Maven外部库-jar文件

时间:2018-11-25 18:23:32

标签: maven intellij-idea

我想使用intellij将外部Java库添加到Maven项目中。我遵循了先前在stackoverflow中的讨论,但是这些都不适合我。我将jar文件添加到库中,并且源代码可以检测到它们,但是当我尝试编译我的项目(mvn软件包)时,出现了“找不到符号”错误。

1 个答案:

答案 0 :(得分:0)

如果要添加外部jar,可以使用system scope。喜欢:

<dependency>
    <artifactId>..</artifactId>
    <groupId>..</groupId>
    <scope>system</scope>
    <systemPath>${basedir}/lib/dependency.jar</systemPath>
</dependency>

its not suggestedyou can also install your jar in the repository.

 mvn install:install-file \
   -Dfile=<path-to-file> \
   -DgroupId=<group-id> \
   -DartifactId=<artifact-id> \
   -Dversion=<version> \
   -Dpackaging=<packaging> \
   -DgeneratePom=true