簡體   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