Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #772 from imod/default-maven-settings
FIXES JENKINS-17723 - Default maven settings Good change !
- Loading branch information
Showing
7 changed files
with
155 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package jenkins.mvn; | ||
|
||
import hudson.Extension; | ||
import jenkins.model.GlobalConfiguration; | ||
import net.sf.json.JSONObject; | ||
|
||
import org.kohsuke.stapler.StaplerRequest; | ||
|
||
//as close as it gets to the global Maven Project configuration | ||
@Extension(ordinal = 50) | ||
public class GlobalMavenConfig extends GlobalConfiguration { | ||
private SettingsProvider settingsProvider; | ||
private GlobalSettingsProvider globalSettingsProvider; | ||
|
||
public GlobalMavenConfig() { | ||
load(); | ||
} | ||
|
||
@Override | ||
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { | ||
req.bindJSON(this, json); | ||
return true; | ||
} | ||
|
||
public void setGlobalSettingsProvider(GlobalSettingsProvider globalSettingsProvider) { | ||
this.globalSettingsProvider = globalSettingsProvider; | ||
save(); | ||
} | ||
|
||
public void setSettingsProvider(SettingsProvider settingsProvider) { | ||
this.settingsProvider = settingsProvider; | ||
save(); | ||
} | ||
|
||
public GlobalSettingsProvider getGlobalSettingsProvider() { | ||
return globalSettingsProvider != null ? globalSettingsProvider : new DefaultGlobalSettingsProvider(); | ||
} | ||
|
||
public SettingsProvider getSettingsProvider() { | ||
return settingsProvider != null ? settingsProvider : new DefaultSettingsProvider(); | ||
} | ||
|
||
public static GlobalMavenConfig get() { | ||
return GlobalConfiguration.all().get(GlobalMavenConfig.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
core/src/main/resources/jenkins/mvn/GlobalMavenConfig/config.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package jenkins.mvn.GlobalMavenConfig; | ||
|
||
def f = namespace(lib.FormTagLib) | ||
|
||
f.section(title:_("Maven Configuration")) { | ||
f.dropdownDescriptorSelector(title:_("Default settings provider"), field:"settingsProvider") | ||
f.dropdownDescriptorSelector(title:_("Default global settings provider"), field:"globalSettingsProvider") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters