繁体   English   中英

eclipse项目中使用Maven的依赖错误

[英]Dependency error in eclipse project making use of Maven

我正在使用 Eclipse Mars 来运行我的 Java 项目。 我在其中使用了 Maven。 但是在尝试编译我的包时,我收到以下错误。

无法在项目 apex-check 上执行目标:无法解决项目 org.fundacionjala.enforce.sonarqube:apex-check:jar:1.0 的依赖项:无法在 org.fundacionjala.enforce.sonarqube:apex-squid:jar 收集依赖项:1.0: 无法读取 org.fundacionjala.enforce.sonarqube:apex-squid:jar:1.0 的工件描述符:无法从/向中央 ( https)传输工件 org.fundacionjala.enforce.sonarqube:apex-squid:pom:1.0 ://repo.maven.apache.org/maven2 ):无法通过代理进行身份验证 -> [帮助 1]。

我能够发现我的 pom.xml 在其依赖项中有一个错误。 但是不知道怎么解决。 我在下面给出了我的 pom.xml 文件

<?xml version="1.0" encoding="UTF-8"?>

 <!-- ~ Copyright (c) Fundacion Jala. All rights reserved. ~ Licensed under the MIT license. See LICENSE file in the project root for full license information. -->

 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">

 <modelVersion>4.0.0</modelVersion>


 <parent>

 <groupId>org.fundacionjala.enforce.sonarqube</groupId>

 <artifactId>apex</artifactId>

 <version>1.0b${build.number}</version>

 </parent>

 <artifactId>apex-check</artifactId>

 <name>Apex :: Checks</name>


 <dependencies>


 <dependency>

 <groupId>${project.groupId}</groupId>

 <artifactId>apex-squid</artifactId>

 <version>${project.version}</version>

 </dependency>

</dependencies>

</project>

我已经将“apex-check”和“apex-squid”写为两个独立的项目。 在此处输入图片说明 谁能解释一下如何更正我的 pom.xml?

你需要有:

org.fundacionjala.enforce.sonarqube:apex-check:jar:1.0
org.fundacionjala.enforce.sonarqube:apex-squid:jar:1.0

jar 文件位于本地 .m2/repository 文件夹中。 如果它们不存在,maven 将尝试从中央存储库下载,并且作为预期的结果,它将在防火墙上失败或找不到工件。 即如果: apex-check需要apex-squid项目作为依赖项,首先您需要通过在 squid 项目文件夹上使用mvn installmvn install squid 项目文件。

不过好像更像是要创建一个多模块的maven项目,看看这个问题 创建一个与此项目类似的父项目,添加checksquid作为模块并在父项目上运行mvn clean install

**编辑:我只是看到你已经有了父级,所以确保父级将你的项目作为模块,这有助于反应式构建顺序和 Eclipse 导入

暂无
暂无

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

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