1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-04 04:07:16 +02:00

Honor maven user-settings file for mta build (#663)

Allow setting custom settings file for maven in mta build, which is for example required if a custom maven repo (i.e. company internal) needs to be used.
This commit is contained in:
Florian Wilhelm 2019-04-17 10:44:55 +02:00 committed by GitHub
parent eacec4279d
commit ee42e66802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -181,6 +181,14 @@ public class MtaBuildTest extends BasePiperTest {
assert 'something' == dockerExecuteRule.dockerParams.dockerOptions
}
@Test
void canConfigureMavenUserSettings() {
stepRule.step.mtaBuild(script: nullScript, projectSettingsFile: 'settings.xml')
assert shellRule.shell.find(){ c -> c.contains('cp settings.xml $HOME/.m2/settings.xml')}
}
@Test
void buildTargetFromDefaultStepConfigurationTest() {

View File

@ -26,7 +26,9 @@ import groovy.transform.Field
* The location of the SAP Multitarget Application Archive Builder jar file, including file name and extension.
* If it is not provided, the SAP Multitarget Application Archive Builder is expected on PATH.
*/
'mtaJarLocation'
'mtaJarLocation',
/** Path or url to the mvn settings file that should be used as project settings file.*/
'projectSettingsFile'
]
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus([
/** @see dockerExecute */
@ -59,6 +61,12 @@ void call(Map parameters = [:]) {
dockerExecute(script: script, dockerImage: configuration.dockerImage, dockerOptions: configuration.dockerOptions) {
// Apply maven user-settings (for custom repositories, etc)
if (configuration.projectSettingsFile) {
sh 'mkdir -p $HOME/.m2'
sh "cp ${configuration.projectSettingsFile} \$HOME/.m2/settings.xml"
}
def mtaYamlName = "mta.yaml"
def applicationName = configuration.applicationName