Passing the location of the Maven settings.xml file to Maven Publish

You could very easily use a project property to set the value and pass it via the command line.

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

Then when executing your build:

./gradlew -Pmaven.settings.location=path/to/settings.xml build
1 Like