Skip to content

Commit

Permalink
Merge pull request #25 from alecharp/modernize-project-configuration
Browse files Browse the repository at this point in the history
Modernize project configuration
  • Loading branch information
phreakadelle committed May 20, 2022
2 parents 7987a93 + 3a5c9a7 commit 9270be2
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 73 deletions.
12 changes: 5 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!groovy

// Don't test plugin compatibility - exceeds 1 hour timeout
// Allow failing tests to retry execution
// buildPlugin(failFast: false)

// Test plugin compatbility to latest Jenkins LTS
// Allow failing tests to retry execution
buildPlugin(jenkinsVersions: [null, '1.651.2'], failFast: false)
buildPlugin(configurations: [
[ platform: 'linux', jdk: '11' ],
[ platform: 'windows', jdk: '11' ],
[ platform: 'linux', jdk: '17', jenkins: '2.342' ],
])
90 changes: 42 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.57</version>
<version>4.40</version>
<relativePath />
</parent>

Expand All @@ -21,86 +21,80 @@
<connection>scm:git:git@github.com:jenkinsci/maven-artifact-choicelistprovider-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/maven-artifact-choicelistprovider-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<tag>maven-artifact-choicelistprovider-1.3.3</tag>
<tag>HEAD</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jenkins.version>1.609.3</jenkins.version>
<java.level>8</java.level>
<jenkins.version>2.332.3</jenkins.version>
<revision>1.4.0</revision>
<changelist>-SNAPSHOT</changelist>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.332.x</artifactId>
<version>1382.v7d694476f340</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Java 11 / JAXB Stuff / Parse Nexus XML Interface -->
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jaxb</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jaxb</artifactId>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jersey2-api</artifactId>
</dependency>

<!-- For Authentication Details -->
<dependency>
<artifactId>credentials</artifactId>
<version>2.3.19</version>
<groupId>org.jenkins-ci.plugins</groupId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
</dependency>


<!-- Basic Dependency to allow Extension of the ChoiceListProvider -->
<dependency>
<groupId>jp.ikedam.jenkins.plugins</groupId>
<artifactId>extensible-choice-parameter</artifactId>
<version>1.7.0</version>
</dependency>

<!-- All JaxWS/RS, Jersey and Glassfish Dependencies to allow RESTful Service calls -->
<!--<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>-->
<!--<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>-->
<!--<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>-->

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>2.25.1</version>
<version>1.8.0</version>
</dependency>

<!-- Necessary to parse the XML from Nexus Lucene Service -->
<dependency>
<groupId>org.sonatype.nexus.plugins</groupId>
<artifactId>nexus-indexer-lucene-model</artifactId>
<version>2.14.19-01</version>
<version>2.15.1-02</version>
<exclusions>
<exclusion> <!-- provided by jackson2-api plugin -->
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.4.1</version>
</dependency>

<!-- Necessary to parse JSON from Maven Central -->
<!-- Necessary to parse JSON from Maven Central -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.6.1</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
</dependency>

<dependency>
Expand All @@ -111,7 +105,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.19.0</version>
<version>3.22.0</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import javax.ws.rs.client.WebTarget;

import org.apache.commons.lang.StringUtils;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

Expand Down Expand Up @@ -49,8 +48,7 @@ public AbstractRESTfulVersionReader(String pURL) {
}

