Java 下载的项目中缺少依赖项

Java 下载的项目中缺少依赖项,java,maven,Java,Maven,我正在尝试使用project。我从git下载,注意到这是一个maven项目,安装了maven,然后尝试: mvn install 得到: [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for se.kth:decompiler-cmp:jar:1.0-SNAPSHOT [WARNING] 'depende

我正在尝试使用project。我从git下载,注意到这是一个maven项目,安装了maven,然后尝试:

mvn install
得到:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for se.kth:decompiler-cmp:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for scala:jardiff:jar should not point at files within the project directory, ${basedir}/lib/jardiff.jar will be unresolvable by dependent projects @ line 34, column 25
[WARNING] 'dependencies.dependency.systemPath' for jd:jd-core:jar should not point at files within the project directory, ${basedir}/lib/jd-core-1.0.0.jar will be unresolvable by dependent projects @ line 42, column 25
[WARNING] 'dependencies.dependency.systemPath' for jadx:jadx-cli:jar should not point at files within the project directory, ${basedir}/lib/jadx-0.9.0/lib/jadx-cli-0.9.0.jar will be unresolvable by dependent projects @ line 50, column 25
[WARNING] 'dependencies.dependency.systemPath' for cli.jd:jd-gui:jar should not point at files within the project directory, ${basedir}/lib/jd-gui-1.4.1.jar will be unresolvable by dependent projects @ line 58, column 25
[WARNING] 'dependencies.dependency.systemPath' for org.jode:jode-decompiler:jar should not point at files within the project directory, ${basedir}/lib/jode-1.1.2-pre1.jar will be unresolvable by dependent projects @ line 65, column 25
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: fr.inria.gforge.spoon:spoon-core:jar -> version 7.3.0 vs 7.5.0 @ line 163, column 21
[WARNING] 'dependencies.dependency.systemPath' for scala:jardiff:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jardiff.jar @ line 34, column 25
[WARNING] 'dependencies.dependency.systemPath' for jd:jd-core:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jd-core-1.0.0.jar @ line 42, column 25
[WARNING] 'dependencies.dependency.systemPath' for jadx:jadx-cli:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jadx-0.9.0/lib/jadx-cli-0.9.0.jar @ line 50, column 25
[WARNING] 'dependencies.dependency.systemPath' for cli.jd:jd-gui:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jd-gui-1.4.1.jar @ line 58, column 25
[WARNING] 'dependencies.dependency.systemPath' for org.jode:jode-decompiler:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jode-1.1.2-pre1.jar @ line 65, column 25
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] -----------------------< se.kth:decompiler-cmp >------------------------
[INFO] Building decompiler-cmp 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.483 s
[INFO] Finished at: 2020-05-03T08:13:12+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project decompiler-cmp: Could not resolve dependencies for project se.kth:decompiler-cmp:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: scala:jardiff:jar:1.2.0, jd:jd-core:jar:1.0.0, jadx:jadx-cli:jar:0.9.0, cli.jd:jd-gui:jar:1.4.1, org.jode:jode-decompiler:jar:1.2.1-pre1: Could not find artifact scala:jardiff:jar:1.2.0 at specified path /Users/shlomiagiv/work/decompilercmp/lib/jardiff.jar -> [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]
[帮助1]

这些缺少的依赖项是项目试图访问的各种反编译器。 我如何找到/指向它们?请注意,我使用的是MacOS

jadx的pom.xml条目示例:

<dependency>
     <groupId>jadx</groupId>
     <artifactId>jadx-cli</artifactId>
     <version>0.9.0</version>
     <scope>system</scope>
     <systemPath>${basedir}/lib/jadx-0.9.0/lib/jadx-cli-0.9.0.jar</systemPath>
</dependency>

一般来说,maven使用远程repositories的概念,比如查找项目的依赖项,并在默认情况下将它们存储在本地存储库缓存~/.m2中。 如果需要,您可以添加自己的远程存储库

