Jars in gradle, groovy, and grails


(rtayek) #1

seems to be a lot of duplicates here. since grails is now using gradle, is anyone thinking about using some kind of common repository?


(Peter Niederwieser) #2

Can you elaborate? What kind of duplication are you talking about?


(rtayek) #3

i thought i saw a duplicate jar or two go by when i installed or ran gradle and i thought that there might be a lot of duplicates.

i ran the program below and found some, but not that many. but i am on a new (week old pc), so i just have groovy, grails, gradle, eclipse, and sts installed.

and this may not be something that gradle could address anyway. it feels more like an ivy thing.

thanks

import java.io.; import java.util.; public class Main {

void look(File dir) {

if(!dir.isDirectory()) throw new RuntimeException(dir+" is not a directory!");

File[] array=dir.listFiles();

if(array!=null) for(File file:array)

if(file.isFile()) {

String name=file.getName();

if(name.endsWith(".jar")) {

List files=map.get(name);

if(files==null) map.put(name,files=new LinkedList());

files.add(file);

}

} else if(file.isDirectory()) look(file);

else ; // junction

}

Main(File dir) {

look(dir);

System.out.println(this);

}

Main(File[] dirs) {

for(File dir:dirs)

look(dir);

System.out.println(this);

}

public String toString() {

return map.keySet().toString();

}

void duplicates() {

long size=0;

for(String name:map.keySet()) {

List files=map.get(name);

if(files.size()>1) {

size+=files.get(0).length()*(files.size()-1);

System.out.println(name+’:’+files.size()+’:’+files);

}

}

System.out.println(“wasted space=”+size);

}

public static void main(String[] args) {

File[] dirs=new File[]{new File(“c:/Users/ray”),new File(“r:/dev”)};

Main main=new Main(dirs);

main.duplicates();

}

Map<String,List> map=new TreeMap<String,List>(); }


(Peter Niederwieser) #4

Gradle has its own proprietary artifact cache, and Maven and Ivy too. If and when Grails’ integrated build system moves to Gradle, it will probably use Gradle’s cache as well.


(rtayek) #5

good.

thanks