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

86 views
Skip to first unread message

Victor Martinez

unread,
Jul 27, 2015, 3:30:49 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

Jesse Glick

unread,
Jul 27, 2015, 3:56:10 PM7/27/15
to Jenkins Dev
On Mon, Jul 27, 2015 at 3:30 PM, Victor Martinez
<victormar...@gmail.com> wrote:
> For some reason the gradle plugin is not installed when I run mvn test

Not sure, it works for me.

Victor Martinez

unread,
Jul 29, 2015, 2:10:07 PM7/29/15
to Jenkins Developers, jgl...@cloudbees.com
Thanks Jesse,

 For some weird reason it didn't work when I ran it and after cloning that repo again it works. Maybe some corruption within my workspace. 

Thanks for you help
Reply all
Reply to author
Forward
0 new messages