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

          zxuanhong created issue -
          zxuanhong made changes -
          Attachment New: image-2023-08-22-18-11-44-667.png [ 61039 ]
          Description Original:  

          1. The project structure is as follows

          !image-2023-08-22-11-47-46-716.png!

          2. gradle config

           
          tasks.register('copyXml', Copy) {
          from layout.projectDirectory.dir("src/main/java")
          include "**/xml/*.xml"
          into layout.buildDirectory.dir("classes/java/main")
          }
          3. The xml file cannot be copied correctly after jenkins compilation.
          !image-2023-08-22-11-54-37-249.png!
          4. But calling gradle locally is fine
          !image-2023-08-22-11-50-26-262.png!
          4. If you do not empty the workspace, compile twice in a row, and the second time there is again
           
          !image-2023-08-22-11-56-21-643.png!
          New:  

          1. The project structure is as follows

          !image-2023-08-22-11-47-46-716.png!

          2. gradle config

           
          !image-2023-08-22-18-11-44-667.png!

          3. The xml file cannot be copied correctly after jenkins compilation.
          !image-2023-08-22-11-54-37-249.png!
          4. But calling gradle locally is fine
          !image-2023-08-22-11-50-26-262.png!
          4. If you do not empty the workspace, compile twice in a row, and the second time there is again
           
          !image-2023-08-22-11-56-21-643.png!

          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 made changes -
          Attachment New: image-2023-08-30-10-17-20-798.png [ 61073 ]
          zxuanhong made changes -
          Attachment New: image-2023-08-30-10-18-04-631.png [ 61074 ]

          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
          Alexis made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: