mavenjenkinsdependenciesjenkins-shared-libraries

Unable to retrieve jenkins related dependencies (jar)


I am unable to import few jenkins dependencies, for example we find this on mvnrepo:

<!-- https://mvnrepository.com/artifact/org.jenkins-ci.plugins.workflow/workflow-cps-global-lib -->
<dependency>
    <groupId>org.jenkins-ci.plugins.workflow</groupId>
    <artifactId>workflow-cps-global-lib</artifactId>
    <version>2.9</version>
</dependency>

But it does not download the jar (I use -U option and I cleaned everythings in m2/repo anyway to be sure). I have this behavior for multiple jenkins related dependencies. I also try to download directly from github (with jitpack), same.

What is happening with jenkins artifacts ? How to get them as classic dependency in our pom.xml ? Should we have to add specific repository ?

Context: dev around jenkins pipeline shared library with everything recognized for IDE


Solution

  • Ok we indeed need to add repo:

    <repositories>
        <repository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/artifactory/public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/artifactory/public/</url>
        </pluginRepository>
    </pluginRepositories>