jenkins-xml-to-jobdsl icon indicating copy to clipboard operation
jenkins-xml-to-jobdsl copied to clipboard

cannot build job-dsl-plugin

Open skent opened this issue 5 years ago • 5 comments

Getting a build failure when building :FAILURE: Build failed with an exception.

  • Where: Build file '/jdsl/job-dsl-plugin/build.gradle' line: 83

  • What went wrong: A problem occurred evaluating project ':job-dsl-plugin'.

Could not find method annotationProcessor() for arguments [net.java.sezpoz:sezpoz:1.13] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 53s

skent avatar Jun 17 '19 10:06 skent

Decided to try this tool out today, and ran into the same issue with the docker build.

  • appears that gradle v4.6 works, but the v4.4.x that is available from apt no longer works here

Managed to get the build to happen by...

  1. installing curl
  2. use curl to obtain gradle and install from archive (instead of using apt install)

NOTE: I have not yet been able to test functionality, just that the Docker build actually returned successful.

Ran docker build with --no-cache

$ docker build -t jdsl . --no-cache
...
Removing intermediate container e717b1de3cbe
 ---> 3460e8138661
Step 23/23 : CMD ["ruby", "server.rb"]
 ---> Running in 00dc5831984a
Removing intermediate container 00dc5831984a
 ---> 064c779d901b
Successfully built 064c779d901b
Successfully tagged jdsl:latest

jyanko avatar Jan 13 '20 22:01 jyanko

While I did manage to get the docker build to work, it didn't appear to give me a usable DSL file as output. Not sure if I'm using it wrong, or what at this point.

When I tried running Seed Job ... it fails a the line starting with #(Element:0x2ab401b90dcc

Out of time to troubleshoot on this for now. Maybe revisit later if time presents itself.

# ruby jenkins-xml-to-jobdsl.rb monitor_jenkins_dev.xml
jenkins-xml-to-jobdsl.rb:14: warning: encountered \r in middle of line, treated as a mere space
freeStyleJob('jenkins-xml-to-jobdsl') {
    description('''\

monitor job for jenkins to check/report on HA Proxy up/down

''')
    keepDependencies(false)
    properties {
#(Element:0x2ab401b90dcc {
  name = "hudson.plugins.jira.JiraProjectProperty",
  attributes = [
    #(Attr:0x2ab401b90994 { name = "plugin", value = "[email protected]" })]
  })
...

jyanko avatar Jan 14 '20 00:01 jyanko

Hi @jyanko. First off, thanks again for looking at jenkins-xml-to-jobdsl. Outputting invalid groovy is known and expected behavior when encountering a node type that is unknown to jenkins-xml-to-jobdsl. To fix this, you would need to figure out how to describe hudson.plugins.jira.JiraProjectProperty with groovy and then add code to handle this property.

visualphoenix avatar Jan 14 '20 18:01 visualphoenix

you likely need to handle this property type in this switch case: https://github.com/visualphoenix/jenkins-xml-to-jobdsl/blob/develop/jenkins-xml-to-jobdsl.rb#L360

visualphoenix avatar Jan 14 '20 18:01 visualphoenix

Thanks @visualphoenix - been a long while since since I've visited this project, and recently had a reason to check it out again.

Assuming the initial docker build failure is related to the fact that Ubuntu latest has changed since back in 2016 (and likely other dependencies).

From your comment above, the "invalid groovy"...

#(Element:0x2ab401b90dcc {
  name = "hudson.plugins.jira.JiraProjectProperty",
  attributes = [
    #(Attr:0x2ab401b90994 { name = "plugin", value = "[email protected]" })]
  })

...in this case effectively a block that the tool currently does not know how to handle. Is the syntax of #(Element... essentially telling me this is literally what was extracted from the XML, but the tool doesn't know what to do with it?

My options appear to be...

  • remove this 'commented' element and try importing the JobDSL
  • find a way to manually write the same in DSL before importing the JobDSL
  • find a way to write the same in DSL, and update the jenkins-xml-to-jobdsl utility to output correctly, then import the JobDSL it creates.

jyanko avatar Jan 14 '20 22:01 jyanko