提交 4e8dcbe6 编写于 作者: N Nicolas De loof

Merge pull request #606 from ndeloof/maven-settings2

inverse maven-plugin -> config-file-provider dependency
......@@ -1041,4 +1041,65 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
return pluginsWithCycle;
}
}
/**
* {@link AdministrativeMonitor} that informs the administrator about a required plugin update.
* @since 1.491
*/
@Extension
public static final class PluginUpdateMonitor extends AdministrativeMonitor {
private Map<String, PluginUpdateInfo> pluginsToBeUpdated = new HashMap<String, PluginManager.PluginUpdateMonitor.PluginUpdateInfo>();
/**
* Convenience method to ease access to this monitor, this allows other plugins to register required updates.
* @return this monitor.
*/
public static final PluginUpdateMonitor getInstance() {
return Jenkins.getInstance().getExtensionList(PluginUpdateMonitor.class).get(0);
}
/**
* Report to the administrator if the plugin with the given name is older then the required version.
*
* @param pluginName shortName of the plugin (artifactId)
* @param requiredVersion the lowest version which is OK (e.g. 2.2.2)
* @param message the message to show (plain text)
*/
public void ifPluginOlderThenReport(String pluginName, String requiredVersion, String message){
Plugin plugin = Jenkins.getInstance().getPlugin(pluginName);
if(plugin != null){
if(plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(requiredVersion))) {
pluginsToBeUpdated.put(pluginName, new PluginUpdateInfo(pluginName, message));
}
}
}
public boolean isActivated() {
return !pluginsToBeUpdated.isEmpty();
}
/**
* adds a message about a plugin to the manage screen
* @param pluginName the plugins name
* @param message the message to be displayed
*/
public void addPluginToUpdate(String pluginName, String message) {
this.pluginsToBeUpdated.put(pluginName, new PluginUpdateInfo(pluginName, message));
}
public Collection<PluginUpdateInfo> getPluginsToBeUpdated() {
return pluginsToBeUpdated.values();
}
public static class PluginUpdateInfo {
public final String pluginName;
public final String message;
private PluginUpdateInfo(String pluginName, String message) {
this.pluginName = pluginName;
this.message = message;
}
}
}
}
......@@ -38,6 +38,10 @@ import hudson.model.Computer;
import hudson.model.EnvironmentSpecific;
import hudson.model.Node;
import jenkins.model.Jenkins;
import jenkins.mvn.DefaultGlobalSettingsProvider;
import jenkins.mvn.DefaultSettingsProvider;
import jenkins.mvn.GlobalSettingsProvider;
import jenkins.mvn.SettingsProvider;
import hudson.model.TaskListener;
import hudson.remoting.Callable;
import hudson.remoting.VirtualChannel;
......@@ -55,6 +59,8 @@ import hudson.util.VariableResolver;
import hudson.util.FormValidation;
import hudson.util.XStream2;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.QueryParameter;
......@@ -62,7 +68,6 @@ import org.kohsuke.stapler.QueryParameter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.List;
......@@ -71,6 +76,7 @@ import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.regex.Pattern;
/**
* Build by using Maven.
......@@ -118,32 +124,67 @@ public class Maven extends Builder {
* @since 1.322
*/
public boolean usePrivateRepository = false;
/**
* Provides access to the settings.xml to be used for a build.
* @since 1.491
*/
private SettingsProvider settings = new DefaultSettingsProvider();
/**
* Provides access to the global settings.xml to be used for a build.
* @since 1.491
*/
private GlobalSettingsProvider globalSettings = new DefaultGlobalSettingsProvider();
private final static String MAVEN_1_INSTALLATION_COMMON_FILE = "bin/maven";
private final static String MAVEN_2_INSTALLATION_COMMON_FILE = "bin/mvn";
private static final Pattern S_PATTERN = Pattern.compile("(^| )-s ");
private static final Pattern GS_PATTERN = Pattern.compile("(^| )-gs ");
public Maven(String targets,String name) {
this(targets,name,null,null,null,false);
this(targets,name,null,null,null,false, null, null);
}
public Maven(String targets, String name, String pom, String properties, String jvmOptions) {
this(targets, name, pom, properties, jvmOptions, false);
this(targets, name, pom, properties, jvmOptions, false, null, null);
}
@DataBoundConstructor
public Maven(String targets,String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository) {
this(targets, name, pom, properties, jvmOptions, usePrivateRepository, null, null);
}
@DataBoundConstructor
public Maven(String targets,String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository, SettingsProvider settings, GlobalSettingsProvider globalSettings) {
this.targets = targets;
this.mavenName = name;
this.pom = Util.fixEmptyAndTrim(pom);
this.properties = Util.fixEmptyAndTrim(properties);
this.jvmOptions = Util.fixEmptyAndTrim(jvmOptions);
this.usePrivateRepository = usePrivateRepository;
this.settings = settings != null ? settings : new DefaultSettingsProvider();
this.globalSettings = globalSettings != null ? globalSettings : new DefaultGlobalSettingsProvider();
}
public String getTargets() {
return targets;
}
/**
* @since 1.491
*/
public SettingsProvider getSettings() {
return settings != null ? settings : new DefaultSettingsProvider();
}
/**
* @since 1.491
*/
public GlobalSettingsProvider getGlobalSettings() {
return globalSettings != null ? globalSettings : new DefaultGlobalSettingsProvider();
}
public void setUsePrivateRepository(boolean usePrivateRepository) {
this.usePrivateRepository = usePrivateRepository;
}
......@@ -248,6 +289,20 @@ public class Maven extends Builder {
}
if(pom!=null)
args.add("-f",pom);
if(!S_PATTERN.matcher(targets).find()){ // check the given target/goals do not contain settings parameter already
String settingsPath = SettingsProvider.getSettingsRemotePath(getSettings(), build, listener);
if(StringUtils.isNotBlank(settingsPath)){
args.add("-s", settingsPath);
}
}
if(!GS_PATTERN.matcher(targets).find()){
String settingsPath = GlobalSettingsProvider.getSettingsRemotePath(getGlobalSettings(), build, listener);
if(StringUtils.isNotBlank(settingsPath)){
args.add("-gs", settingsPath);
}
}
Set<String> sensitiveVars = build.getSensitiveBuildVariables();
......
package jenkins.mvn;
import hudson.Extension;
import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public class DefaultGlobalSettingsProvider extends GlobalSettingsProvider {
@DataBoundConstructor
public DefaultGlobalSettingsProvider() {
}
@Override
public FilePath supplySettings(AbstractBuild<?, ?> project, TaskListener listener) {
return null;
}
@Extension(ordinal = 99)
public static class DescriptorImpl extends GlobalSettingsProviderDescriptor {
@Override
public String getDisplayName() {
return Messages.DefaultGlobalSettingsProvider_DisplayName();
}
}
}
package jenkins.mvn;
import hudson.Extension;
import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public class DefaultSettingsProvider extends SettingsProvider {
@DataBoundConstructor
public DefaultSettingsProvider() {
}
@Override
public FilePath supplySettings(AbstractBuild<?, ?> project, TaskListener listener) {
return null;
}
@Extension(ordinal = 99)
public static class DescriptorImpl extends SettingsProviderDescriptor {
@Override
public String getDisplayName() {
return Messages.DefaultSettingsProvider_DisplayName();
}
}
}
package jenkins.mvn;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.util.IOUtils;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public class FilePathGlobalSettingsProvider extends GlobalSettingsProvider {
private final String path;
@DataBoundConstructor
public FilePathGlobalSettingsProvider(String path) {
this.path = path;
}
public String getPath() {
return path;
}
@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
EnvVars env = build.getEnvironment(listener);
String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver());
targetPath = env.expand(targetPath);
if (IOUtils.isAbsolute(targetPath)) {
return new FilePath(new File(targetPath));
} else {
FilePath mrSettings = build.getModuleRoot().child(targetPath);
FilePath wsSettings = build.getWorkspace().child(targetPath);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote());
}
return wsSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to prepare global settings.xml");
}
}
@Extension(ordinal = 10)
public static class DescriptorImpl extends GlobalSettingsProviderDescriptor {
@Override
public String getDisplayName() {
return Messages.FilePathGlobalSettingsProvider_DisplayName();
}
}
}
package jenkins.mvn;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.util.IOUtils;
import java.io.File;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public class FilePathSettingsProvider extends SettingsProvider {
private final String path;
@DataBoundConstructor
public FilePathSettingsProvider(String path) {
this.path = path;
}
public String getPath() {
return path;
}
@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
EnvVars env = build.getEnvironment(listener);
String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver());
targetPath = env.expand(targetPath);
if (IOUtils.isAbsolute(targetPath)) {
return new FilePath(new File(targetPath));
} else {
FilePath mrSettings = build.getModuleRoot().child(targetPath);
FilePath wsSettings = build.getWorkspace().child(targetPath);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote());
}
return wsSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to prepare settings.xml");
}
}
@Extension(ordinal = 10)
public static class DescriptorImpl extends SettingsProviderDescriptor {
@Override
public String getDisplayName() {
return Messages.FilePathSettingsProvider_DisplayName();
}
}
}
package jenkins.mvn;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.model.TaskListener;
import javax.servlet.ServletException;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public abstract class GlobalSettingsProvider extends AbstractDescribableImpl<GlobalSettingsProvider> implements ExtensionPoint {
/**
* configure maven launcher argument list with adequate settings path
*
* @param build
* the build to provide the settigns for
* @return the filepath to the provided file. <code>null</code> if no settings will be provided.
*/
public abstract FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener);
public static GlobalSettingsProvider parseSettingsProvider(StaplerRequest req) throws Descriptor.FormException, ServletException {
JSONObject settings = req.getSubmittedForm().getJSONObject("globalSettings");
if (settings == null) {
return new DefaultGlobalSettingsProvider();
}
return req.bindJSON(GlobalSettingsProvider.class, settings);
}
/**
* Convenience method handling all <code>null</code> checks. Provides the path on the (possible) remote settings file.
*
* @param settings
* the provider to be used
* @param build
* the active build
* @param listener
* the listener of the current build
* @return the path to the global settings.xml
*/
public static final FilePath getSettingsFilePath(GlobalSettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath settingsPath = null;
if (settings != null) {
try {
settingsPath = settings.supplySettings(build, listener);
} catch (Exception e) {
listener.getLogger().print("failed to get the path to the alternate global settings.xml");
}
}
return settingsPath;
}
/**
* Convenience method handling all <code>null</code> checks. Provides the path on the (possible) remote settings file.
*
* @param settings
* the provider to be used
* @param build
* the active build
* @param listener
* the listener of the current build
* @return the path to the global settings.xml
*/
public static final String getSettingsRemotePath(GlobalSettingsProvider provider, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath fp = getSettingsFilePath(provider, build, listener);
return fp == null ? null : fp.getRemote();
}
}
package jenkins.mvn;
import hudson.model.Descriptor;
import java.util.List;
import jenkins.model.Jenkins;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public abstract class GlobalSettingsProviderDescriptor extends Descriptor<GlobalSettingsProvider> {
public static List<GlobalSettingsProviderDescriptor> all() {
return Jenkins.getInstance().getDescriptorList(GlobalSettingsProvider.class);
}
}
package jenkins.mvn;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.model.TaskListener;
import javax.servlet.ServletException;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @author Dominik Bartholdi (imod)
* @since 1.491
*/
public abstract class SettingsProvider extends AbstractDescribableImpl<SettingsProvider> implements ExtensionPoint {
/**
* Configure maven launcher argument list with adequate settings path. Implementations should be aware that this method might get called multiple times during a build.
*
* @param build
* @return the filepath to the provided file. <code>null</code> if no settings will be provided.
*/
public abstract FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener);
public static SettingsProvider parseSettingsProvider(StaplerRequest req) throws Descriptor.FormException, ServletException {
JSONObject settings = req.getSubmittedForm().getJSONObject("settings");
if (settings == null) {
return new DefaultSettingsProvider();
}
return req.bindJSON(SettingsProvider.class, settings);
}
/**
* Convenience method handling all <code>null</code> checks. Provides the path on the (possible) remote settings file.
*
* @param settings
* the provider to be used
* @param build
* the active build
* @param listener
* the listener of the current build
* @return the path to the settings.xml
*/
public static final FilePath getSettingsFilePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath settingsPath = null;
if (settings != null) {
settingsPath = settings.supplySettings(build, listener);
}
return settingsPath;
}
/**
* Convenience method handling all <code>null</code> checks. Provides the path on the (possible) remote settings file.
*
* @param settings
* the provider to be used
* @param build
* the active build
* @param listener
* the listener of the current build
* @return the path to the settings.xml
*/
public static final String getSettingsRemotePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath fp = getSettingsFilePath(settings, build, listener);
return fp == null ? null : fp.getRemote();
}
}
package jenkins.mvn;
import hudson.model.Descriptor;
import java.util.List;
import jenkins.model.Jenkins;
/**
* @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
* @since 1.491
*/
public abstract class SettingsProviderDescriptor extends Descriptor<SettingsProvider> {
public static List<SettingsProviderDescriptor> all() {
return Jenkins.getInstance().getDescriptorList(SettingsProvider.class);
}
}
<!--
The MIT License
Copyright (c) 2012, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<div class="error">
${%RequiredPluginUpdates}
<ul>
<j:forEach var="p" items="${it.pluginsToBeUpdated}">
<li><j:out value="${p.pluginName}"/> — <j:out value="${p.message}"/></li>
</j:forEach>
</ul>
</div>
</j:jelly>
# The MIT License
#
# Copyright (c) 2004-2012, Dominik Bartholdi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
RequiredPluginUpdates=The following plugins require an update.
\ No newline at end of file
......@@ -50,5 +50,11 @@ THE SOFTWARE.
<f:entry field="usePrivateRepository" title="${%Use private Maven repository}" help="/plugin/maven-plugin/private-repository.html">
<f:checkbox checked="${it.usesPrivateRepository()}" />
</f:entry>
<f:entry title="${%Settings file}" field="settings" help="/help/tasks/maven/maven-settings.html">
<f:dropdownDescriptorSelector descriptors="${descriptor.settingsProviders}"/>
</f:entry>
<f:entry title="${%Global Settings file}" field="globalSettings" help="/help/tasks/maven/maven-settings.html">
<f:dropdownDescriptorSelector descriptors="${descriptor.globalSettingsProviders}"/>
</f:entry>
</f:advanced>
</j:jelly>
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
</j:jelly>
\ No newline at end of file
<div>
Use default maven settings (<tt>$HOME/.m2/settings.xml</tt>) as set on build node.
</div>
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
</j:jelly>
\ No newline at end of file
<div>
Use default maven settings (<tt>$HOME/.m2/settings.xml</tt>) as set on build node.
</div>
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="${%File path}" field="path">
<f:textbox />
</f:entry>
</j:jelly>
\ No newline at end of file
<div>
Path to settings.xml file, relative to project workspace or absolute (variables are supported).
</div>
\ No newline at end of file
<div>
Use a custom global <tt>setting.xml</tt> file from job workspace. Such a file is checked out from SCM as part of the job or a well known location.
</div>
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="${%File path}" field="path">
<f:textbox />
</f:entry>
</j:jelly>
\ No newline at end of file
<div>
Path to settings.xml file, relative to project workspace or absolute (variables are supported).
</div>
\ No newline at end of file
<div>
Use a custom <tt>setting.xml</tt> file. Such a file is checked out from SCM as part of the job or a well known location.
</div>
\ No newline at end of file
# The MIT License
#
# Copyright 2012 Dominik Bartholdi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
DefaultSettingsProvider.DisplayName=Use default maven settings
DefaultGlobalSettingsProvider.DisplayName=Use default maven global settings
FilePathGlobalSettingsProvider.DisplayName=Global settings file on filesystem
FilePathSettingsProvider.DisplayName=Settings file in filesystem
......@@ -42,7 +42,7 @@ THE SOFTWARE.
If specified, this will be chosen as the default value in case the current selection is null.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
<j:set target="${attrs}" property="descriptors" value="${attrs.descriptors ?: descriptor.getPropertyType(instance,attrs.field).getApplicableDescriptors()}" />
<f:dropdownList name="${attrs.field}" title="${attrs.title}" help="${descriptor.getHelpFile(attrs.field)}">
......
......@@ -114,13 +114,6 @@ THE SOFTWARE.
<artifactId>maven3-interceptor</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<dependency>
<!-- this plugin is optional and is used to provide settigns.xml from a central UI -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>config-file-provider</artifactId>
<version>1.9.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
......
......@@ -48,7 +48,6 @@ import hudson.tasks.Maven.MavenInstallation;
import hudson.tasks.Publisher;
import hudson.util.ArgumentListBuilder;
import hudson.util.DescribableList;
import hudson.util.IOUtils;
import org.apache.maven.BuildFailureException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
......@@ -74,6 +73,8 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import jenkins.mvn.SettingsProvider;
/**
* {@link Run} for {@link MavenModule}.
*
......@@ -700,21 +701,12 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
if(localRepo!=null)
// the workspace must be on this node, so getRemote() is safe.
margs.add("-Dmaven.repo.local="+localRepo.getRemote());
if (mms.getAlternateSettings() != null) {
if (IOUtils.isAbsolute(mms.getAlternateSettings())) {
margs.add("-s").add(mms.getAlternateSettings());
} else {
FilePath mrSettings = getModuleRoot().child(mms.getAlternateSettings());
FilePath wsSettings = getWorkspace().child(mms.getAlternateSettings());
if (!wsSettings.exists() && mrSettings.exists())
wsSettings = mrSettings;
margs.add("-s").add(wsSettings.getRemote());
}
String settingsPath = SettingsProvider.getSettingsRemotePath(mms.getSettings(), MavenBuild.this, listener);
if (settingsPath != null) {
margs.add("-s").add(settingsPath);
}
margs.add("-f",getModuleRoot().child("pom.xml").getRemote());
margs.addTokenized(getProject().getGoals());
......
......@@ -24,7 +24,6 @@
*/
package hudson.maven;
import static hudson.Util.*;
import static hudson.model.ItemGroupMixIn.loadChildren;
import hudson.CopyOnWrite;
import hudson.EnvVars;
......@@ -32,12 +31,11 @@ import hudson.Extension;
import hudson.FilePath;
import hudson.Functions;
import hudson.Indenter;
import hudson.Plugin;
import hudson.Util;
import hudson.maven.local_repo.DefaultLocalRepositoryLocator;
import hudson.maven.local_repo.LocalRepositoryLocator;
import hudson.maven.local_repo.PerJobLocalRepositoryLocator;
import hudson.maven.settings.SettingConfig;
import hudson.maven.settings.SettingsProviderUtils;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildableItemWithBuildWrappers;
......@@ -87,12 +85,22 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.Stack;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.mvn.DefaultGlobalSettingsProvider;
import jenkins.mvn.DefaultSettingsProvider;
import jenkins.mvn.FilePathSettingsProvider;
import jenkins.mvn.GlobalSettingsProvider;
import jenkins.mvn.GlobalSettingsProviderDescriptor;
import jenkins.mvn.SettingsProvider;
import jenkins.mvn.SettingsProviderDescriptor;
import net.sf.json.JSONObject;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.kohsuke.stapler.HttpResponse;
......@@ -135,7 +143,11 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
private String goals;
private String alternateSettings;
/**
* @deprecated as of 1.481
* Subsumed by {@link #settings}, maps to {@link FilePathSettingsProvider}
*/
private transient String alternateSettings;
/**
* Default goals specified in POM. Can be null.
......@@ -244,19 +256,80 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
/**
* @since 1.426
* @deprecated since 1.484 settings are provided by {@link #settings}
*/
private String settingConfigId;
/**
* @since 1.426
* @deprecated since 1.484 settings are provided by {@link #globalSettings}
*/
private String globalSettingConfigId;
/**
* used temporary during maven build to store file path
* @since 1.426
* @deprecated since 1.484 settings are provided by {@link #globalSettings}
*/
protected transient String globalSettingConfigPath;
/**
* @since 1.491
*/
private SettingsProvider settings = new DefaultSettingsProvider();
/**
* @since 1.491
*/
private GlobalSettingsProvider globalSettings = new DefaultGlobalSettingsProvider();
/**
* @since 1.491
*/
public Object readResolve() {
// backward compatibility, maven-plugin used to have a dependency to the config-file-provider plugin
Plugin plugin = null;
if(StringUtils.isNotBlank(this.settingConfigId) || StringUtils.isNotBlank(this.globalSettingConfigId)) {
plugin = Jenkins.getInstance().getPlugin("config-file-provider");
if(plugin == null || !plugin.getWrapper().isEnabled()){
LOGGER.severe(Messages.MavenModuleSet_readResolve_missingConfigProvider());
}
}
if (this.alternateSettings != null) {
this.settings = new FilePathSettingsProvider(alternateSettings);
this.alternateSettings = null;
} else if (plugin != null && StringUtils.isNotBlank(this.settingConfigId)) {
try {
Class<? extends SettingsProvider> legacySettings = plugin.getWrapper().classLoader.loadClass("org.jenkinsci.plugins.configfiles.maven.job.MvnSettingsProvider").asSubclass(SettingsProvider.class);
SettingsProvider newInstance = legacySettings.newInstance();
PropertyUtils.setProperty(newInstance, "settingsConfigId", this.settingConfigId);
this.settings = newInstance;
this.settingConfigId = null;
} catch (Exception e) {
// The PluginUpdateMonitor is also informing the admin about the update (via hudson.maven.PluginImpl.init())
LOGGER.severe(Messages.MavenModuleSet_readResolve_updateConfigProvider(settingConfigId));
e.printStackTrace();
}
}
if (plugin != null && StringUtils.isNotBlank(this.globalSettingConfigId)) {
try {
Class<? extends GlobalSettingsProvider> legacySettings = plugin.getWrapper().classLoader.loadClass("org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider").asSubclass(GlobalSettingsProvider.class);
GlobalSettingsProvider newInstance = legacySettings.newInstance();
PropertyUtils.setProperty(newInstance, "settingsConfigId", this.globalSettingConfigId);
this.globalSettings = newInstance;
this.globalSettingConfigId = null;
} catch (Exception e) {
// The PluginUpdateMonitor is also informing the admin about the update (via hudson.maven.PluginImpl.init())
LOGGER.severe(Messages.MavenModuleSet_readResolve_updateConfigProvider(globalSettingConfigId));
e.printStackTrace();
}
}
return this;
}
/**
* Reporters configured at {@link MavenModuleSet} level. Applies to all {@link MavenModule} builds.
*/
......@@ -509,6 +582,20 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
public void setLocalRepository(LocalRepositoryLocator localRepository) {
this.localRepository = localRepository;
}
/**
* @since 1.491
*/
public void setSettings(SettingsProvider settings) {
this.settings = settings;
}
/**
* @since 1.491
*/
public void setGlobalSettings(GlobalSettingsProvider globalSettings) {
this.globalSettings = globalSettings;
}
public void setIgnoreUpstremChanges(boolean ignoreUpstremChanges) {
this.ignoreUpstremChanges = ignoreUpstremChanges;
......@@ -544,35 +631,17 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
}
/**
* @since 1.426
* @return
*/
public String getSettingConfigId() {
return settingConfigId;
}
/**
* @since 1.426
* @param settingConfigId
*/
public void setSettingConfigId( String settingConfigId ) {
this.settingConfigId = settingConfigId;
}
/**
* @since 1.426
* @return
* @since 1.481
*/
public String getGlobalSettingConfigId() {
return globalSettingConfigId;
public SettingsProvider getSettings() {
return settings != null ? settings : new DefaultSettingsProvider();
}
/**
* @since 1.426
* @param globalSettingConfigId
* @since 1.481
*/
public void setGlobalSettingConfigId( String globalSettingConfigId ) {
this.globalSettingConfigId = globalSettingConfigId;
public GlobalSettingsProvider getGlobalSettings() {
return globalSettings != null ? globalSettings : new DefaultGlobalSettingsProvider();
}
/**
......@@ -881,6 +950,7 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
/**
* Gets the workspace-relative path to an alternative Maven settings.xml file.
* @deprecated as of 1.481
*/
public String getAlternateSettings() {
return alternateSettings;
......@@ -888,10 +958,10 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
/**
* Sets the workspace-relative path to an alternative Maven settings.xml file.
* @deprecated as of 1.481
*/
public void setAlternateSettings(String alternateSettings) throws IOException {
this.alternateSettings = alternateSettings;
save();
}
/**
......@@ -948,22 +1018,6 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
}
}
/**
* @since 1.426
* @return
*/
public List<SettingConfig> getAllMavenSettingsConfigs() {
return SettingsProviderUtils.getAllMavenSettingsConfigs();
}
/**
* @since 1.426
* @return
*/
public List<SettingConfig> getAllGlobalMavenSettingsConfigs() {
return SettingsProviderUtils.getAllGlobalMavenSettingsConfigs();
}
/**
* Set mavenOpts.
*/
......@@ -1046,8 +1100,10 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
if(rootPOM!=null && rootPOM.equals("pom.xml")) rootPOM=null; // normalization
goals = Util.fixEmpty(req.getParameter("goals").trim());
alternateSettings = Util.fixEmpty(req.getParameter("alternateSettings").trim());
mavenOpts = Util.fixEmpty(req.getParameter("mavenOpts").trim());
settings = SettingsProvider.parseSettingsProvider(req);
globalSettings = GlobalSettingsProvider.parseSettingsProvider(req);
mavenName = req.getParameter("maven_version");
aggregatorStyleBuild = !req.hasParameter("maven.perModuleBuild");
if (json.optBoolean("usePrivateRepository"))
......@@ -1065,8 +1121,6 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
reporters.rebuild(req,json,MavenReporters.getConfigurableList());
publishers.rebuildHetero(req, json, Publisher.all(), "publisher");
buildWrappers.rebuild(req,json,BuildWrappers.getFor(this));
settingConfigId = req.getParameter( "maven.mavenSettingsConfigId" );
globalSettingConfigId = req.getParameter( "maven.mavenGlobalSettingConfigId" );
runPostStepsIfResult = Result.fromString(req.getParameter( "post-steps.runIfResult"));
prebuilders.rebuildHetero(req,json, Builder.all(), "prebuilder");
......@@ -1096,28 +1150,6 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
return FormValidation.ok();
}
/**
* Check that the provided file is a relative path. And check that it exists, just in case.
*/
public FormValidation doCheckFileRelative(@QueryParameter String value) throws IOException, ServletException {
String v = fixEmpty(value);
if ((v == null) || (v.length() == 0)) {
// Null values are allowed.
return FormValidation.ok();
}
if ((v.startsWith("/")) || (v.startsWith("\\")) || (v.matches("^\\w\\:\\\\.*"))) {
return FormValidation.error(Messages.MavenModuleSet_AlternateSettingsRelativePath());
}
MavenModuleSetBuild lb = getLastBuild();
if (lb!=null) {
FilePath ws = lb.getWorkspace();
if(ws!=null)
return ws.validateRelativePath(value,true,true);
}
return FormValidation.ok();
}
public DescriptorImpl getDescriptor() {
return DESCRIPTOR;
}
......@@ -1151,7 +1183,15 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
mavenValidationLevels.put( "LEVEL_MAVEN_3_1", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
mavenValidationLevels.put( "LEVEL_STRICT", ModelBuildingRequest.VALIDATION_LEVEL_STRICT );
}
public List<SettingsProviderDescriptor> getSettingsProviders() {
return Jenkins.getInstance().getDescriptorList(SettingsProvider.class);
}
public List<GlobalSettingsProviderDescriptor> getGlobalSettingsProviders() {
return Jenkins.getInstance().getDescriptorList(GlobalSettingsProvider.class);
}
public String getGlobalMavenOpts() {
return globalMavenOpts;
}
......@@ -1214,4 +1254,6 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
JUnitResultArchiver.class // done by SurefireArchiver
));
}
private static final Logger LOGGER = Logger.getLogger(MavenModuleSet.class.getName());
}
......@@ -34,8 +34,6 @@ import hudson.maven.MavenBuild.ProxyImpl2;
import hudson.maven.reporters.MavenAggregatedArtifactRecord;
import hudson.maven.reporters.MavenFingerprinter;
import hudson.maven.reporters.MavenMailer;
import hudson.maven.settings.SettingConfig;
import hudson.maven.settings.SettingsProviderUtils;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Build;
......@@ -83,6 +81,8 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import jenkins.mvn.GlobalSettingsProvider;
import jenkins.mvn.SettingsProvider;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
......@@ -558,10 +558,9 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
private Map<ModuleName,MavenBuild.ProxyImpl2> proxies;
protected Result doRun(final BuildListener listener) throws Exception {
Result r = null;
PrintStream logger = listener.getLogger();
FilePath remoteSettings = null, remoteGlobalSettings = null;
try {
......@@ -581,7 +580,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
setMavenVersionUsed( mavenVersion );
LOGGER.fine(getFullDisplayName()+" is building with mavenVersion " + mavenVersion + " from file " + mavenInformation.getVersionResourcePath());
if(!project.isAggregatorStyleBuild()) {
parsePoms(listener, logger, envVars, mvn, mavenVersion);
// start module builds
......@@ -604,7 +603,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
buildEnvironments.add(e);
e.buildEnvVars(envVars); // #3502: too late for getEnvironment to do this
}
// run pre build steps
if(!preBuild(listener,project.getPrebuilders())
|| !preBuild(listener,project.getPostbuilders())
......@@ -618,39 +617,6 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
return r;
}
String settingsConfigId = project.getSettingConfigId();
if (StringUtils.isNotBlank(settingsConfigId)) {
SettingConfig settingsConfig = SettingsProviderUtils.findSettings(settingsConfigId);
if (settingsConfig == null) {
logger.println(" your Apache Maven build is setup to use a config with id " + settingsConfigId
+ " but cannot find the config");
} else {
logger.println("using settings config with name " + settingsConfig.name);
if (settingsConfig.content != null ) {
remoteSettings = SettingsProviderUtils.copyConfigContentToFilePath( settingsConfig, getWorkspace() );
project.setAlternateSettings( remoteSettings.getRemote() );
}
}
}
String globalSettingsConfigId = project.getGlobalSettingConfigId();
if (StringUtils.isNotBlank(globalSettingsConfigId)) {
SettingConfig settingsConfig = SettingsProviderUtils.findSettings(globalSettingsConfigId);
if (settingsConfig == null) {
logger.println(" your Apache Maven build is setup to use a global settings config with id " + globalSettingsConfigId
+ " but cannot find the config");
} else {
logger.println("using global settings config with name " + settingsConfig.name);
if (settingsConfig.content != null ) {
remoteGlobalSettings = SettingsProviderUtils.copyConfigContentToFilePath( settingsConfig, getWorkspace() );
project.globalSettingConfigPath = remoteGlobalSettings.getRemote();
}
}
} else {
// make sure the transient field is clean
project.globalSettingConfigPath = null;
}
parsePoms(listener, logger, envVars, mvn, mavenVersion); // #5428 : do pre-build *before* parsing pom
SplittableBuildListener slistener = new SplittableBuildListener(listener);
proxies = new HashMap<ModuleName, ProxyImpl2>();
......@@ -719,10 +685,13 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
if(localRepo!=null)
margs.add("-Dmaven.repo.local="+localRepo.getRemote());
if (project.globalSettingConfigPath != null)
margs.add("-gs" , project.globalSettingConfigPath);
FilePath remoteSettings = SettingsProvider.getSettingsFilePath(project.getSettings(), MavenModuleSetBuild.this, listener);
if (remoteSettings != null)
margs.add("-s" , remoteSettings.getRemote());
FilePath remoteGlobalSettings = GlobalSettingsProvider.getSettingsFilePath(project.getGlobalSettings(), MavenModuleSetBuild.this, listener);
if (remoteGlobalSettings != null)
margs.add("-gs" , remoteGlobalSettings.getRemote());
// If incrementalBuild is set
// and the previous build didn't specify that we need a full build
......@@ -738,18 +707,6 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
margs.add("-pl", Util.join(changedModules, ","));
}
if (project.getAlternateSettings() != null) {
if (IOUtils.isAbsolute(project.getAlternateSettings())) {
margs.add("-s").add(project.getAlternateSettings());
} else {
FilePath mrSettings = getModuleRoot().child(project.getAlternateSettings());
FilePath wsSettings = getWorkspace().child(project.getAlternateSettings());
if (!wsSettings.exists() && mrSettings.exists())
wsSettings = mrSettings;
margs.add("-s").add(wsSettings.getRemote());
}
}
final List<MavenArgumentInterceptorAction> argInterceptors = this.getBuild().getActions(MavenArgumentInterceptorAction.class);
......@@ -845,18 +802,6 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
logger.println("project.getRootModule()="+project.getRootModule());
throw e;
} finally {
if (StringUtils.isNotBlank(project.getSettingConfigId())) {
// restore to null if as was modified
project.setAlternateSettings( null );
project.save();
}
// delete tmp files used for MavenSettingsProvider
if (remoteSettings != null) {
remoteSettings.delete();
}
if (remoteGlobalSettings != null ) {
remoteGlobalSettings.delete();
}
}
}
......@@ -1055,7 +1000,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
private final Properties properties;
private final String privateRepository;
private final String alternateSettings;
private final String globalSetings;
private final String globalSettings;
private final boolean nonRecursive;
// We're called against the module root, not the workspace, which can cause a lot of confusion.
private final String workspaceProper;
......@@ -1109,9 +1054,10 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
} else {
this.privateRepository = null;
}
// TODO maybe in goals with -s,--settings
// or -Dmaven.repo.local
this.alternateSettings = project.getAlternateSettings();
this.alternateSettings = SettingsProvider.getSettingsRemotePath(project.getSettings(), build, listener);
this.globalSettings = GlobalSettingsProvider.getSettingsRemotePath(project.getGlobalSettings(), build, listener);
this.mavenVersion = mavenVersion;
this.resolveDependencies = project.isResolveDependencies();
this.processPlugins = project.isProcessPlugins();
......@@ -1120,7 +1066,6 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
project.getScm().getModuleRoot( build.getWorkspace(), project.getLastBuild() ).getRemote();
this.mavenValidationLevel = project.getMavenValidationLevel();
this.globalSetings = project.globalSettingConfigPath;
}
private boolean isUpdateSnapshots(String goals) {
......@@ -1196,8 +1141,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
mavenEmbedderRequest.setProcessPlugins( this.processPlugins );
mavenEmbedderRequest.setResolveDependencies( this.resolveDependencies );
if (globalSetings != null) {
mavenEmbedderRequest.setGlobalSettings( new File(globalSetings) );
if (globalSettings != null) {
mavenEmbedderRequest.setGlobalSettings( new File(globalSettings) );
}
// FIXME handle 3.1 level when version will be here : no rush :-)
......
......@@ -30,6 +30,7 @@ import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import jenkins.model.Jenkins;
import jenkins.mvn.SettingsProvider;
import hudson.model.TaskListener;
import hudson.tasks.Maven.MavenInstallation;
import hudson.tasks.Maven.ProjectWithMaven;
......@@ -99,7 +100,8 @@ public class MavenUtil {
m = ((ProjectWithMaven) project).inferMavenInstallation().forNode(Jenkins.getInstance(),listener);
}
if (project instanceof MavenModuleSet) {
String altSet = ((MavenModuleSet) project).getAlternateSettings();
String altSet = SettingsProvider.getSettingsRemotePath(((MavenModuleSet) project).getSettings(), build, listener);
settingsLoc = (altSet == null) ? null
: new File(build.getWorkspace().child(altSet).getRemote());
......
......@@ -24,10 +24,14 @@
package hudson.maven;
import hudson.Plugin;
import hudson.PluginManager.PluginUpdateMonitor;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.model.Items;
/**
* @author huybrechts
* @author Dominik Bartholdi (imod)
*/
public class PluginImpl extends Plugin {
@Override
......@@ -38,6 +42,16 @@ public class PluginImpl extends Plugin {
Items.XSTREAM.alias("dependency", ModuleDependency.class);
Items.XSTREAM.alias("maven2-module-set", MavenModule.class); // this was a bug, but now we need to keep it for compatibility
Items.XSTREAM.alias("maven2-moduleset", MavenModuleSet.class);
}
/**
* @since 1.491
*/
@Initializer(after=InitMilestone.PLUGINS_STARTED)
public static void init(){
// inform the admin if there is a version of the config file provider installed which is not compatible
PluginUpdateMonitor.getInstance().ifPluginOlderThenReport("config-file-provider", "2.3", Messages.PluginImpl_updateConfiProvider());
}
}
......@@ -29,8 +29,6 @@ import hudson.Launcher;
import hudson.Util;
import hudson.maven.reporters.MavenAbstractArtifactRecord;
import hudson.maven.reporters.MavenArtifactRecord;
import hudson.maven.settings.SettingConfig;
import hudson.maven.settings.SettingsProviderUtils;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
......@@ -54,9 +52,10 @@ import java.util.Map.Entry;
import java.util.Properties;
import jenkins.model.Jenkins;
import jenkins.mvn.GlobalSettingsProvider;
import jenkins.mvn.SettingsProvider;
import net.sf.json.JSONObject;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
......@@ -227,42 +226,12 @@ public class RedeployPublisher extends Recorder {
// TODO check if the remoteSettings has a localRepository configured and disabled it
String settingsConfigId = mavenModuleSet.getSettingConfigId();
String altSettingsPath = null;
if (!StringUtils.isBlank(settingsConfigId)) {
SettingConfig config = SettingsProviderUtils.findSettings(settingsConfigId);
if (config == null) {
listener.getLogger().println(
" your Apache Maven build is setup to use a config with id " + settingsConfigId
+ " but cannot find the config" );
} else {
listener.getLogger().println( "redeploy publisher using settings config with name " + config.name );
if (config.content != null ) {
remoteSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFilePath( config, build.getWorkspace() );
altSettingsPath = remoteSettingsFromConfig.getRemote();
}
}
}
if (mavenModuleSet.getAlternateSettings() != null ) {
altSettingsPath = mavenModuleSet.getAlternateSettings();
String altSettingsPath = SettingsProvider.getSettingsRemotePath(((MavenModuleSet) project).getSettings(), build, listener);
String remoteGlobalSettingsPath = GlobalSettingsProvider.getSettingsRemotePath(((MavenModuleSet) project).getGlobalSettings(), build, listener);
if(remoteGlobalSettingsPath != null){
remoteGlobalSettingsFromConfig = new File(remoteGlobalSettingsPath);
}
String globalSettingsConfigId = mavenModuleSet.getGlobalSettingConfigId();
if (!StringUtils.isBlank(globalSettingsConfigId)) {
SettingConfig config = SettingsProviderUtils.findSettings(globalSettingsConfigId);
if (config == null) {
listener.getLogger().println(
" your Apache Maven build is setup to use a global settings config with id "
+ globalSettingsConfigId + " but cannot find the config" );
} else {
listener.getLogger().println( "redeploy publisher using global settings config with name " + config.name );
if (config.content != null ) {
remoteGlobalSettingsFromConfig = SettingsProviderUtils.copyConfigContentToFile( config );
}
}
}
Node buildNode = build.getBuiltOn();
if(buildNode == null) {
......@@ -280,10 +249,9 @@ public class RedeployPublisher extends Recorder {
FilePath filePath = new FilePath( tmpSettings );
FilePath remoteSettings = build.getWorkspace().child( altSettingsPath );
if (!remoteSettings.exists()) {
// JENKINS-9084 we finally use $M2_HOME/conf/settings.xml as maven do
// JENKINS-9084 we finally use $M2_HOME/conf/settings.xml as maven does
String mavenHome =
((MavenModuleSet) project).getMaven().forNode(buildNode, listener ).getHome();
String mavenHome = ((MavenModuleSet) project).getMaven().forNode(buildNode, listener ).getHome();
String settingsPath = mavenHome + "/conf/settings.xml";
remoteSettings = build.getWorkspace().child( settingsPath);
}
......@@ -312,10 +280,6 @@ public class RedeployPublisher extends Recorder {
if (tmpSettings != null) {
tmpSettings.delete();
}
if (remoteSettingsFromConfig != null) {
remoteSettingsFromConfig.delete();
}
FileUtils.deleteQuietly(remoteGlobalSettingsFromConfig);
}
}
......
/*
The MIT License
Copyright (c) 2012, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package hudson.maven.settings;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
public class ConfigProviderDelegate implements ConfigProviderFacade {
private static final Logger LOGGER = Logger.getLogger(ConfigProviderDelegate.class.getName());
private final ConfigProviderFacade cpf;
public ConfigProviderDelegate() {
if (Jenkins.getInstance().getPlugin("config-file-provider") != null) {
cpf = new ConfigProviderMediator();
} else {
LOGGER.warning("'config-file-provider' plugin not installed..., administration of setting.xml will not be available!");
cpf = new DefaultConfigProviderFacade();
}
}
@Override
public List<SettingConfig> getAllGlobalMavenSettingsConfigs() {
return cpf.getAllGlobalMavenSettingsConfigs();
}
@Override
public List<SettingConfig> getAllMavenSettingsConfigs() {
return cpf.getAllMavenSettingsConfigs();
}
@Override
public SettingConfig findConfig(String settingsConfigId) {
return cpf.findConfig(settingsConfigId);
}
private static final class DefaultConfigProviderFacade implements ConfigProviderFacade {
@Override
public List<SettingConfig> getAllGlobalMavenSettingsConfigs() {
return Collections.emptyList();
}
@Override
public List<SettingConfig> getAllMavenSettingsConfigs() {
return Collections.emptyList();
}
@Override
public SettingConfig findConfig(String settingsConfigId) {
return null;
}
}
}
/*
The MIT License
Copyright (c) 2012, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package hudson.maven.settings;
import java.util.List;
public interface ConfigProviderFacade {
/**
* Gets all maven (non global) settings available
*
* @since 1.426
* @return list of all settings
*/
public List<SettingConfig> getAllMavenSettingsConfigs();
/**
* Gets all global maven settings
*
* @since 1.426
* @return list of all global settings
*/
public List<SettingConfig> getAllGlobalMavenSettingsConfigs();
/**
* Gets a settings config by its id.
*
* @param settingsConfigId
* the id of the config to get
* @return the settings config
*/
public SettingConfig findConfig(String settingsConfigId);
}
\ No newline at end of file
/*
The MIT License
Copyright (c) 2012, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package hudson.maven.settings;
import hudson.ExtensionList;
import java.util.ArrayList;
import java.util.List;
import jenkins.model.Jenkins;
import org.jenkinsci.lib.configprovider.ConfigProvider;
import org.jenkinsci.lib.configprovider.model.Config;
import org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig.GlobalMavenSettingsConfigProvider;
import org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig.MavenSettingsConfigProvider;
public class ConfigProviderMediator implements ConfigProviderFacade {
/**
* @see hudson.maven.settings.ConfigProviderFacade#getAllMavenSettingsConfigs()
*/
@Override
public List<SettingConfig> getAllMavenSettingsConfigs() {
final ExtensionList<MavenSettingsConfigProvider> configProviders = Jenkins.getInstance().getExtensionList(MavenSettingsConfigProvider.class);
List<SettingConfig> mavenSettingsConfigs = new ArrayList<SettingConfig>();
if (configProviders.size() > 0) {
for (ConfigProvider configProvider : configProviders) {
for (Config config : configProvider.getAllConfigs()) {
mavenSettingsConfigs.add(new SettingConfig(config.id, config.name, config.comment, config.content));
}
}
}
return mavenSettingsConfigs;
}
/**
* @see hudson.maven.settings.ConfigProviderFacade#getAllGlobalMavenSettingsConfigs()
*/
@Override
public List<SettingConfig> getAllGlobalMavenSettingsConfigs() {
final ExtensionList<GlobalMavenSettingsConfigProvider> configProviders = Jenkins.getInstance()
.getExtensionList(GlobalMavenSettingsConfigProvider.class);
List<SettingConfig> globalMavenSettingsConfigs = new ArrayList<SettingConfig>();
if (configProviders.size() > 0) {
for (ConfigProvider configProvider : configProviders) {
for (Config config : configProvider.getAllConfigs()) {
globalMavenSettingsConfigs.add(new SettingConfig(config.id, config.name, config.comment, config.content));
}
}
}
return globalMavenSettingsConfigs;
}
/**
* Utility method to retrieve SettingConfig
*
* @param settingsConfigId
* the id to get the config for
* @return SettingConfig the config
*/
public SettingConfig findConfig(String settingsConfigId) {
ExtensionList<ConfigProvider> configProviders = ConfigProvider.all();
if (configProviders.size() > 0) {
for (ConfigProvider configProvider : configProviders) {
if (configProvider.isResponsibleFor(settingsConfigId)) {
final Config config = configProvider.getConfigById(settingsConfigId);
return new SettingConfig(config.id, config.name, config.comment, config.content);
}
}
}
return null;
}
}
/*
The MIT License
Copyright (c) 2012, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package hudson.maven.settings;
import java.io.Serializable;
/**
* Represents a particular settings file and its content - actually its a shadow object to hold the config data coming from a ConfigProvider of the 'config-provider' plugin.
*
* @author domi
*/
public class SettingConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* a unique id along all providers!
*/
public final String id;
public final String name;
/**
* Any note that the author of this configuration wants to associate with this.
*/
public final String comment;
/**
* Content of the file as-is.
*/
public final String content;
public SettingConfig(String id, String name, String comment, String content) {
this.id = id == null ? String.valueOf(System.currentTimeMillis()) : id;
this.name = name;
this.comment = comment;
this.content = content;
}
@Override
public String toString() {
return "[SettingConfig: id=" + id + ", name=" + name + "]";
}
}
/*
* Copyright 20011 Talend, Olivier Lamy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package hudson.maven.settings;
import hudson.FilePath;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.commons.io.FileUtils;
/**
* @author Olivier Lamy
* @author Dominik Bartholdi (imod)
* @since 1.426
*/
public class SettingsProviderUtils {
private static ConfigProviderFacade configProvider = new ConfigProviderDelegate();
private SettingsProviderUtils() {
}
/**
* @since 1.426
* @return
*/
public static List<SettingConfig> getAllMavenSettingsConfigs() {
return configProvider.getAllMavenSettingsConfigs();
}
/**
* @since 1.426
* @return
*/
public static List<SettingConfig> getAllGlobalMavenSettingsConfigs() {
return configProvider.getAllGlobalMavenSettingsConfigs();
}
/**
* utility method to retrieve Config of type (MavenSettingsProvider etc..)
*
* @param settingsConfigId
* @param type
* @return SettingConfig
*/
public static SettingConfig findSettings(String settingsConfigId) {
return configProvider.findConfig(settingsConfigId);
}
/**
*
* @param config
* @param workspace
*/
public static FilePath copyConfigContentToFilePath(SettingConfig config, FilePath workspace) throws IOException, InterruptedException {
return workspace.createTextTempFile("config", ".tmp", config.content, false);
}
/**
* @return a temp file which must be deleted after use
*/
public static File copyConfigContentToFile(SettingConfig config) throws IOException {
File tmpContentFile = File.createTempFile("config", "tmp");
FileUtils.writeStringToFile(tmpContentFile, config.content);
return tmpContentFile;
}
}
......@@ -79,13 +79,7 @@ THE SOFTWARE.
<f:entry title="MAVEN_OPTS" help="/plugin/maven-plugin/maven-opts.html">
<f:expandableTextbox name="mavenOpts" value="${it.mavenOpts}" />
</f:entry>
<f:entry title="${%Alternate settings file}"
help="/plugin/maven-plugin/alternate-settings.html">
<f:textbox name="alternateSettings"
value="${it.alternateSettings}"
checkUrl="'checkFileRelative?value='+escape(this.value)"
/>
</f:entry>
<f:optionalBlock name="maven.incrementalBuild"
title="${%Incremental build - only build changed modules}"
help="/plugin/maven-plugin/incremental.html"
......@@ -117,27 +111,15 @@ THE SOFTWARE.
<f:option selected="${it.mavenValidationLevel == level.value}" value="${level.value}">${level.key}</f:option>
</j:forEach>
</select>
</f:entry>
<f:entry title="${%Settings file}" field="settings" help="/help/tasks/maven/maven-settings.html">
<f:dropdownDescriptorSelector descriptors="${descriptor.settingsProviders}"/>
</f:entry>
<j:set var="mavenSettingsConfigs" value="${it.allMavenSettingsConfigs}" />
<f:entry title="${%Maven Settings Configs}">
<select class="setting-input" name="maven.mavenSettingsConfigId">
<f:option value="">- select -</f:option>
<j:forEach var="settingConfig" items="${mavenSettingsConfigs}">
<f:option selected="${it.settingConfigId == settingConfig.id}" value="${settingConfig.id}">${settingConfig.name}</f:option>
</j:forEach>
</select>
</f:entry>
<j:set var="mavenGlobalSettingsConfigs" value="${it.allGlobalMavenSettingsConfigs}" />
<f:entry title="${%Maven Global Settings Configs}">
<select class="setting-input" name="maven.mavenGlobalSettingConfigId">
<f:option value="">- select -</f:option>
<j:forEach var="globalSettingConfig" items="${mavenGlobalSettingsConfigs}">
<f:option selected="${it.globalSettingConfigId == globalSettingConfig.id}" value="${globalSettingConfig.id}">${globalSettingConfig.name}</f:option>
</j:forEach>
</select>
</f:entry>
<f:entry title="${%Global Settings file}" field="globalSettings" help="/help/tasks/maven/maven-settings.html">
<f:dropdownDescriptorSelector descriptors="${descriptor.globalSettingsProviders}"/>
</f:entry>
</f:advanced>
</f:section>
......
......@@ -32,6 +32,10 @@ MavenModule.Pronoun=Module
MavenModuleSet.DiplayName=Build a maven2/3 project
MavenModuleSet.AlternateSettingsRelativePath=Alternate settings file must be a relative path.
MavenModuleSet.readResolve_missingConfigProvider=ERROR: 'config-file-provider' is not installed or disabled, therefore the config can't be fully loaded!!
MavenModuleSet.readResolve_updateConfigProvider=ERROR: Please update the 'config-file-provider' plugin, the current version is not supported anymore! (id={0})
PluginImpl.updateConfiProvider=The current installed version of 'config-file-provider' is not compatible with this core anymore (requires >= 2.3)
MavenModuleSetBuild.DiscoveredModule=Discovered a new module {0} {1}
MavenModuleSetBuild.DownloadedArtifact=Downloaded artifact {0}/{1}
......@@ -57,3 +61,5 @@ ProcessCache.Reusing=Reusing existing maven process
RedeployPublisher.getDisplayName=Deploy artifacts to Maven repository
RedeployPublisher.RepositoryURL.Mandatory=Repository URL is mandatory
ReleaseAction.DisplayName=Release New Version
<div>
<p>
Specifies a path to an alternate settings.xml file for Maven. This
is equivalent to the -s or --settings options on the Maven command
line.
<p>
This path is relative to the workspace root.
</div>
<div>
<p>
Gibt den Pfad zu einer alternativen Settings-Datei für Maven an.
Dies entspricht der Option <tt>-s</tt> bzw. <tt>--settings</tt>
der Maven-Kommandozeile.
<p>
Der Pfad ist relativ zum Stammverzeichnis des Arbeitsbereiches.
</div>
<div>
<p>
Mavenのsettings.xmlの代替となるファイルのパスを指定します。
Mavenのコマンドラインで "-s"もしくは"--settings"オプションを指定するのと同等の機能です。
<p>
パスはワークスペースのルートからの相対パスです。
</div>
<div>
The settings element in the <code>settings.xml</code> file contains elements used to define values which configure Maven execution in various ways, like the <code>pom.xml</code>, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.
<br>
There are two locations where a <code>settings.xml</code> file per default may live:
<ul>
<li>The Maven install - default: <code>$M2_HOME/conf/settings.xml</code></li>
<li>A user's install - default: <code>${user.home}/.m2/settings.xml</code></li>
</ul>
The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.
<p>
see also: <a href="http://maven.apache.org/settings.html"><code>settings.xml</code> reference</a>
</div>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册