Home > Blockchain >  How to read settings from Jenkins in Gradle?
How to read settings from Jenkins in Gradle?

Time:07-21

I use Jenkins to build Gradle, but there was a problem when reading the settings. I use the 'net.linguica.maven-settings' plugin and in build.gradle wrote the line:

mavenSettings { userSettingsFileName = project.property('maven.settings.location) }

And now I can run the build like this:

gradle -Pmaven.settings.location=/u01/test.xml clean build publish

But when building, I get dependency errors.

Could not resolve org.springframework.boot:spring-boot-configuration-processor:2.1.6.RELEASE.
Required by:
 project :
 Skipped due to earlier error
  Could not resolve org.junit.jupiter:junit-jupiter-api:5.8.0.

What do I need to do?

CodePudding user response:

Maven doesn't intrinsically know where to get dependencies from. It will look to the setting.xml for a list of repositories and look for any dependencies from there. If you list multiple repositories is will check each one until it finds the dependencies listed in the pom file.

I suspect because you are overriding the settings the file you are using doesn't have a repository listed which has the dependency you need.

That is what the error message is telling you - "I looked though all the registries I know about but couldn't find org.junit.jupiter:junit-jupiter-api:5.8.0 in any of them"

You can read a bit about it here https://maven.apache.org/settings.html under "Repositories"

  • Related