I found such solution https://stackoverflow.com/a/22411538/1458394 and made some improvements (not bad, but it needs some another improvements) deps-resolver.sh
:
#!/bin/sh
if [ "$#" -ne 5 ]; then
echo "Usage: $0 <groupId> <artifactId> <version> <scope> <type>"
exit
fi
echo $1 $2 $3 $4
echo "<dependency><groupId>$1</groupId><artifactId>$2</artifactId><version>$3</version><scope>compile</scope><type>$5</type></dependency>">>shared-libs-all.mvn
POM_DIR="`echo "$1" | tr . /`/$2/$3"
POM_PATH="$POM_DIR/$2-$3.pom"
excludeClassifiers=client
excludeGroupIds=org.apache.openjpa,javax.jms,javax.ejb,javax.servlet,com.ibm.ws,org.hibernate.javax.persistence,org.jboss.spec.javax.transaction,javax.mail,javax.activation,taglibs
excludeArtifactIds=
excludeScope=''
#echo -DexcludeClassifiers="$excludeClassifiers" -DexcludeGroupIds="$excludeGroupIds" -DexcludeArtifactIds="$excludeArtifactIds" -DexcludeScope="$excludeScope"
#mkdir -p "$HOME/.m2/repository/$POM_DIR"
#wget -q -O "$HOME/.m2/repository/$POM_PATH" "http://repo.maven.apache.org/maven2/$POM_PATH"
mvn -f "$HOME/.m2/repository/$POM_PATH" dependency:resolve -DexcludeClassifiers="$excludeClassifiers" -DexcludeGroupIds="$excludeGroupIds" -DexcludeArtifactIds="$excludeArtifactIds" -DexcludeScope="$excludeScope" -o -DincludeParents=true|egrep $4|awk '{split($0,a," "); print(a[2]);}'|awk '{split($0,a,":"); printf("./deps-resolver.sh %s %s %s %s %s
", a[1],a[2],a[4],"provided",a[3]);}'|sh
And then do
cat shared-libs-all.mvn|grep -v 'rd-service'|sort|uniq>shared-libs-prepared.mvn
and receive a list of whole (and more than needed) transitive dependencies.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…