How to force the installation of a plugin using the JenkinsRule?

45 views
Skip to first unread message

Victor Martinez

unread,
Jul 27, 2015, 3:31:21 PM7/27/15
to Jenkins Developers
Hi there,

 I'm using the JenkinsRule in the test phase of a particular plugin development and I would like to know how I can install a particular plugin in the UT phase. For instance:

 
pom.xml

...

  <dependencies>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>gradle</artifactId>
      <version>1.24</version>
      <scope>test</scope>
    </dependency>
...

// functional code

if (Jenkins.getInstance().pluginManager.getPlugin("gradle") != null) {
   LOG.log(Level.FINE, "Gradlew is installed");
} else {
   LOG.log(Level.FINE, "Gradlew is NOT installed");
}

// UI

@Test public void testJobWithGradlew() throws Exception {
        FreeStyleProject project = j.createFreeStyleProject("WithWrapper");
        project.getBuildersList().add(new hudson.plugins.gradle.Gradle("description","switches","tasks","rootBuildScriptDir","buildFile","gradleName", true, false, false, false));
        assertFalse(checker.executeCheck(project));
}
        


For some reason the gradle plugin is not installed when I run mvn test, actually it's not installed and I don't see those traces when I run the testJobWithGradlew test. How can I force that plugin to be installed in the Test Instance?

Thanks
Reply all
Reply to author
Forward
0 new messages