Enforcer confusion and problems

45 views
Skip to first unread message

Mike Caspar

unread,
Jan 5, 2018, 9:20:47 PM1/5/18
to Jenkins Developers
Hi there,
This is working ...   

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

<jenkins.version>2.73.3</jenkins.version>

.............
In the project I maintain, there is an external dependency on a plugin that uses org.apache.commons.lang3

When I try and switch to plugin version 2.31 or above, I get an enforcer error. 
When I research, it appears that I need to Exclude org.apache.commons   lang3 from the <dependency>

When I do this, enforcer passes, clean, compile all work but when the hpi:run actually tries and runs the code (during my manual test session), I get an exception that the class org.apache.commons.lang3.ArrayUtil cannot be loaded.  (sorrry.. the case me be off on ArrayUtil).

When I use 2.37 as the version plugin, I get the following (which seems to imply that the test harness has a similar problem).

I have no control over the pom of the dependency.


Require upper bound dependencies error for org.apache.commons:commons-lang3:3.1 paths to dependency are:
+-org.jenkins-ci.plugins:ironmq-notifier:1.0.19-SNAPSHOT
  +-io.iron.ironmq:ironmq:3.0.4
    +-org.apache.commons:commons-lang3:3.1
and
+-org.jenkins-ci.plugins:ironmq-notifier:1.0.19-SNAPSHOT
  +-org.jenkins-ci.main:jenkins-test-harness:2.31
    +-org.jenkins-ci.main:jenkins-test-harness-htmlunit:2.18-1
      +-org.apache.commons:commons-lang3:3.4


Any ideas or a direction (or samples) to go to next?

Thanks

Daniel Beck

unread,
Jan 6, 2018, 4:33:57 AM1/6/18
to jenkin...@googlegroups.com

> On 6. Jan 2018, at 03:20, Mike Caspar <mikecan...@gmail.com> wrote:
>
> Any ideas or a direction (or samples) to go to next?
>

Define an explicit dependency on the higher of the two versions.

Mike Caspar

unread,
Jan 6, 2018, 11:04:47 AM1/6/18
to jenkin...@googlegroups.com
Thank you.

Adding the Maven dependency did the trick.

Is there a place where this is documented?

Would the stapler rules be documented somewhere?

I would be pleased to start a page called Maven Enforcer FAQs and do my
best to put in an explanation.  Or, is there a better approach? I'd be
glad to do something to help out the next person who is stuck.

Mike

Ullrich Hafner

unread,
Jan 6, 2018, 11:32:41 AM1/6/18
to Jenkins Developers

>
> I would be pleased to start a page called Maven Enforcer FAQs and do my best to put in an explanation.

I think starting a wiki page would be a good idea, this is something that happens quite often now. It would be good if we can provide some patterns on how to solve such a problem. E.g., what should one do if there is such an error in two depending plugins (or libraries) (and not in your own code)? Define an exclusion in the dependencies? Or add an exclusion in requireUpperBoundDeps of the enforcer?

> Or, is there a better approach? I'd be glad to do something to help out the next person who is stuck.
>
> Mike
>
>
> On 2018-01-06 01:33 AM, Daniel Beck wrote:
>>> On 6. Jan 2018, at 03:20, Mike Caspar <mikecan...@gmail.com> wrote:
>>>
>>> Any ideas or a direction (or samples) to go to next?
>>>
>> Define an explicit dependency on the higher of the two versions.
>>
>
> --
> 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/b1839845-1d63-2b1c-033f-864119b26d58%40caspar.com.
> For more options, visit https://groups.google.com/d/optout.

signature.asc

Daniel Beck

unread,
Jan 6, 2018, 11:37:22 AM1/6/18
to jenkin...@googlegroups.com

> On 6. Jan 2018, at 17:04, Mike Caspar <mi...@caspar.com> wrote:
>
> Is there a place where this is documented?

First Google hit for me was https://maven.apache.org/enforcer/enforcer-rules/requireUpperBoundDeps.html which explains it. It's not a Jenkins specific behavior.

Documentation on how to adapt plugins to newer parent POM releases (and core releases) is on my todo list, but help, as always, is appreciated.

Mike Caspar

unread,
Jan 6, 2018, 11:46:18 AM1/6/18
to jenkin...@googlegroups.com
Daniel,

How can I help to the best of my ability?

I'd like to start by trying to add this problem as well as the message
about java.level in properties..

Combined, these two problems burned about 8 hours of my time just trying
to go to the latest LTS and plugin version. (I don't do java coding for
my day job).

Would it be helpful for me to give it a try on the WIKI?

Mike

Daniel Beck

unread,
Jan 6, 2018, 12:19:19 PM1/6/18
to jenkin...@googlegroups.com

> On 6. Jan 2018, at 17:46, Mike Caspar <mi...@caspar.com> wrote:
>
> How can I help to the best of my ability?
>
> I'd like to start by trying to add this problem as well as the message about java.level in properties..
>
> Combined, these two problems burned about 8 hours of my time just trying to go to the latest LTS and plugin version. (I don't do java coding for my day job).
>
> Would it be helpful for me to give it a try on the WIKI?

Wiki works, but longer term for discoverability the content should probably be integrated to https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md (which explains what changes, but not how to adapt existing plugins to work with it) or into a new chapter 'Plugin Modernization' (or similar) on https://jenkins.io/doc/developer/ (which is what I plan to do, as a hub for plugin developers to read up on what recently changed in Jenkins, or tooling, and how to adapt).

Reply all
Reply to author
Forward
0 new messages