Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit Global Settings and User Settings #244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nhojpatrick
Copy link
Contributor

The -gs and -s command line flags are dropped by the child maven command(s) when spawned.

When using Jenkins and plugins like config-file-provider, the settings file is normally dynamically provided in a non standard location.

So this patch takes the global settings file and user settings file which the parent maven process is using, and explicitly passes these values to the spawned child processes.

It adds them to the start of the argLine, and if the argLine provides either -gs or -s then the argLine version is kept.

@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from ef3a6bc to 8679b7a Compare July 27, 2020 16:48
@nhojpatrick
Copy link
Contributor Author

My IDE appeared to have auto formatted so have now revert that.

@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch 2 times, most recently from 4189dfd to 4e92bb1 Compare July 27, 2020 21:11
@aleksandr-m
Copy link
Owner

@nhojpatrick Setting it in argLine manually should work. Is this for "convenience" only? I am a bit wary of automagically adding stuff to argLine.

@nhojpatrick
Copy link
Contributor Author

I've discovered several people I know alrady use this plugin and have to do similar workarounds in their views about bloating argLine.

So think of this in a corporate environment which has the CI/CD servers behind firewalls, you also have a corporate artifact repository. Your repo, say nexus requires authentication for both pull and push. Your using Jenkins and OpenShift, with new Jenkins slaves been dynamically created on demand for each job. Your Jenkins file extract might be;

    configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
        sh 'mvn -s $MAVEN_SETTINGS --batch-mode --no-transfer-progress --show-version -Pcicd gitflow:release -DskipTests -DargLine="-s $MAVEN_SETTINGS -Pcicd,release -DskipTests"'
    }

Maybe appending to the argLine magically is wrong, maybe separate variables should be introduced so it's crystal clear. If the global settings and user settings default to the locations the executing maven plugin is using, it shouldn't make things worse. If they want to use a different settings file or had already defined the settings file in argLine I don't override that.

@nhojpatrick
Copy link
Contributor Author

I've done a slightly different version here #248.

@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from 4e92bb1 to df4d440 Compare September 5, 2020 23:38
@nhojpatrick
Copy link
Contributor Author

Thinking about it I prefer the #248 version.

@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from df4d440 to c533ea9 Compare December 28, 2020 23:05
@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch 2 times, most recently from 9898822 to f7e33bb Compare January 17, 2021 20:19
@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from f7e33bb to 5b28e1e Compare January 29, 2021 10:09
@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from 5b28e1e to 31f8804 Compare February 15, 2021 09:47
@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from 31f8804 to 10185fb Compare September 9, 2021 07:26
@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from 10185fb to d9cec4b Compare September 18, 2021 12:07
@stefanseifert
Copy link
Contributor

i also prefer #248 over this approach

@nhojpatrick probably best to close this PR to cleanup the PR list a bit?

@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch 2 times, most recently from fad141f to f817cf5 Compare March 14, 2022 23:49
@nhojpatrick nhojpatrick force-pushed the feature/settings-files branch from f817cf5 to eb8ff18 Compare October 13, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants