简体   繁体   中英

Maven cannot resolve dependency for project from source location

I'm pretty new to maven so I am not sure how to fix this issue.

I am trying to package my maven project ( mvn clean package ) but I am getting this error:

Failed to execute goal on project TestSDK: Could not resolve dependencies for project com.company.idea.qe:qeTestSDK:jar:1.0-SNAPSHOT: Failure to find org.slf4j:slf4j-parent:jar:1.7.21 in http://nexus-proxy/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of Company-nexus has elapsed or updates are forced -> [Help 1]

I believe this is caused by Maven using the repository value as the only source of downloading dependencies. I require this to download the WebDriverBuilder artifact. Being new to Maven I'm not sure how to do this.

my pom.xml currently looks like this:

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.company.idea.qe</groupId>
<artifactId>qeTestSDK</artifactId>
<version>1.0-SNAPSHOT</version>

<repositories>
    <repository>
        <id>company-nexus</id>
        <name>Compnay Nexus</name>
        <url>http://nexus-proxy/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.company.tools</groupId>
        <artifactId>WebDriverBuilder</artifactId>
        <version>2.3.3</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.9.10</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
    </dependency>
    <!--  Gson: Java to Json conversion -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.6.2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-parent</artifactId>
        <version>1.7.21</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
        </plugin>
    </plugins>
</build>

Your dependency should be for sl4j-api and not sl4j-parent

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.21</version>
</dependency>

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