Skip to content
Permalink
Browse files

[JENKINS-42383] Removed maven-plugin optional dependency and using re…

…flection instead
  • Loading branch information...
v1v committed Feb 28, 2017
1 parent 0856ba2 commit e83cb3d71b4162e979c861eaec5549f4b51ff02d
@@ -109,7 +109,7 @@
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.8</version>
<optional>true</optional>
<scope>test</scope>
</dependency>

<dependency>
@@ -1,7 +1,6 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.Item;
import hudson.model.Project;
import hudson.tasks.Builder;
@@ -25,10 +24,14 @@ public GradleWrapperChecker() {
public boolean executeCheck(Item item) {
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("gradle") != null) {

if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isGradlew(((MavenModuleSet) item).getPrebuilders());
if (item.getClass().getSimpleName().equals("MavenModuleSet")) {
try {
Object getPrebuilders = item.getClass().getMethod("getPrebuilders", null).invoke(item);
if (getPrebuilders instanceof List) {
found = isGradlew((List) getPrebuilders);
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
if (item instanceof Project) {
@@ -1,7 +1,6 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.Item;
import hudson.model.Project;
import hudson.tasks.Builder;
@@ -26,9 +25,14 @@ public boolean executeCheck(Item item) {
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("groovy") != null) {

if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isSystemExit(((MavenModuleSet) item).getPrebuilders());
if (item.getClass().getSimpleName().equals("MavenModuleSet")) {
try {
Object getPrebuilders = item.getClass().getMethod("getPrebuilders", null).invoke(item);
if (getPrebuilders instanceof List) {
found = isSystemExit((List) getPrebuilders);
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
if (item instanceof Project) {
@@ -4,7 +4,6 @@
import hudson.model.Item;
import hudson.model.Project;
import hudson.tasks.Builder;
import hudson.maven.MavenModuleSet;
import hudson.tasks.CommandInterpreter;
import jenkins.model.Jenkins;
import org.jenkins.ci.plugins.jenkinslint.model.AbstractCheck;
@@ -29,9 +28,14 @@ public HardcodedScriptChecker() {
public boolean executeCheck(Item item) {
LOG.log(Level.FINE, "executeCheck " + item);
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isBuilderHarcoded(((MavenModuleSet) item).getPrebuilders());
if (item.getClass().getSimpleName().equals("MavenModuleSet")) {
try {
Object getPrebuilders = item.getClass().getMethod("getPrebuilders", null).invoke(item);
if (getPrebuilders instanceof List) {
found = isBuilderHarcoded((List) getPrebuilders);
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
if (item instanceof Project) {

0 comments on commit e83cb3d

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.