Skip to content

Commit

Permalink
Merge pull request #35 from jtnord/update-build
Browse files Browse the repository at this point in the history
Update build
  • Loading branch information
jtnord committed Dec 5, 2019
2 parents 7730679 + 539373c commit 60c8821
Show file tree
Hide file tree
Showing 17 changed files with 287 additions and 207 deletions.
200 changes: 144 additions & 56 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.509.3</version>
<version>3.54</version>
</parent>

<name>Jenkins Maven Release Plug-in Plug-in</name>
<description>A plug-in that enables you to perform releases using the maven-release-plugin from Jenkins.</description>
<url>http://wiki.jenkins-ci.org/display/JENKINS/M2+Release+Plugin</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.test.version>3.0.4</maven.test.version>
<maven.test.version>3.1.0</maven.test.version>
<java.level>8</java.level>
<!-- Flaky tests do not belong gin this project -->
<surefire.rerunFailingTestsCount>0</surefire.rerunFailingTestsCount>
</properties>

<developers>
Expand Down Expand Up @@ -51,19 +52,150 @@
</license>
</licenses>

<dependencyManagement>
<dependencies>
<dependency>
<!-- spotbugs is provided but this is compile so make sure we do not bundle this junk -->
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>3.4</version>
<exclusions>
<exclusion>
<!-- newer than ships with Jenkins (how is this possible for the maven plugin to build?) -->
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-api</artifactId>
<version>2.5.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-manager</artifactId>
<version>2.1</version>
<version>2.5.3</version>
<!-- we only need 2 classes o.a.m.shared.release.versions.DefaultVersionInfo
and o.a.m.shared.release.versions.VersionParseException
-->
<!-- requires maven a newer version of Maven than is on the CI server :( -->
<!--
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
-->
<exclusions>
<exclusion>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interactivity-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interpolation</artifactId>
</exclusion>
<exclusion>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-sec-dispatcher</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
</exclusion>
<exclusion>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</exclusion>
<exclusion>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</exclusion>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-providers-standard</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-svn-commons</artifactId>
</exclusion>
<exclusion>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>
<exclusion>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand All @@ -76,86 +208,42 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${maven.test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>${maven.test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>${maven.test.version}</version>
<groupId>org.jenkins-ci</groupId>
<artifactId>test-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>test-annotations</artifactId>
<version>1.3</version>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness-tools</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<!-- until the fix for JENKINS-18918 is available in a backported skip any apache-maven-xxx folders in classes -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>**/apache-maven-*/*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>1.96</version>
<extensions>true</extensions>
<configuration>
<compatibleSinceVersion>0.15</compatibleSinceVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@
import hudson.maven.MavenModuleSet;
import hudson.model.ParameterValue;
import hudson.model.BooleanParameterValue;
import hudson.model.Hudson;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersAction;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.PasswordParameterValue;
import hudson.model.PermalinkProjectAction;
import hudson.model.StringParameterValue;

import jenkins.model.Jenkins;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -96,14 +95,17 @@ public List<ParameterDefinition> getParameterDefinitions() {
return pds;
}

@Override
public List<Permalink> getPermalinks() {
return PERMALINKS;
}

@Override
public String getDisplayName() {
return Messages.ReleaseAction_perform_release_name();
}

@Override
public String getIconFileName() {
if (M2ReleaseBuildWrapper.hasReleasePermission(project)) {
return "installer.gif"; //$NON-NLS-1$
Expand All @@ -112,6 +114,8 @@ public String getIconFileName() {
return null;
}


@Override
public String getUrlName() {
return "m2release"; //$NON-NLS-1$
}
Expand Down Expand Up @@ -242,13 +246,13 @@ public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOExceptio
// get the normal job parameters (adapted from
// hudson.model.ParametersDefinitionProperty._doBuild(StaplerRequest,
// StaplerResponse))
List<ParameterValue> values = new ArrayList<ParameterValue>();
List<ParameterValue> values = new ArrayList<>();
JSONObject formData = req.getSubmittedForm();
JSONArray a = JSONArray.fromObject(formData.get("parameter"));
for (Object o : a) {
if (o instanceof JSONObject) {
JSONObject jo = (JSONObject) o;
if (jo != null && !jo.isNullObject()) {
if (!jo.isNullObject()) {
String name = jo.optString("name");
if (name != null) {
ParameterDefinition d = getParameterDefinition(name);
Expand Down Expand Up @@ -292,7 +296,7 @@ public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOExceptio
arguments.setScmTagName(scmTag);
arguments.setScmCommentPrefix(scmCommentPrefix);
arguments.setAppendHusonUserName(appendHusonUserName);
arguments.setHudsonUserName(Hudson.getAuthentication().getName());
arguments.setHudsonUserName(Jenkins.getAuthentication().getName());


if (project.scheduleBuild(0, new ReleaseCause(), parameters, arguments)) {
Expand Down Expand Up @@ -362,7 +366,7 @@ public StaplerRequestWrapper(StaplerRequest request) throws ServletException {
* @param key
* @return
*/
private String getString(String key) throws javax.servlet.ServletException, java.io.IOException {
private String getString(String key) {
if (isMultipartEncoded) {
// borrowed from org.kohsuke.staple.RequestImpl
FileItem item = parsedFormData.get(key);
Expand All @@ -382,7 +386,7 @@ private String getString(String key) throws javax.servlet.ServletException, java
throw new IllegalArgumentException("Parameter not found: " + key);
}
} else {
return (String) (((Object[]) request.getParameterMap().get(key))[0]);
return request.getParameterMap().get(key)[0];
}
}

Expand All @@ -392,7 +396,7 @@ private String getString(String key) throws javax.servlet.ServletException, java
* @param key parameter name
* @return
*/
private boolean containsKey(String key) throws javax.servlet.ServletException, java.io.IOException {
private boolean containsKey(String key) {
// JENKINS-16043, POST can be multipart encoded if there's a file parameter in the job
if (isMultipartEncoded) {
return parsedFormData.containsKey(key);
Expand Down

0 comments on commit 60c8821

Please sign in to comment.