void init() {
ClientConfig config = new ClientConfig();
Client client = ClientBuilder.newClient(config);
Client client = ClientBuilder.newClient();

if (StringUtils.isNotEmpty(mUserName) && StringUtils.isNotEmpty(mUserPassword)) {
LOGGER.fine("setting username to: " + mUserName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.Collections;
import java.util.Map;

import javax.ws.rs.POST;

import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactChoiceListProvider;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactDescriptorImpl;
Expand All @@ -26,6 +24,7 @@
import hudson.security.ACL;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import org.kohsuke.stapler.interceptor.RequirePOST;

public class ArtifactoryChoiceListProvider extends AbstractMavenArtifactChoiceListProvider {

Expand Down Expand Up @@ -67,7 +66,7 @@ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item pItem) {
return retVal;
}

@POST
@RequirePOST
public FormValidation doTest(@AncestorInPath Item pItem, @QueryParameter String url, @QueryParameter String credentialsId, @QueryParameter String groupId,
@QueryParameter String artifactId, @QueryParameter String packaging, @QueryParameter String classifier,
@QueryParameter boolean inverseFilter, @QueryParameter String filterExpression, @QueryParameter boolean reverseOrder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.Collections;
import java.util.Map;

import javax.ws.rs.POST;

import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactChoiceListProvider;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.IVersionReader;
Expand All @@ -26,6 +24,7 @@
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import jp.ikedam.jenkins.plugins.extensible_choice_parameter.ChoiceListProvider;
import org.kohsuke.stapler.interceptor.RequirePOST;


/**
Expand Down Expand Up @@ -107,7 +106,7 @@ public FormValidation doCheckArtifactId(@QueryParameter String artifactId) {
return FormValidation.ok();
}

@POST
@RequirePOST
public FormValidation doTest(@AncestorInPath Item pItem, @QueryParameter String url, @QueryParameter String credentialsId, @QueryParameter String repositoryId,
@QueryParameter String groupId, @QueryParameter String artifactId,
@QueryParameter boolean inverseFilter, @QueryParameter String filterExpression, @QueryParameter boolean reverseOrder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ List<String> parseVersions(final String pResponse) throws VersionReaderException

StringReader reader = new StringReader(pResponse);
xmlResult = (MavenMetaData) unmarshaller.unmarshal(reader);

for(Version current : xmlResult.getVersioning().getVersions()) {
retVal.add(current.getVersion());

if (xmlResult.getVersioning() != null) {
for(Version current : xmlResult.getVersioning().getVersions()) {
retVal.add(current.getVersion());
}
}

} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import java.util.Map;
import java.util.logging.Logger;

import javax.ws.rs.POST;

import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactChoiceListProvider;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactDescriptorImpl;
Expand All @@ -29,6 +27,7 @@
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.interceptor.RequirePOST;

public class NexusChoiceListProvider extends AbstractMavenArtifactChoiceListProvider {

Expand Down Expand Up @@ -80,7 +79,7 @@ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item pItem) {
return retVal;
}

@POST
@RequirePOST
public FormValidation doTest(@AncestorInPath Item pItem, @QueryParameter String url, @QueryParameter String credentialsId, @QueryParameter String repositoryId,
@QueryParameter String groupId, @QueryParameter String artifactId, @QueryParameter String packaging, @QueryParameter String classifier,
@QueryParameter boolean inverseFilter, @QueryParameter String filterExpression, @QueryParameter boolean reverseOrder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.Collections;
import java.util.Map;

import javax.ws.rs.POST;

import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactChoiceListProvider;
import org.jenkinsci.plugins.maven_artifact_choicelistprovider.AbstractMavenArtifactDescriptorImpl;
Expand All @@ -28,6 +26,7 @@
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.interceptor.RequirePOST;

public class Nexus3ChoiceListProvider extends AbstractMavenArtifactChoiceListProvider {

Expand Down Expand Up @@ -74,7 +73,7 @@ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item pItem) {
return retVal;
}

@POST
@RequirePOST
public FormValidation doTest(@AncestorInPath Item pItem, @QueryParameter String url, @QueryParameter String credentialsId, @QueryParameter String repositoryId,
@QueryParameter String groupId, @QueryParameter String artifactId, @QueryParameter String packaging, @QueryParameter String classifier,
@QueryParameter boolean inverseFilter, @QueryParameter String filterExpression, @QueryParameter boolean reverseOrder) {
Expand Down

0 comments on commit 9270be2

Please sign in to comment.