Dimitri
Dimitri

Reputation: 8290

Unable to test Jenkins plugin

I am actually trying to develop a Jenkins plugin using maven but I am unable to test it.

I created my project with the command mvn -cpu hpi:create. I called the project jenkins-plugin-tutorial. I packaged it with mvn package or mvn install and run the Jenkins server with mvn hpi:run.

By default, there is a HelloWorlBuilder for testing purpose that should appear at the Jenkins configuration page (Jenkins Menu -> Manage Jenkins -> Configure System) or under the Build section, but it does not display.

I followed these two tutorials (here and here) step by step many times by making sure that I do not make a mistake but it still dont work.

Maybe I have made something wrong. Can somebody gives me some hint how to correct my errors.

Upvotes: 5

Views: 1672

Answers (2)

Dimitri
Dimitri

Reputation: 8290

I finally find the answer to my questions. The problem is that I was using an old version of maven, the 2.2.1 version. So I change to the last version, 3.0.4, everything is fine now.

Upvotes: 1

hyde
hyde

Reputation: 62908

In pom.xml, try changing parent to this:

<parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>1.454</version>
</parent>

I just did quick test with that hpi:create, and it worked for me, I got both global and job config things as expected, but I had to do that change to pom.xml, before I got it to compile.

That is, I did:

  • mvn hpi:create
  • entered groupId foo.hyde.jenkins.plugins, artifactId hello-world when prompted.
  • cd hello-world
  • mvn install failed
  • Edit pom.xml to change the parent
  • mvn install succeeded
  • mvn hpi:run -Djetty.port=8092 succeeded (Using that port because other Jenkins is already in default port, otherwise -D... not needed.)
  • Go to http://localhost:8092, check global config, create job and add the build step

And it worked for me.

I'm using Maven 2, version 2.2.1.

Upvotes: 6

Related Questions