#!/bin/bash TXT_BOLD=`tput bold` TXT_UNDERLINE_ON=`tput smul` TXT_UNDERLINE_OFF=`tput rmul` TXT_BLACK=`tput setaf 0` TXT_RED=`tput setaf 1` TXT_GREEN=`tput setaf 2` TXT_YELLOW=`tput setaf 3` TXT_BLUE=`tput setaf 4` TXT_MAGENTA=`tput setaf 5` TXT_CYAN=`tput setaf 6` TXT_WHITE=`tput setaf 7` BGD_BLACK=`tput setab 0` BGD_RED=`tput setab 1` BGD_GREEN=`tput setab 2` BGD_YELLOW=`tput setab 3` BGD_BLUE=`tput setab 4` BGD_MAGENTA=`tput setab 5` BGD_CYAN=`tput setab 6` BGD_WHITE=`tput setab 7` RST_FORMATTING=`tput sgr0` find "~/.m2/repository" -name '*.pom' -o -name '*.jar' | while read i; do if [ -r "$i.sha1" ]; then CHK1=`shasum "$i" | awk '{print $1}'`; CHK2=`cat "$i.sha1" | awk '{print $1}'`; if [ "$CHK1" = "$CHK2" ]; then echo -n "$TXT_GREEN" echo "OK SHA1 $i $CHK1=$CHK2"; else echo -n "$TXT_RED" echo "KO SHA1 $i $CHK1=$CHK2" echo -n "$RST_FORMATTING" echo -n "$TXT_BOLD" rm -fv "$i*" fi; elif [ -r "$i.md5" ]; then CHK1=`md5 "$i" | awk '{print $1}'`; CHK2=`cat "$i.md5" | awk '{print $1}'`; if [ "$CHK1" = "$CHK2" ]; then echo -n "$TXT_GREEN" echo "OK MD5 $i $CHK1=$CHK2"; else echo -n "$TXT_RED" echo "KO MD5 $i $CHK1=$CHK2" echo -n "$RST_FORMATTING" echo -n "$TXT_BOLD" rm -fv "$i*" fi; else echo -n "$TXT_YELLOW" echo "??????? $i"; echo -n "$RST_FORMATTING" echo -n "$TXT_BOLD" rm -fv "$i*" fi; done; echo "$RST_FORMATTING"
Friday, June 29, 2012
Maven: How to clean your local repository
How many times we delete all ~/.m2/repository and re-download every artifact running mvn package for each project we have in the system?
I've done a little script to check every artifact in local maven repository that removes every artifact with wrong MD5 or SHA or without any of them.
Run this check-maven-repository.sh script in your shell typing './check-maven-repository.sh' command.
Note: I'm not responsible of any problem deriving from the execution of this script.
Thursday, June 28, 2012
Why CoDeGeneration?
I was born at the end of 20th century and all the people born in that period are part of the code generation.
Year after year new developers were born and a lot of these create random like code without experience or for time reasons. So everyone, me included, becomes part of a co-degeneration.
This blog was born for two reasons: the first is to help developers to do things better and the latter to improve my knowledge through your comments.
Subscribe to:
Posts (Atom)