-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
build.xml
48 lines (38 loc) · 1.94 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Simple Project analyzed with the SonarQube Scanner for Ant" default="all" basedir="." xmlns:sonar="antlib:org.sonar.ant">
<!-- ========= Define the main properties of this project ========= -->
<property name="src.dir" value="src" />
<property name="build.dir" value="target" />
<property name="classes.dir" value="${build.dir}/classes" />
<!-- 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://localhost:9000" />
<!-- Define the Sonar properties -->
<property name="sonar.projectKey" value="org.sonarqube:sonar-scanner-ant" />
<property name="sonar.projectName" value="Example of SonarQube Scanner for Ant Usage" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.sources" value="src" />
<property name="sonar.binaries" value="target" />
<property name="sonar.sourceEncoding" value="UTF-8" />
<!-- ========= Define "regular" targets: clean, compile, ... ========= -->
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${classes.dir}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${classes.dir}" fork="true" debug="true" includeAntRuntime="false" />
</target>
<!-- ========= Define SonarQube Scanner for Ant Target ========= -->
<target name="sonar" depends="compile">
<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="path/to/sonar/ant/task/lib/sonarqube-ant-task-*.jar" />
</taskdef>
<!-- Execute SonarQube Scanner for Ant Analysis -->
<sonar:sonar />
</target>
<!-- ========= The main target "all" ========= -->
<target name="all" depends="clean,compile,sonar" />
</project>