Skip to content

Commit

Permalink
[FIXED JENKINS-15935] Merge branch 'stable_mvn' of https://github.com…
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergondza committed Sep 12, 2013
2 parents cc7cabb + 29878c8 commit 0dca811
Show file tree
Hide file tree
Showing 37 changed files with 1,381 additions and 369 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -36,3 +36,5 @@ jenkins_*.build
jenkins_*.changes
*.deb
push-build.sh
war/node_modules/
.java-version
13 changes: 6 additions & 7 deletions changelog.html
Expand Up @@ -172,15 +172,14 @@ <h3><a name=v1.521>What's new in 1.521</a> (2013/07/02)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17247">issue 17247</a>)
<li class=bug>
Edited description wasn't reflected when pressing the "Apply" button.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18436">issue 18436</a>)
<li class=bug>
Fixed a regression in remoting since 1.519 that caused FindBugs plugins to break.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18349">issue 18349</a>,
<a href="https://issues.jenkins-ci.org/browse/JENKINS-18405">issue 18405</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18436">issue 18436</a>) </ul>
<li class=rfe>
Revisited the extension point added in 1.519 that adds custom plexus components.
</ul>
<h3><a name=v1.520>What's new in 1.520</a> (2013/06/25)</h3>
</div><!--=TRUNK-END=-->

<!-- these changes are controlled by the release process. DO NOT MODIFY -->
<div id="rc" style="display:none;"><!--=BEGIN=-->
<h3><a name=v1.520>What's new in 1.520</a> <!--=DATE=--></h3>
<ul class=image>
<li class=bug>
Slave launch thread should have the background activity credential.
Expand Down
22 changes: 17 additions & 5 deletions core/src/main/java/hudson/tasks/Maven.java
Expand Up @@ -40,6 +40,7 @@
import jenkins.model.Jenkins;
import jenkins.mvn.DefaultGlobalSettingsProvider;
import jenkins.mvn.DefaultSettingsProvider;
import jenkins.mvn.GlobalMavenConfig;
import jenkins.mvn.GlobalSettingsProvider;
import jenkins.mvn.SettingsProvider;
import hudson.model.TaskListener;
Expand Down Expand Up @@ -163,8 +164,8 @@ public Maven(String targets,String name, String pom, String properties, String j
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();
this.settings = settings;
this.globalSettings = globalSettings;
}

public String getTargets() {
Expand All @@ -175,14 +176,22 @@ public String getTargets() {
* @since 1.491
*/
public SettingsProvider getSettings() {
return settings != null ? settings : new DefaultSettingsProvider();
return settings != null ? settings : GlobalMavenConfig.get().getSettingsProvider();
}

protected void setSettings(SettingsProvider settings) {
this.settings = settings;
}

/**
* @since 1.491
*/
public GlobalSettingsProvider getGlobalSettings() {
return globalSettings != null ? globalSettings : new DefaultGlobalSettingsProvider();
return globalSettings != null ? globalSettings : GlobalMavenConfig.get().getGlobalSettingsProvider();
}

protected void setGlobalSettings(GlobalSettingsProvider globalSettings) {
this.globalSettings = globalSettings;
}

public void setUsePrivateRepository(boolean usePrivateRepository) {
Expand Down Expand Up @@ -420,7 +429,10 @@ public void setInstallations(MavenInstallation... installations) {

@Override
public Builder newInstance(StaplerRequest req, JSONObject formData) throws FormException {
return req.bindJSON(Maven.class,formData);
Maven m = req.bindJSON(Maven.class,formData);
m.setSettings(GlobalMavenConfig.get().getSettingsProvider());
m.setGlobalSettings(GlobalMavenConfig.get().getGlobalSettingsProvider());
return m;
}
}

Expand Down
47 changes: 47 additions & 0 deletions core/src/main/java/jenkins/mvn/GlobalMavenConfig.java
@@ -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);
}

}
@@ -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")
}
92 changes: 64 additions & 28 deletions maven-plugin/pom.xml
Expand Up @@ -41,11 +41,11 @@ THE SOFTWARE.
<url>http://wiki.jenkins-ci.org/display/JENKINS/Maven+2+Project+Plugin</url>

<properties>
<mavenInterceptorsVersion>1.2</mavenInterceptorsVersion>
<mavenVersion>3.0.5</mavenVersion>
<mavenInterceptorsVersion>1.4</mavenInterceptorsVersion>
<mavenVersion>3.1.0</mavenVersion>
<maven.version>${mavenVersion}</maven.version>
<aetherVersion>1.13.1</aetherVersion>
<sisuInjectVersion>2.3.0</sisuInjectVersion>
<aetherVersion>0.9.0.M2</aetherVersion>
<sisuInjectVersion>0.0.0.M4</sisuInjectVersion>
<wagonVersion>2.4</wagonVersion>
</properties>

Expand Down Expand Up @@ -112,12 +112,47 @@ THE SOFTWARE.
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven3-agent</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<exclusions>
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
</exclusion>
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-bean</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven31-agent</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven3-interceptor</artifactId>
<version>${mavenInterceptorsVersion}</version>
<exclusions>
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
</exclusion>
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-bean</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven31-interceptor</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven3-interceptor-commons</artifactId>
<version>${mavenInterceptorsVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
Expand Down Expand Up @@ -147,27 +182,27 @@ THE SOFTWARE.


<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>${aetherVersion}</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-impl</artifactId>
<version>${aetherVersion}</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-spi</artifactId>
<version>${aetherVersion}</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
<version>${aetherVersion}</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
<version>${aetherVersion}</version>
<exclusions>
Expand All @@ -176,13 +211,26 @@ THE SOFTWARE.
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependency>

<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>${sisuInjectVersion}</version>
</dependency>

<!--
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
<version>${sisuInjectVersion}</version>
</dependency>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-bean</artifactId>
<version>2.4.1</version>
</dependency>
-->

<dependency>
<groupId>org.sonatype.sisu</groupId>
Expand All @@ -200,19 +248,6 @@ THE SOFTWARE.
</exclusions>
</dependency>

<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-bean</artifactId>
<version>${sisuInjectVersion}</version>
<exclusions>
<!-- prevent inclusion of one with classfifier no_aop -->
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- JENKINS-10819 : This wagon is safer and more configurable to provide http(s) support -->
<dependency>
<groupId>org.apache.maven.wagon</groupId>
Expand Down Expand Up @@ -282,7 +317,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.lib</groupId>
<artifactId>lib-jenkins-maven-embedder</artifactId>
<version>3.9</version>
<version>3.11</version>
<exclusions>
<exclusion><!-- we'll add our own patched version. see https://issues.jenkins-ci.org/browse/JENKINS-1680 -->
<groupId>jtidy</groupId>
Expand Down Expand Up @@ -421,6 +456,7 @@ THE SOFTWARE.
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
Expand Down

1 comment on commit 0dca811

@jglick
Copy link
Member

@jglick jglick commented on 0dca811 Sep 13, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beware of apparent regression (CC @olamy): JENKINS-19251

Please sign in to comment.