The other day, [here](http://stackoverflow.com/questions/9577929/cleanest-way-in-gradle-to-get-the-path-to-a-jar-file-in-the-gradle-dependency- I was watching ca). I needed a list of JARs to collect all the dependent JARs and automatically combine them into one JAR. I saw the code here and thought.
prologue.groovy
project.configurations.compile*.each{...}
If so, I wonder if it is possible to get the JAR path by iterative processing.
Now, let's copy and execute the following code into the build.gradle of the Module.
prologue2.groovy
project.configurations.compile*.each{
println it
}
Do you think you can see the list of paths?
No
The contents of the JAR file (as if all the JARs were cated) are output to the standard output.
The console (Terminal) was very rough and it was hard.
So what should I do?
correct.groovy
project.configurations.compile*.toURI().each {
File file=new File(it)
println file//Replace it with a process that uses a File object.
}
It is like this. Change it to ʻURIand then back toFile. This will ensure that File` can be handled iteratively.
So why did you output the contents of the JAR file to standard output?
This is just a guess,
List (maybe) containing a File objectFile (File.readLines () ) and make it ʻArrayList`. that stores all the rows and ʻeach.
If all this is println, it will be rough ...Recommended Posts