但是,如果在系统范围中定义了依赖项,这意味着您指示maven jar不在存储库中,而是由您在指定systemPath的文件夹中提供它。此方法有效地绕过了maven依赖项解析机制,通常不应用于实际项目。相反,应该安装像或这样的特殊产品,作为远程代理,并可以托管您自己的jar

为什么要使用系统范围

通常不应该考虑,只有当你有罐子不能发布到远程存储库,你的私人公司的商业工件,你没有一个nexus /艺人,不想安装它,如果你是1个开发人员在你的本地机器上运行的东西或一些东西< /p> 如果您决定使用系统范围,那么您自己负责向maven提供这些依赖项,因此您应该自己找到这些工件。一旦知道JAR在哪里,就可以将它们复制到systemPath中指定的文件夹中,并继续绕过maven的依赖项解析机制

另一种可能更好的方法是完全停止使用系统作用域,一旦找到JAR,使用mvn install:install file命令将文件安装到本地存储库缓存~/.m2。您将能够指定组id、工件id、版本,并且它将把这个jar存储在正确的位置。然后,您将能够将这个jar作为常规的maven依赖项引用


这是一个演示如何使用这些第三方JAR的教程。

一般来说,maven使用远程Repositories的概念来查找项目的依赖项,并在默认情况下将它们存储在本地存储库缓存~/.m2中。 如果需要,您可以添加自己的远程存储库

但是,如果在系统范围中定义了依赖项,这意味着您指示maven jar不在存储库中,而是由您在指定systemPath的文件夹中提供它。此方法有效地绕过了maven依赖项解析机制,通常不应用于实际项目。相反,应该安装像或这样的特殊产品,作为远程代理,并可以托管您自己的jar

为什么要使用系统范围

通常不应该考虑,只有当你有罐子不能发布到远程存储库,你的私人公司的商业工件,你没有一个nexus /艺人,不想安装它,如果你是1个开发人员在你的本地机器上运行的东西或一些东西< /p> 如果您决定使用系统范围,那么您自己负责向maven提供这些依赖项,因此您应该自己找到这些工件。一旦知道JAR在哪里,就可以将它们复制到systemPath中指定的文件夹中,并继续绕过maven的依赖项解析机制

另一种可能更好的方法是完全停止使用系统作用域,一旦找到JAR,使用mvn install:install file命令将文件安装到本地存储库缓存~/.m2。您将能够指定组id、工件id、版本,并且它将把这个jar存储在正确的位置。然后,您将能够将这个jar作为常规的maven依赖项引用


本教程介绍如何使用这些第三方jar。

我的第三方lib不包含任何pom.xml,并且包含大量jar。例如,我该怎么办呢?使用系统范围不需要pom,只有一个现成的jar,不管它是如何构建的。如果您使用install:install文件,它将在~/.m2/repository///BTW中为您生成一个pom,您提供的链接使用另一个构建系统Gradle。它可以与maven本地存储库集成,请看这里:1。安装gradle。2.编辑gradle构建文件并添加存储库{mavenLocal}3。运行:渐变构建。4.在maven存储库~/.m2中找到工件。5.在pom更新中,依赖项删除系统范围并使用groupId/工件Id,gradle在该Id下构建了第三方内容。6.运行mvn安装-如果我的第三方LIB不包含任何pom.xml,并且包含大量JAR。例如,我该怎么做呢?使用系统范围不需要pom,只有一个现成的jar才不管我是怎么做的
我不能建造。如果您使用install:install文件,它将在~/.m2/repository///BTW中为您生成一个pom,您提供的链接使用另一个构建系统Gradle。它可以与maven本地存储库集成,请看这里:1。安装gradle。2.编辑gradle构建文件并添加存储库{mavenLocal}3。运行:渐变构建。4.在maven存储库~/.m2中找到工件。5.在pom更新中,依赖项删除系统范围并使用groupId/工件Id,gradle在该Id下构建了第三方内容。6.运行mvn安装-应该可以工作