How I can avoid optional plugin B being installed along with plugin A?

24 views
Skip to first unread message

Kirill

unread,
Jun 16, 2017, 8:29:24 AM6/16/17
to Jenkins Developers
Hi fellow Jenkins developers,

I have a Jenkins plugin, which can optionally use Kubernetes plugin.
However, I don't want the Kubernetes plugin to be installed along with my plugin in Jenkins.
That's why I have set this in the POM file:

<dependency>
    <groupId>org.csanchez.jenkins.plugins</groupId>
    <artifactId>kubernetes</artifactId>
    <scope>provided</scope>
    <optional>true</optional>
</dependency>

However, Maven HPI plugin doesn't allow me to get away with this, and complains:

[ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:1.121:test-hpl (default-cli) on project my-jenkins-plugin: org.csanchez.jenkins.plugins:kubernetes:jar:0.11 is marked as 'provided' scope dependency, but it should be the 'compile' scope. -> [Help 1]

I'm using maven-hpi-plugin:1.121, which is the default in the 2.x Jenkins plugin core POM that I'm using as a base for my plugin. However, I tried to use later versions - 1.122 and 2.0, but there was no change.
Also, I tried to use Maven plugin configuration options <dependencyResolution>compile</dependencyResolution> and <includesOptional>false</includesOptional> - without any effect.

If I remove '<scope>provided</scope>' from the K8s plugin dependency in POM, it's still being installed in Jenkins along with my plugin, despite '<optional>true</optional>'.

Any help is appreciated!

Regards,
K.

Daniel Beck

unread,
Jun 16, 2017, 8:56:34 AM6/16/17
to jenkin...@googlegroups.com

> On 16. Jun 2017, at 14:29, Kirill <yam...@gmail.com> wrote:
>
> it's still being installed in Jenkins along with my plugin, despite '<optional>true</optional>'.

I would guess that happens only in hpi:run; not if you install it from an update center, or upload the plugin to Jenkins.

Jesse Glick

unread,
Jun 16, 2017, 10:04:19 AM6/16/17
to Jenkins Dev
On Fri, Jun 16, 2017 at 8:29 AM, Kirill <yam...@gmail.com> wrote:
> If I remove '<scope>provided</scope>' from the K8s plugin dependency in POM

Which you must!

> it's still being installed in Jenkins along with my plugin

As Daniel said, only in `hpi:run`.

Kirill

unread,
Jun 19, 2017, 3:51:17 AM6/19/17
to Jenkins Developers
Thanks a million, guys!

пятница, 16 июня 2017 г., 15:04:19 UTC+1 пользователь Jesse Glick написал:
Reply all
Reply to author
Forward
0 new messages