Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71868

Failed to properly handle sub project resource file replication for multi-module projects

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • gradle-plugin
    • None
    • jenkins 2.419
      gradle 8.3

       

      1. The project structure is as follows

      2. gradle config

       

      3. The xml file cannot be copied correctly after jenkins compilation.

      4. But calling gradle locally is fine

      4. If you do not empty the workspace, compile twice in a row, and the second time there is again
       

          [JENKINS-71868] Failed to properly handle sub project resource file replication for multi-module projects

          Alexis added a comment -

          Could you please provide us with the Gradle command run during this build ? And if the copy task is not invoked directly, how is it wired in the build ? Thanks

          Alexis added a comment - Could you please provide us with the Gradle command run during this build ? And if the copy task is not invoked directly, how is it wired in the build ? Thanks

          zxuanhong added a comment -

          zxuanhong added a comment - atual

          zxuanhong added a comment -

          atual The current workaround is to set up two Build Steps

          zxuanhong added a comment - atual The current workaround is to set up two Build Steps

          Alexis added a comment -

          It's a Gradle build issue, you can reproduce it locally by running 

          gradle clean copyXml

          I think a better way to achieve what you want would be:
           

          tasks.named('processResources') {
            from(sourceSets.main.java.srcDirs) {
              include '**/xml/*.xml'   
            } 
          }

          It will get the xml from the sources and copy them to the build/resources dir maintaining the relative paths.

          Alexis added a comment - It's a Gradle build issue, you can reproduce it locally by running  gradle clean copyXml I think a better way to achieve what you want would be:   tasks.named( 'processResources' ) { from(sourceSets.main.java.srcDirs) {   include '**/xml/*.xml'   } } It will get the xml from the sources and copy them to the build/resources dir maintaining the relative paths.

          Alexis added a comment -

          Closing since it's a Gradle build tool question, answered with a suggestion

          Alexis added a comment - Closing since it's a Gradle build tool question, answered with a suggestion

          zxuanhong added a comment - - edited

          atual I tried it, and the direct gradle command works, including your solution. But jenkins just can't, including yours

          zxuanhong added a comment - - edited atual I tried it, and the direct gradle command works, including your solution. But jenkins just can't, including yours

          Alexis added a comment -

          Do you mean that the xml files are not there when building with Jenkins?

          After a build they should be in the `build/resources/main` directory, they'll end up eventually in the jar file.

          Alexis added a comment - Do you mean that the xml files are not there when building with Jenkins? After a build they should be in the `build/resources/main` directory, they'll end up eventually in the jar file.

          zxuanhong added a comment -

          atual I'll just do two gradle builds. It's not that great, but it solves my problem

          zxuanhong added a comment - atual I'll just do two gradle builds. It's not that great, but it solves my problem

          Alexis added a comment -

          Ok, not sure why it's not working, it seems specific to your build, might be related to the current workspace state. Hence I'd close the ticket for now, is that fine with you?

          Alexis added a comment - Ok, not sure why it's not working, it seems specific to your build, might be related to the current workspace state. Hence I'd close the ticket for now, is that fine with you?

          zxuanhong added a comment - - edited

          atual I've tried it and everything works under resources.Turn it off. Two task can solve it now.

          zxuanhong added a comment - - edited atual I've tried it and everything works under resources.Turn it off. Two task can solve it now.

            wolfs Stefan Wolf
            zxuanhong zxuanhong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: