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:
parent
eacec4279d
commit
ee42e66802
@ -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() {
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user