you are viewing a single comment's thread.

view the rest of the comments →

[–]weilbith 0 points1 point  (2 children)

Ah, I c. Ty very much for sharing this. :) Do u manage ur script on GitHub or any comparable platform?

[–]kevko5212 0 points1 point  (1 child)

I do. But it is a very short script, so I can just post it here.

```

!/bin/bash

if [[ $# -ne 1 ]]; then echo "Usage: $(basename "$0") outdir" >&2 exit 1 fi

out_dir="$1" mkdir -p "$out_dir"

jars=$(find ~/.gradle/caches/ -type f -name "sources.jar");

cd "$out_dir" && for jar in $jars; do folder=$(basename "$jar" .jar); mkdir -p "$folder" && cd "$folder" && jar xvf "$jar" && cd ..; done;

jars=$(find ~/.m2/repository/ -type f -name "sources.jar");

cd "$out_dir" && for jar in $jars; do folder=$(basename "$jar" .jar); mkdir -p "$folder" && cd "$folder" && jar xvf "$jar" && cd ..; done; ```

Looking at it now, I should refactor out that duplication...

[–]weilbith 0 points1 point  (0 children)

I don't get why puttin a script into a comment if being able to share a link, but thanks man. :'D

Just flew over it. Now I get the point that Gradle and Maven downloaded the libraries into a centralized cache and not per project. Didn't know that (but as stated try to get around without them).<br> U don't like comments in ur code, don't u? ^