-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpom.sh
48 lines (34 loc) · 1.28 KB
/
pom.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
pom="pom.xml"
if [ ! -f "$pom" ]; then
echo "\"$pom\" 不存在,请检查路径是否正确!"
exit
fi
mvn="/Applications/NetBeans/NetBeans 8.1.app/Contents/Resources/NetBeans/java/maven/bin/mvn"
if [ ! -f "$mvn" ]; then
echo "\"$mvn\" 不存在,请检查路径是否正确!"
exit
fi
java_home="/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home"
if [ ! -d "$java_home" ]; then
echo "\"$java_home\" 不存在,请检查路径是否正确!"
exit
fi
echo JAVA_HOME=$java_home "$mvn" dependency:tree -l=/tmp/pom.txt
JAVA_HOME=$java_home "$mvn" dependency:tree -l=/tmp/pom.txt
exit
#JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.1.app/Contents/Resources/NetBeans/java/maven/bin/mvn" dependency:tree -l=/tmp/pom.txt
#exit
#cat /tmp/pom.txt | grep ":jar:" | grep -v -E "^[a-zA-Z]" | sed 's/[^a-zA-Z]*//' | sort | uniq > /tmp/pom.xml
#cat /tmp/pom.txt | grep ":jar:" | grep -v -E "^[a-zA-Z]" | sed 's/[^a-zA-Z]*//' | cut -d: -f 2 | sort | uniq > /tmp/pom.xml
sed -i '' '/[a-zA-Z]/i\
<dependency>
' /tmp/pom.txt
sed -i '' '/[a-zA-Z]/a\
</dependency>
' /tmp/pom.txt
sed -i '' "1 i\
<dependencyManagement><dependencies>
" /tmp/pom.txt
sed -i '' "$ a\
</dependencies></dependencyManagement>
" /tmp/pom.txt