jacoco_build.xml
6.94 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?xml version="1.0" ?>
<project name="Lengyu" xmlns:jacoco="antlib:org.jacoco.ant" default="jacoco">
<!--Jacoco的安装路径-->
<property name="jacocoantPath" value="/Data/local/jacoco/lib/jacocoant.jar"/>
<!--工程名称,需要跟自己工程在代码发布机上的目录一致-->
<property name="project_name" value="yoho-ufo" />
<!--远程tomcat服务的ip地址-->
<property name="server_ip" value="10.66.101.7"/>
<!--前面配置的远程tomcat服务打开的端口,要跟env.sh中CATALINA_OPTS配置的Agent端口一样-->
<property name="server_port" value="8891"/>
<!--最终生成.exec文件的路径,Jacoco就是根据这个文件生成最终的报告的-->
<property name="jacocoexecFile" value="/Data/local/jacoco/jacoco-dumps/${project_name}"/>
<!--生成覆盖率报告的路径-->
<property name="reportfolderPath" value="/Data/local/jacoco/jacoco-report/${project_name}"/>
<!--代码发布机上工程的默认路径-->
<property name="code_base" value="/home/master/auto_deploy/apps/${project_name}/qcloud_gray/gray" />
<!--让ant知道去哪儿找Jacoco-->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${jacocoantPath}" />
</taskdef>
<!--dump任务:
根据前面配置的ip地址,和端口号,
访问目标tomcat服务,并生成.exec文件。-->
<target name="dump">
<jacoco:dump address="${server_ip}" reset="false" destfile="${jacocoexecFile}" port="${server_port}" append="true"/>
</target>
<!--jacoco任务:
根据前面配置的源代码路径和.class文件路径,
根据dump后,生成的.exec文件,生成最终的html覆盖率报告。-->
<target name="report">
<delete dir="${reportfolderPath}" />
<mkdir dir="${reportfolderPath}" />
<jacoco:report>
<executiondata>
<file file="${jacocoexecFile}" />
</executiondata>
<structure name="JaCoCo Report">
<group name="backend">
<classfiles>
<fileset dir="${code_base}/backend/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/backend/src/main/java" />
</sourcefiles>
</group>
<group name="cms">
<classfiles>
<fileset dir="${code_base}/cms/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/cms/src/main/java" />
</sourcefiles>
</group>
<group name="common">
<classfiles>
<fileset dir="${code_base}/common/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/common/src/main/java" />
</sourcefiles>
</group>
<group name="guide">
<classfiles>
<fileset dir="${code_base}/guide/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/guide/src/main/java" />
</sourcefiles>
</group>
<group name="message">
<classfiles>
<fileset dir="${code_base}/message/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/message/src/main/java" />
</sourcefiles>
</group>
<group name="offlineshop">
<classfiles>
<fileset dir="${code_base}/offlineshop/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/offlineshop/src/main/java" />
</sourcefiles>
</group>
<group name="order">
<classfiles>
<fileset dir="${code_base}/order/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/order/src/main/java" />
</sourcefiles>
</group>
<group name="payment">
<classfiles>
<fileset dir="${code_base}/payment/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/payment/src/main/java" />
</sourcefiles>
</group>
<group name="product">
<classfiles>
<fileset dir="${code_base}/product/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/product/src/main/java" />
</sourcefiles>
</group>
<group name="promotion">
<classfiles>
<fileset dir="${code_base}/promotion/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/promotion/src/main/java" />
</sourcefiles>
</group>
<group name="seller">
<classfiles>
<fileset dir="${code_base}/seller/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/seller/src/main/java" />
</sourcefiles>
</group>
<group name="service">
<classfiles>
<fileset dir="${code_base}/service/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/service/src/main/java" />
</sourcefiles>
</group>
<group name="sns">
<classfiles>
<fileset dir="${code_base}/sns/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/sns/src/main/java" />
</sourcefiles>
</group>
<group name="users">
<classfiles>
<fileset dir="${code_base}/users/target/classes" />
</classfiles>
<sourcefiles encoding="gbk">
<fileset dir="${code_base}/users/src/main/java" />
</sourcefiles>
</group>
</structure>
<html destdir="${reportfolderPath}" encoding="utf-8" />
</jacoco:report>
</target>
</project>