Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven依赖项:导入无法解析,但存在于本地存储库中(Eclipse Oomph解压安装任务)_Eclipse_Maven_Import_Maven Dependency_Oomph - Fatal编程技术网

Maven依赖项:导入无法解析,但存在于本地存储库中(Eclipse Oomph解压安装任务)

Maven依赖项:导入无法解析,但存在于本地存储库中(Eclipse Oomph解压安装任务),eclipse,maven,import,maven-dependency,oomph,Eclipse,Maven,Import,Maven Dependency,Oomph,我在使用Maven时遇到问题。 Eclipse Oomph解压设置任务存储库()中的子模块“任务解压”的Maven mvn clean包失败,在多台机器/设置上出现以下错误: [INFO] --- tycho-compiler-plugin:0.22.0:compile (default-compile) @ com.github.maybeec.oomph.task.unzip --- [INFO] Compiling 13 source files to C:\FOLDER\reposito

我在使用Maven时遇到问题。 Eclipse Oomph解压设置任务存储库()中的子模块“任务解压”的Maven mvn clean包失败,在多台机器/设置上出现以下错误:

[INFO] --- tycho-compiler-plugin:0.22.0:compile (default-compile) @ com.github.maybeec.oomph.task.unzip ---
[INFO] Compiling 13 source files to C:\FOLDER\repositories\oomph-task-unzip\task-unzip\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.983 s
[INFO] Finished at: 2020-10-28T18:35:49+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project com.github.maybeec.oomph.task.unzip: Compilation failure: Compilation failure:
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[7]
[ERROR] import org.apache.commons.compress.archivers.ArchiveEntry;
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.commons cannot be resolved
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[8]
[ERROR] import org.apache.commons.compress.archivers.ArchiveInputStream;
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.commons cannot be resolved
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[9]
[ERROR] import org.apache.commons.compress.archivers.ArchiveStreamFactory;
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.commons cannot be resolved
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[10]
[ERROR] import org.apache.commons.compress.compressors.CompressorInputStream;
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.commons cannot be resolved
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[11]
[ERROR] import org.apache.commons.compress.compressors.CompressorStreamFactory;
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.commons cannot be resolved
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[12]
[ERROR] import org.apache.commons.compress.utils.IOUtils;
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] The import org.apache.commons cannot be resolved
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[47]
[ERROR] CompressorInputStream cIS = new CompressorStreamFactory().createCompressorInputStream(in);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^
[ERROR] CompressorInputStream cannot be resolved to a type
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[47]
[ERROR] CompressorInputStream cIS = new CompressorStreamFactory().createCompressorInputStream(in);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] CompressorStreamFactory cannot be resolved to a type
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[64]
[ERROR] ArchiveInputStream archiveIS = new ArchiveStreamFactory().createArchiveInputStream(fileIS);
[ERROR] ^^^^^^^^^^^^^^^^^^
[ERROR] ArchiveInputStream cannot be resolved to a type
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[64]
[ERROR] ArchiveInputStream archiveIS = new ArchiveStreamFactory().createArchiveInputStream(fileIS);
[ERROR] ^^^^^^^^^^^^^^^^^^^^
[ERROR] ArchiveStreamFactory cannot be resolved to a type
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[65]
[ERROR] ArchiveEntry entry;
[ERROR] ^^^^^^^^^^^^
[ERROR] ArchiveEntry cannot be resolved to a type
[ERROR] C:\FOLDER\repositories\oomph-task-unzip\task-unzip\src\com\github\maybeec\oomph\task\unzip\core\impl\UnzipUtilImpl.java:[77]
[ERROR] IOUtils.copy(archiveIS, out);
[ERROR] ^^^^^^^
[ERROR] IOUtils cannot be resolved
[ERROR] 12 problems (12 errors)
[ERROR] -> [Help 1]
Maven实际上正在将ApacheCommons-compress-1.19.jar下载到本地Maven存储库中,并将其复制到项目的lib文件夹中。这样就可以工作了,依赖关系实际上存在于文件系统中。 但是,Maven找不到这种依赖关系。将它手动添加到项目中,解决失败是可以解决的,但这并不能解决它不能与Maven一起工作的问题

在Eclipse中导入子模块显示了相同的结果。Eclipse无法自动完成“org.apache.commons.*的“import”语句:

该子模块的Properties>Build路径没有显示任何Maven依赖项(实际上“Maven依赖项”列表根本不在那里!为此,我必须遵循并编辑.classpath文件)。但它仍然是空的:

在这个问题上搜索和工作了几个小时,我无法解释为什么Maven会这样做。
谢谢你的支持

不需要将Maven依赖项添加到Eclipse插件的构建路径中。插件依赖项足够了,在本例中,
commons-compress-1.19.jar
将作为库从插件的
lib
目录中加载(这在
build.properties
文件中定义),而不是直接作为Maven依赖项加载

我不确定下载一个Maven依赖项并在同一个构建中使用它是否可以这样工作。如果它被复制到正确的位置,您可能只需要刷新工作区,否则jar可能在Eclipse构建中被忽略


为了调试这个问题,我可能会下载工件并手动将jar放到
lib
目录中一次,然后放弃自动化过程。然后,至少您可以看到Maven依赖项的这种异常处理是问题所在还是其他原因。

这看起来像一个Eclipse插件。因为插件依赖项只能在目标平台或工作区中,并且将显示在“插件依赖项”部分。谢谢,您走对了方向。原因是maven依赖项已在.pom中升级为commons-compress-1.19.jar,而build.properties和MANIFEST.MF中仍有commons-compress-1.12。此存储库正在使用EclipseTycho进行构建。我不知道是否有办法使清单文件更具动态性,例如,如果库的版本像本例中那样发生更改。但是build.properties不是问题(只需从“lib”文件夹复制所有内容,而不是在名称中包含版本的特定jar)。