Concatenate more than 100 files

I need to merge more than 100 property files.

Instead to including every file manually, can I do it through some Gradle Plugin ???

Please reply .

Please reply to the question.
I am able to concatenate for 2 or 3 files.

For concatenating more than 100 files, there should be some easy trick in Gradle.

Please let me know.

What do you mean by merge? Do you really need all of them merged in a single file? Or do you only need all their properties accessible from a Gradle build?

Also there probably won’t be any gradle trick, only a groovy one. But to find one, we need more context, such as a few examples, or info such as the location of the properties files, their name, etc

To be able to find a “trick”, we must find some common logic shared between them…

Merge means I need to concatenate all the properties files into single new properties file.
All the files are in the same location and there name can be taken as, for example
file1.properties,
file2.properties


file 125.properties.
so on .

Here’s a simple example of concatenating all .txt files in src/ into build/full.txt:

task concat(type: SourceTask) {
   source 'src'
   include '**/*.txt'
   outputs.file new File(buildDir, "full.txt")

   doLast {
      ant.concat(destfile: outputs.files.singleFile) {
         source.addToAntBuilder(ant, 'fileset', FileCollection.AntType.FileSet)
      }
   }
}

you might also be interested b ConfigSlurper and its merge method.
See here
This solution allows you to take advantage of typed properties, list/map of properties (e.g. dotted properties).
Depending on the content of your properties files, this might suits you better than a simple merge

Sterling, thanks a lot. It just worked.

Francois, You have answered my next question. Thanks a lot