maven-hpi-plugin ... minimumJavaVersion attribute must be set...

107 views
Skip to first unread message

paul_d_smith

unread,
Dec 12, 2018, 3:25:04 PM12/12/18
to Jenkins Developers
I'm trying to create a plug-in and started from the external-jobs plugin.  Unfortunately this had a very obsolete pom.xml so I've tried updating it following some help given elsewhere in this group but I'm stuff no this error when I try to run 'mvn hpi:run'

[ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:3.0:run (default-cli) on project gitlab-pipeline-job: minimumJavaVersion attribute must be set starting from version 2.8 -> [Help 1]

Can someone give me a clue as to where I am supposed to set the minimumJavaversion because I've tried everywhere I can think of!  I even tried reading the maven-hpi-plugin source code but could not see how the field that causes this error if null could ever be set :-(.

Thanks - apologies if this is obvious - Java/Maven is not my first language!
Paul DS

Jesse Glick

unread,
Dec 12, 2018, 3:29:06 PM12/12/18
to Jenkins Dev
On Wed, Dec 12, 2018 at 3:25 PM paul_d_smith <paul_d...@hotmail.com> wrote:
> I'm trying to create a plug-in and started from the external-jobs plugin. Unfortunately this had a very obsolete pom.xml so I've tried updating it following some help given elsewhere in this group but I'm stuff no this error when I try to run 'mvn hpi:run'
>
> [ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:3.0:run (default-cli) on project gitlab-pipeline-job: minimumJavaVersion attribute must be set starting from version 2.8 -> [Help 1]

Presumably you neglected to add the `java.level` property to the POM.
I think a more helpful message would have been displayed if you have
started with something like

$ mvn clean install

since there is an Enforcer rule which will blow up if you use the
placeholder default value.

Baptiste Mathus

unread,
Dec 12, 2018, 7:56:15 PM12/12/18
to Jenkins Developers
@Paul do generally not hesitate to file a WIP PR, so we can chime in on actual code, and possibly even file a PR against your PR :). I expect it to overall take less time than trying here to understand the issue without looking at the actual code. 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3A7Edvmau1Gp73JgjFC7xGHU1xyQBW%2B8jNg5huNtG5Gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Baptiste Mathus

unread,
Dec 12, 2018, 8:02:00 PM12/12/18
to Jenkins Developers
Not sure if this is the plugin you're looking at, but had no issue with this one: https://github.com/jenkinsci/external-monitor-job-plugin/

Proposed a PR to bump to latest parent, and to JDK-8 & Jenkins 2.60.3 as min requirement. https://github.com/jenkinsci/external-monitor-job-plugin/pull/18

Paul Smith

unread,
Dec 13, 2018, 1:55:00 PM12/13/18
to jenkin...@googlegroups.com

Baptiste,

 

Thanks for the help that you have offered.  I won’t be offended if you treat me like an idiot because I’m not at all fluent in Java/Maven/Jenkins so ‘PR’, ‘WIP’ are probably blindingly obvious to you but they’re not to me I’m afraid.

 

Anyway, I looked at your proposed POM and it looks very much like the one I had but as a trial I took your complete POM, tweaked it to change a name or two and added a new dependency on com.fasterxml.jackson.jr (I suspect there is some JSON parsing already in Jenkins so I can remove this later).  I then ran:

 

mvn clean install

 

found and sorted out a few warnings and then again tried

 

mvn hpi:run

 

and I got exactly the same error as before; the error indicating that I was not specifying a minimumJavaVersion .

 

I’m going to try and download the original external-job-plugin and see if that shows the same behaviour.  I’ve very confused at the moment as to how this fails for me but seems to work for everyone else so if you have any suggestions at all, please let me know!

 

Paul DS.

Devin Nusbaum

unread,
Dec 13, 2018, 1:59:20 PM12/13/18
to jenkin...@googlegroups.com
I'm trying to create a plug-in and started from the external-jobs plugin.  Unfortunately this had a very obsolete pom.xml so I've tried updating it following some help given elsewhere in this group but I'm stuff no this error when I try to run 'mvn hpi:run'

For what it’s worth, there are Maven archetypes for creating a new Jenkins plugin, which will get you a relatively up-to-date pom.xml free from any historical quirks or unnecessary configuration that you might be present in the pom.xml of existing plugins. To use the archetypes, run `mvn archetype:generate -Dfilter=io.jenkins.archetypes:` (trailing colon is import) from the command line, and then follow the on-screen prompts.

Paul Smith

unread,
Dec 13, 2018, 2:27:06 PM12/13/18
to jenkin...@googlegroups.com

Thanks Devin.  Unfortunately it appears that I have some sort or install/dev environment problem.  I’ve tried downloading a clean copy of the external job plugin and running the clean install and hpi:run jobs with that and it doesn’t work for me .

 

With the plugin as downloaded, I get…

 

[ERROR] Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:3.0.3:findbugs (findbugs) on project external-monitor-job: Unable to parse configuration of mojo org.codehaus.mojo:findbugs-maven-plugin:3.0.3:findbugs for parameter pluginArtifacts: Cannot assign configuration entry 'pluginArtifacts' with value '${plugin.artifacts}' of type java.util.Collections.UnmodifiableRandomAccessList to property of type java.util.ArrayList -> [Help 1]

 

So I created a branch and tried Baptiste’s updated POM and got batch to the error that has been holding me up before…

 

[ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:3.0:run (default-cli) on project external-monitor-job: minimumJavaVersion attribute must be set starting from version 2.8 -> [Help 1]

 

I’m running on a clean Ubuntu image (under VirtualBox) and I believe that I followed the ‘get started’ guides correctly so now I’m completely lost!  Are there any sensible checks that I can make to ensure that I’ve not got anything strange lying around?  The two things that spring to mind are that I’ve got the OpenJDK and Jenkins installed but Jenkins is not running; it looked to me like Maven installed a copy of Jenkins below the ../work directory when running the plug-in dev environments but is there some sort of possible interaction even though Jenkins is not active?

 

Happy to try a few things before I create another Ubuntu image and start from scratch again.

 

Paul DS.

 

 

From: jenkin...@googlegroups.com <jenkin...@googlegroups.com> On Behalf Of Devin Nusbaum
Sent: 13 December 2018 18:59
To: jenkin...@googlegroups.com
Subject: Re: maven-hpi-plugin ... minimumJavaVersion attribute must be set...

 

I'm trying to create a plug-in and started from the external-jobs plugin.  Unfortunately this had a very obsolete pom.xml so I've tried updating it following some help given elsewhere in this group but I'm stuff no this error when I try to run 'mvn hpi:run'


For what it’s worth, there are Maven archetypes for creating a new Jenkins plugin, which will get you a relatively up-to-date pom.xml free from any historical quirks or unnecessary configuration that you might be present in the pom.xml of existing plugins. To use the archetypes, run `mvn archetype:generate -Dfilter=io.jenkins.archetypes:` (trailing colon is import) from the command line, and then follow the on-screen prompts.

--

You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

Devin Nusbaum

unread,
Dec 13, 2018, 2:34:52 PM12/13/18
to jenkin...@googlegroups.com
What versions of Maven, Java, and Ubuntu are you running? I would run `mvn --version` to see what it tells you. You want Java 8 and Maven 3.5+. Maybe if you have a really old Maven version you could be getting those kinds of errors, but I’m not sure.

Regarding the `work` directory, that is the directory that `mvn hpi:run` uses as JENKINS_HOME when running a plugin. You don’t need to install Jenkins or run it directly at all when working on plugins, since it will be handled automatically in that local directory, although there should not be any conflicts if you do have it running or installed other than needing to specify a different port when running `mvn hpi:run` if you want to run them simultaneously.

Jesse Glick

unread,
Dec 13, 2018, 6:14:39 PM12/13/18
to Jenkins Dev
On Thu, Dec 13, 2018 at 1:55 PM Paul Smith <paul_d...@hotmail.com> wrote:
> ‘PR’, ‘WIP’ are probably blindingly obvious to you but they’re not to me I’m afraid.

Sorry. “pull request”, “work in progress”

There are integration tests for the Maven plugin which verify basic
functionality in controlled Docker images, though currently they do
not cover the `run` goal since that is a bit trickier to run from a
batch environment.

Paul Smith

unread,
Dec 14, 2018, 4:53:17 AM12/14/18
to jenkin...@googlegroups.com

Devin,

 

I’m running Maven 3.6.0, OpenJDK 8 on Ubuntu 18.04.1 Bionic Beaver (4.15.0-42-generic kernel).

 

Thanks for the info about the ‘work’ directory – that matches what I expected.

 

I’ve just tried deleting both my ‘fully installed Jenkins’ and all Java stuff and then reinstalling just the OpenJDK JDK (as required by Maven) but this has made no difference.  I’m going to have one last run at figuring this out before walking away for a while.

Paul Smith

unread,
Dec 14, 2018, 5:18:08 AM12/14/18
to jenkin...@googlegroups.com

OK, some strange things I’ve noticed.  The Effective POM for the external-monitor-job plugin, with Baptiste’s updated POM, contains the following:

 

  • There is a section in <build> for the maven-hpi-plug-in where, as part of the configuration, a ‘showDeprecation’ attribute is set
  • The source of the Maven-hpi-plugin seems to be org.jenkins-ci.tools which I presume is sourced from https://github.com/jenkinsci/maven-hpi-plugin

 

BUT https://github.com/jenkinsci/maven-hpi-plugin DOES seem to contain a ‘minimumJavaVersion’ attribute but does NOT contain a ‘showDeprecation’ attribute.  However if I skip across to https://github.com/hudson/maven-hpi-plugin (note the ‘hudson’ not ‘jenkinsci’) then I can find a ‘showDeprecation’ attribute.

 

I’m further lost because when I look here…

 

https://mvnrepository.com/artifact/org.jenkins-ci.tools/maven-hpi-plugin?repo=springio-plugins-release

 

… I can’t find a maven-hpi-run version higher than 2.7 so where is 3.0 coming from and is it the jenkinsci or Hudson version, or some other?

 

Does this explain any of my issues or are these just ‘the way it works’ and I’m simply not understanding Maven at all?

 

Paul DS.

Jesse Glick

unread,
Dec 14, 2018, 9:18:41 AM12/14/18
to Jenkins Dev
I just tried it myself and it is indeed completely broken. Go back
down to parent 3.28. I will file a fix.

Oleg Nenashev

unread,
Dec 14, 2018, 11:51:29 AM12/14/18
to Jenkins Developers
Sorry for the regression I caused in Maven HPI Plugin 3.0.
I do not use "hpi:run" for development, and apparently there was no test coverage for it in the Maven HPI Plugin.
https://github.com/jenkinsci/maven-hpi-plugin/pull/88 from Jesse should fix it. Will help to expedite the release

BR, Oleg

Jesse Glick

unread,
Dec 14, 2018, 12:39:58 PM12/14/18
to Jenkins Dev
For the record, the regression should be fixed in parent POM 3.31.

Paul Smith

unread,
Dec 17, 2018, 4:42:43 AM12/17/18
to jenkin...@googlegroups.com
Thank Jesse. Glad it wasn't me then :-).

-----Original Message-----
From: jenkin...@googlegroups.com <jenkin...@googlegroups.com> On Behalf Of Jesse Glick
Sent: 14 December 2018 14:18
To: Jenkins Dev <jenkin...@googlegroups.com>
Subject: Re: maven-hpi-plugin ... minimumJavaVersion attribute must be set...

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0HdJXoTVeeZm5SC--r21n3ac4wiQRq8c8NTQpxAG0MHw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages