Nitin Rathod
Nitin Rathod

Reputation: 163

Getting build success in local but not able to resolve dependencies through jenkins ci/cd pipeline

Below is the Main POM file of my project

<repositories>
    <repository>
        <id>wf-dependencies</id>
        <name>WorkFusion Nexus Repository - dependencies</name>
        <url>https://repository.workfusion.com/content/groups/dependencies/</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>wf-dependencies</id>
        <url>https://repository.workfusion.com/content/repositories/wf-dependencies</url>
    </pluginRepository>
</pluginRepositories>

When I do clean install on my local machine I get build success. But when This code goes through jenkins pipeline it gives us below error

Failed to execute goal on project pfs-eagle-bcb: Could not resolve dependencies for project 
com.hpe.automation:pfs-eagle-bcb:jar:1.0.0: The following artifacts could not be resolved: 
com.workfusion.automation.rpa:rpa-custom-elements:jar:1.4, com.workfusion.idp:idp- 
commons:jar:2.0.6: Could not find artifact com.workfusion.automation.rpa:rpa-custom- 
elements:jar:1.4 in wf-dependencies 
(https://repository.workfusion.com/content/repositories/wf-dependencies/) -> [Help 1]

above two dependencies exist in content/groups but not in content/repositories. So I have configured both the repositories in my main pom.xml file still some how through jenkins it only checks in maven central repository and this repository- https://repository.workfusion.com/content/repositories/wf-dependencies/ not in content/groups

Also I have checked settings.xml file for jenkins, Only content/repositories - this dependency url is used and not content/groups

Upvotes: 0

Views: 158

Answers (1)

Andrey
Andrey

Reputation: 6786

It looks like you have different urls for the same repository id configured in different places (between pom.xml and .m2/settings.xml).

Make sure that repository url is identical and always references groups/dependencies:

<repository>
    <id>wf-dependencies</id>
    <url>https://repository.workfusion.com/content/groups/dependencies/</url>
</repository>

Upvotes: 0

Related Questions