Closed timja closed 9 years ago
Hm, no clue. All I did was following the docs, see https://wiki.jenkins-ci.org/display/JENKINS/Dependencies+among+plugins#Dependenciesamongplugins-Optionaldependencies and https://wiki.jenkins-ci.org/display/JENKINS/Defining+a+new+extension+point.
Does the manifest of your plugin list the job-dsl plugin as (optional) plugin dependency? Can you unzip the HPI and check META-INF/MANIFEST.MF? It should contain something like Plugin-Dependencies: job-dsl:1.34;resolution:=optional. Which version of the maven-hpi-plugin are you using?
I think the problem is that the Job DSL plugin POM has packaging type of jpi (see http://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/job-dsl/1.34/job-dsl-1.34.pom) as generated by the gradle-jpi-plugin. And the maven-hpi-plugin only considers the hpi packaging type as plugin dependency, see https://github.com/jenkinsci/maven-hpi-plugin/blob/maven-hpi-plugin-1.113/src/main/java/org/jenkinsci/maven/plugins/hpi/MavenArtifact.java#L64.
Fix for the gradle-jpi-plugin: https://github.com/jenkinsci/gradle-jpi-plugin/pull/53
Shouldn't we fix the maven-hpi-plugin instead of the gradle jpi plugin?
I use maven-hpi-plugin:1.106 (same with latest 1.113)
If i add token macro as optional dep, then in manifest i see
Plugin-Dependencies: token-macro:1.10;resolution:=optional
And if i add job-dsl-plugin as optional, no any tag
Plugin-Dependencies
in manifest
What about JENKINS-28305 ?
Fix for the maven-hpi-plugin: https://github.com/jenkinsci/maven-hpi-plugin/pull/17
Code changed in jenkins
User: Daniel Spilker
Path:
CHANGELOG.md
config/codenarc/rules-test.groovy
src/main/groovy/org/jenkinsci/gradle/plugins/jpi/Jpi.groovy
src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy
src/test/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPluginSpec.groovy
src/test/resources/org/jenkinsci/gradle/plugins/jpi/bitbucket-pom.xml
src/test/resources/org/jenkinsci/gradle/plugins/jpi/compile-dependencies-pom.xml
src/test/resources/org/jenkinsci/gradle/plugins/jpi/complex-pom.xml
src/test/resources/org/jenkinsci/gradle/plugins/jpi/minimal-pom.xml
src/test/resources/org/jenkinsci/gradle/plugins/jpi/optional-plugin-dependencies-pom.xml
src/test/resources/org/jenkinsci/gradle/plugins/jpi/plugin-dependencies-pom.xml
http://jenkins-ci.org/commit/gradle-jpi-plugin/9cafa9f31c9e1807532f29caaba53a7e746f198e
Log:
Merge pull request #53 from daspilker/JENKINS-28408
JENKINS-28408 allow JPI/HPI file extension and packaging type to be configured
Compare: https://github.com/jenkinsci/gradle-jpi-plugin/compare/5b72ac473142...9cafa9f31c9e
Will be fixed in job-dsl-plugin 1.35 and is fixed in gradle-jpi-plugin 0.12.0.
Code changed in jenkins
User: Daniel Spilker
Path:
src/main/java/org/jenkinsci/maven/plugins/hpi/MavenArtifact.java
http://jenkins-ci.org/commit/maven-hpi-plugin/28e8336c762d5032140ea38c5d127c9394279937
Log:
fixed support for jpi packaging type
Code changed in jenkins
User: Vincent Latombe
Path:
src/main/java/org/jenkinsci/maven/plugins/hpi/MavenArtifact.java
http://jenkins-ci.org/commit/maven-hpi-plugin/78247d32be9841ccfd165bc7bbb7d2566bc9f994
Log:
Merge pull request #17 from daspilker/JENKINS-28408
JENKINS-28408 fixed support for jpi packaging type
Compare: https://github.com/jenkinsci/maven-hpi-plugin/compare/b2d139e78da6...78247d32be98
As in tutorial:
https://github.com/jenkinsci/job-dsl-plugin/wiki/Extending-the-DSL
extend:
with dependency:
Then with job-dsl 34 installed do in jenkins script console:
import javaposse.jobdsl.plugin.ContextExtensionPoint; Jenkins.instance.refreshExtensions(); println(Jenkins.instance.getExtensionList(ContextExtensionPoint.class))
prints "[]"
With dependencyfalse
it prints:
[com.example.dsl.AquaPluginJobDslExtension@2ee05de3]
Okay,
do the same with token macro plugin:
in console:
import org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro; println(Jenkins.getInstance().getExtensionList(DataBoundTokenMacro.class))
prints:
[..., org.jenkinsci.plugins.tokenmacro.impl.PropertyFromFileMacro@11786964, com.example.dsl.TokenMExt@13a9b76f]
Originally reported by lanwen, imported from: Jenkins can't load extension ContextExtensionPoint if dependency is optional