简体   繁体   中英

Dependency error in eclipse project making use of Maven

I am using Eclipse Mars to run my Java project. I am making use of Maven in it. But while trying to compile my package I am getting the following error.

Failed to execute goal on project apex-check: Could not resolve dependencies for project org.fundacionjala.enforce.sonarqube:apex-check:jar:1.0: Failed to collect dependencies at org.fundacionjala.enforce.sonarqube:apex-squid:jar:1.0: Failed to read artifact descriptor for org.fundacionjala.enforce.sonarqube:apex-squid:jar:1.0: Could not transfer artifact org.fundacionjala.enforce.sonarqube:apex-squid:pom:1.0 from/to central ( https://repo.maven.apache.org/maven2 ): Failed to authenticate with proxy -> [Help 1].

I am able to find that my pom.xml has a bug in its dependency. But don't know how to resolve it. I have given below my pom.xml file

<?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>

I have written 'apex-check' and 'apex-squid' as two separate projects. 在此处输入图片说明 Can anyone explain how to correct my pom.xml?

You need to have:

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

jar files available in your local .m2/repository folder. If they are not present maven will try to download from central repository and as an expected result it will fail on firewall or it will not find the artifact. ie if: apex-check requires apex-squid project as dependency first you need to install squid project files by using mvn install on squid project folder.

But it seems more like you want to create a multi module maven project, take a look at this question . Create a parent project similar to this project, add check and squid as module and run mvn clean install on parent.

**edit: I just see you already have parent, so make sure parent has your projects as modules, which helps reactive build order and eclipse imports

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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