forked from nihar30/simple-java-maven-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
107 lines (94 loc) · 3.88 KB
/
build.xml
File metadata and controls
107 lines (94 loc) · 3.88 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
<?xml version="1.0"?>
<project name="simple-java-maven-app" default="build" basedir="." xmlns:sonar="antlib:org.sonar.ant" xmlns:jacoco="antlib:org.jacoco.ant">
<property environment="env" />
<property name="ECLIPSE_HOME" value="../../" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.7" />
<property name="source" value="1.7" />
<property name="report.junit" value="report/junit" />
<property name="reports.jacoco.dir" value="report/jacoco" />
<!-- Define the SonarQube global properties (the most usual way is to pass these properties via the command line) -->
<property name="sonar.host.url" value="http://20.106.158.209:9000/" />
<!-- Define the Sonar properties -->
<property name="sonar.projectKey" value="Sample-ANT" />
<property name="sonar.projectName" value="Sample-ANT" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.sources" value="src/main" />
<property name="sonar.java.libraries" value="lib/*.jar" />
<property name="sonar.java.binaries" value="bin" />
<property name="sonar.tests" value="src/test" />
<property name="sonar.sourceEncoding" value="UTF-8" />
<property name="sonar.jacoco.reportPaths" value= "/home/runner/work/simple-java-maven-app/simple-java-maven-app/*.xml" />
<property name="sonar.coverage.jacoco.xmlReportPaths" value="/home/runner/work/simple-java-maven-app/simple-java-maven-app/report/jacoco/jacoco.exec" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="${reports.jacoco.dir}/jacoco.exec" />
<path id="libraries.path">
<!-- Include compiles classes -->
<pathelement location="bin" />
<!-- Include all jar files located in lib directory -->
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- Init -->
<target name="init">
<mkdir dir="bin" />
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!-- Clean -->
<target name="clean">
<delete dir="bin" />
</target>
<target depends="init" name="build">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src/main" />
<src path="src/test" />
<classpath refid="libraries.path" />
</javac>
</target>
<target name="sonar" depends="junit">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<!-- Update the following line, or put the "sonar-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path="/home/runner/work/simple-java-maven-app/simple-java-maven-app/lib/sonarqube-ant-task-2.7.1.1951.jar" />
</taskdef>
<!-- Execute SonarQube Scanner for Ant Analysis -->
<sonar:sonar />
</target>
<target name="junit" depends="build">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="/home/runner/work/simple-java-maven-app/simple-java-maven-app/lib/jacocoant.jar" />
</taskdef>
<jacoco:coverage destfile="${reports.jacoco.dir}/jacoco.exec">
<junit fork="true" forkmode="once">
<classpath refid="libraries.path" />
<formatter type="plain" />
<batchtest fork="yes" todir="${report.junit}">
<fileset dir="src\test">
<include name="**/*Test*.java" />
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<!-- Create Local Reports as well -->
<jacoco:report>
<executiondata>
<file file="${reports.jacoco.dir}/jacoco.exec" />
</executiondata>
<structure name="Some Legacy Code">
<classfiles>
<fileset dir="bin" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src\main" />
</sourcefiles>
</structure>
<html destdir="report/jacoco" />
</jacoco:report>
</target>
</project>