Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh plugin #234

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.8</version>
</extension>
</extensions>
2 changes: 2 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
4 changes: 4 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
buildPlugin(useContainerAgent: true, configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
169 changes: 84 additions & 85 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,101 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.37</version>
</parent>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<relativePath />
</parent>

<groupId>com.switchfly</groupId>
<artifactId>gitlab-merge-request-jenkins</artifactId>
<version>2.1.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<groupId>com.switchfly</groupId>
<artifactId>gitlab-merge-request-jenkins</artifactId>
<version>${revision}${changelist}</version>
<packaging>hpi</packaging>

<name>Gitlab Merge Request Builder</name>
<description>A plugin to build merge requests in Gitlab</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Merge+Request+Builder+Plugin</url>
<name>Gitlab Merge Request Builder</name>
<description>A plugin to build merge requests in Gitlab</description>

<scm>
<connection>scm:git:ssh://github.com/timols/jenkins-gitlab-merge-request-builder-plugin.git</connection>
<developerConnection>scm:git:ssh://[email protected]/timols/jenkins-gitlab-merge-request-builder-plugin.git</developerConnection>
<url>https://github.com/timols/jenkins-gitlab-merge-request-builder-plugin</url>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>timols</id>
<name>Tim Olshansky</name>
<email>[email protected]</email>
</developer>
</developers>

<developers>
<developer>
<id>timols</id>
<name>Tim Olshansky</name>
<email>[email protected]</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:https://[email protected]/${gitHubRepo}.git</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>

<properties>
<!-- which version of Jenkins is this plugin built against? -->
<java.level>8</java.level>
<jenkins.version>2.121</jenkins.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.compiler.version>1.8</java.compiler.version>
</properties>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<properties>
<revision>2.1.0</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>timols/jenkins-gitlab-merge-request-builder-plugin</gitHubRepo>
<!-- which version of Jenkins is this plugin built against? -->
<jenkins.version>2.452.3</jenkins.version>
</properties>

<dependencyManagement>
<dependencies>
<!-- JMockit's dependency must be declared before that of JUnit. -->
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.22</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.452.x</artifactId>
<version>3814.v9563d972079a_</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
shlomomdahan marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>4.0.0</version>
</dependency>
Comment on lines +60 to +64
Copy link

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @basil . This change

 <dependency>
      <groupId>io.jenkins.plugins</groupId>
      <artifactId>gitlab-api</artifactId>
    </dependency>

causes a bunch of issues. for example:

] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/shlomodahan/Desktop/jenkins_plugins/jenkins-gitlab-merge-request-builder-plugin/src/main/java/org/jenkinsci/plugins/gitlab/Gitlab.java:[5,22] package org.gitlab.api does not exist
[ERROR] /Users/shlomodahan/Desktop/jenkins_plugins/jenkins-gitlab-merge-request-builder-plugin/src/main/java/org/jenkinsci/plugins/gitlab/Gitlab.java:[6,29] package org.gitlab.api.models does not exist
[ERROR] /Users/shlomodahan/Desktop/jenkins_plugins/jenkins-gitlab-merge-request-builder-plugin/src/main/java/org/jenkinsci/plugins/gitlab/Gitlab.java:[7,29] package org.gitlab.api.models does not exist
[ERROR] /Users/shlomodahan/Desktop/jenkins_plugins/jenkins-gitlab-merge-request-builder-plugin/src/main/java/org/jenkinsci/plugins/gitlab/Gitlab.java:[14,13] cannot find symbol
  symbol:   class GitlabAPI
  location: class org.jenkinsci.plugins.gitlab.Gitlab
[ERROR] /Users/shlomodahan/Desktop/jenkins_plugins/jenkins-gitlab-merge-request-builder-plugin/src/main/java/org/jenkinsci/plugins/gitlab/Gitlab.java:[25,12] cannot find symbol
  symbol:   class GitlabAPI

likely related to how we are importing the package.

import org.gitlab.api.GitlabAPI;
import org.gitlab.api.models.GitlabCommitStatus;
import org.gitlab.api.models.GitlabProject;

What is the correct approach for handling this?

Copy link

Choose a reason for hiding this comment

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

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
shlomomdahan marked this conversation as resolved.
Show resolved Hide resolved
<!-- JMockit's dependency must be declared before that of JUnit. -->
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.22</version>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.compiler.version}</source>
<target>${java.compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import jnr.ffi.annotations.In;

/**
* Created by lordx_000 on 11/14/2015.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package org.jenkinsci.plugins.gitlab.models.webhook;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;

/**
* Created by lordx_000 on 11/14/2015.
*/
public class OnlyType {
public String object_kind;

public static OnlyType fromJson(String jsonString) throws JsonSyntaxException {
Gson g = new GsonBuilder().setPrettyPrinting().create();
return g.fromJson(jsonString, OnlyType.class);
}

}
package org.jenkinsci.plugins.gitlab.models.webhook;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;

/**
* Created by lordx_000 on 11/14/2015.
*/
public class OnlyType {
public String object_kind;

public String getObject_kind() {
return object_kind;
}

public static OnlyType fromJson(String jsonString) throws JsonSyntaxException {
Gson g = new GsonBuilder().setPrettyPrinting().create();
return g.fromJson(jsonString, OnlyType.class);
}

}