清理后用Ant编译项目

时间:2018-07-02 15:02:49

标签: ant compilation project

我正在尝试使用Ant编译我的项目,以使用JUnit对其进行测试,并监视测试用例所使用的代码的代码覆盖率(JaCoCo)。我想删除(清除)所有内容并在每次运行Ant构建时重新编译

<target name="clean">
    <delete dir="target/classes"/>
    <delete dir="target/test-classes"/>
    <delete dir="target/test-report"/>
    <delete dir="target/coverage-report"/>
</target>

所以现在我尝试使用“清理,构建,测试,覆盖”目标运行,并且出现很多错误,例如

compile:
[javac] Compiling 256 source files to C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\target\classes
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\controller\CareTeamControllerAjax.java:25: error: package org.springframework.beans.factory.annotation does not exist
[javac] import org.springframework.beans.factory.annotation.Autowired;
[javac]                                                    ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\controller\CareTeamControllerAjax.java:26: error: package org.springframework.http does not exist
[javac] import org.springframework.http.HttpHeaders;
[javac]                                ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\controller\CareTeamControllerAjax.java:66: error: cannot find symbol
[javac]     public @ResponseBody ResponseEntity<?> searchCareTeam(  @RequestParam(value="id") long targetId,
[javac]                          ^
[javac]   symbol:   class ResponseEntity
[javac]   location: class CareTeamControllerAjax
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\controller\CareTeamControllerAjax.java:121: error: cannot find symbol
[javac]                                                                 Authentication auth) {
[javac]                                                                 ^
[javac]   symbol:   class Authentication
[javac]   location: class CareTeamControllerAjax
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\controller\CareTeamControllerAjax.java:119: error: cannot find symbol  C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\service\RegistryService.java:98: error: cannot find symbol
[javac]     private BCryptPasswordEncoder passwordEncoder;
[javac]             ^
[javac]   symbol:   class BCryptPasswordEncoder
[javac]   location: class RegistryService
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\dto\PersonDTO.java:25: error: package javax.validation does not exist
[javac] import javax.validation.Valid;
[javac]                        ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\dto\PersonDTO.java:26: error: package javax.validation.constraints does not exist
[javac] import javax.validation.constraints.Size;
[javac]                                    ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\dto\PersonDTO.java:34: error: package org.apache.commons.lang3 does not exist
[javac] import org.apache.commons.lang3.StringUtils;
[javac]                                ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\dto\GeneralPractitionerDTO.java:30: error: package javax.validation.constraints does not exist
[javac] import javax.validation.constraints.Pattern;
[javac]                                    ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\dto\GeneralPractitionerDTO.java:31: error: package javax.validation.constraints does not exist
[javac] import javax.validation.constraints.Size;
[javac]                                    ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\dto\GeneralPractitionerDTO.java:37: error: package org.hibernate.validator.constraints does not exist
[javac] import org.hibernate.validator.constraints.NotBlank;
[javac]                                           ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\validation\BirthLocationConstraint.java:8: error: package javax.validation does not exist
[javac] import javax.validation.Constraint;
[javac]                        ^
[javac] C:\Users\lubrano\Development\gitrepos\ECWebAppLocalRepo\ecwebapp\src\main\java\it\********\validation\BirthLocationConstraint.java:9: error: package javax.validation does not exist
[javac] import javax.validation.Payload;
[javac]                        ^
[javac] .............. 
BUILD FAILED

重建整个项目时,我是否忘记导入/包含某些内容?

编辑:这是我的类路径

    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE xml>
<!-- WARNING: Eclipse auto-generated file.
              Any modifications will be overwritten.
              To include a user specific buildfile here, simply create one in the same
              directory with the processing instruction <?eclipse.ant.import?>
              as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="ecwebapp" xmlns:jacoco="antlib:org.jacoco.ant">
    <property environment="env"/>
    <!-- ECLIPSE -->
    <property name="ECLIPSE_HOME" value="../../../../../../Program Files (x86)/eclipse/"/>
    <!-- JUNIT -->
    <property name="junit.output.dir" value="target/test-report"/>
    <!-- JACOCO -->
    <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
        <classpath path="${ECLIPSE_HOME}plugins/org.apache.ant_1.9.6.v201510161327/lib/jacocoant.jar"/>
    </taskdef>
    <property name="src.dir" location="./src/main/java"/>
    <property name="source.dir" location="src"/>
    <property name="result.dir" location="./target"/>
    <property name="result.classes.dir" location="${result.dir}/classes"/>
    <property name="result.report.dir" location="${result.dir}/coverage-report"/>
    <property name="result.exec.file" location="${result.dir}/coverage-report/jacoco.exec"/>

    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.8"/>
    <property name="source" value="1.8"/>
    <path id="Maven Dependencies.libraryclasspath">
        <pathelement location="../../../../.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
        <pathelement location="../../../../.m2/repository/javax/servlet/jsp/javax.servlet.jsp-api/2.3.1/javax.servlet.jsp-api-2.3.1.jar"/>
        <pathelement location="../../../../.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar"/>
        <pathelement location="../../../../.m2/repository/javax/validation/validation-api/2.0.0.Final/validation-api-2.0.0.Final.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-context/4.3.5.RELEASE/spring-context-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-aop/4.3.5.RELEASE/spring-aop-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-beans/4.3.5.RELEASE/spring-beans-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-expression/4.3.5.RELEASE/spring-expression-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-core/4.3.5.RELEASE/spring-core-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-web/4.3.5.RELEASE/spring-web-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-webmvc/4.3.5.RELEASE/spring-webmvc-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-jdbc/4.3.5.RELEASE/spring-jdbc-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-tx/4.3.5.RELEASE/spring-tx-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-orm/4.3.5.RELEASE/spring-orm-4.3.5.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/security/spring-security-web/4.2.0.RELEASE/spring-security-web-4.2.0.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/security/spring-security-core/4.2.0.RELEASE/spring-security-core-4.2.0.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/security/spring-security-config/4.2.0.RELEASE/spring-security-config-4.2.0.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/security/spring-security-taglibs/4.2.1.RELEASE/spring-security-taglibs-4.2.1.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/security/spring-security-acl/4.2.1.RELEASE/spring-security-acl-4.2.1.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/mysql/mysql-connector-java/5.1.39/mysql-connector-java-5.1.39.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-core/3.0.7/tiles-core-3.0.7.jar"/>
        <pathelement location="../../../../.m2/repository/commons-digester/commons-digester/2.0/commons-digester-2.0.jar"/>
        <pathelement location="../../../../.m2/repository/org/slf4j/jcl-over-slf4j/1.7.6/jcl-over-slf4j-1.7.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-api/3.0.7/tiles-api-3.0.7.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-request-api/1.0.6/tiles-request-api-1.0.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-servlet/3.0.7/tiles-servlet-3.0.7.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-request-servlet/1.0.6/tiles-request-servlet-1.0.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-jsp/3.0.7/tiles-jsp-3.0.7.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-template/3.0.7/tiles-template-3.0.7.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-autotag-core-runtime/1.2/tiles-autotag-core-runtime-1.2.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/tiles/tiles-request-jsp/1.0.6/tiles-request-jsp-1.0.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/hibernate/hibernate-core/5.2.8.Final/hibernate-core-5.2.8.Final.jar"/>
        <pathelement location="../../../../.m2/repository/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar"/>
        <pathelement location="../../../../.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar"/>
        <pathelement location="../../../../.m2/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar"/>
        <pathelement location="../../../../.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
        <pathelement location="../../../../.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.1.Final/jboss-transaction-api_1.2_spec-1.0.1.Final.jar"/>
        <pathelement location="../../../../.m2/repository/org/jboss/jandex/2.0.3.Final/jandex-2.0.3.Final.jar"/>
        <pathelement location="../../../../.m2/repository/com/fasterxml/classmate/1.3.0/classmate-1.3.0.jar"/>
        <pathelement location="../../../../.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/hibernate/common/hibernate-commons-annotations/5.0.1.Final/hibernate-commons-annotations-5.0.1.Final.jar"/>
        <pathelement location="../../../../.m2/repository/org/hibernate/hibernate-validator/5.3.4.Final/hibernate-validator-5.3.4.Final.jar"/>
        <pathelement location="../../../../.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.4/jackson-databind-2.8.4.jar"/>
        <pathelement location="../../../../.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar"/>
        <pathelement location="../../../../.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.4/jackson-core-2.8.4.jar"/>
        <pathelement location="../../../../.m2/repository/junit/junit/4.12/junit-4.12.jar"/>
        <pathelement location="../../../../.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
        <pathelement location="../../../../.m2/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar"/>
        <pathelement location="../../../../.m2/repository/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/spring-test/4.3.7.RELEASE/spring-test-4.3.7.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar"/>
        <pathelement location="../../../../.m2/repository/commons-pool/commons-pool/1.3/commons-pool-1.3.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/security/spring-security-test/4.2.2.RELEASE/spring-security-test-4.2.2.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/boot/spring-boot-starter-test/1.5.2.RELEASE/spring-boot-starter-test-1.5.2.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/boot/spring-boot-test/1.5.2.RELEASE/spring-boot-test-1.5.2.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/boot/spring-boot/1.5.2.RELEASE/spring-boot-1.5.2.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/boot/spring-boot-test-autoconfigure/1.5.2.RELEASE/spring-boot-test-autoconfigure-1.5.2.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.2.RELEASE/spring-boot-autoconfigure-1.5.2.RELEASE.jar"/>
        <pathelement location="../../../../.m2/repository/com/jayway/jsonpath/json-path/2.2.0/json-path-2.2.0.jar"/>
        <pathelement location="../../../../.m2/repository/net/minidev/json-smart/2.2.1/json-smart-2.2.1.jar"/>
        <pathelement location="../../../../.m2/repository/net/minidev/accessors-smart/1.1/accessors-smart-1.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar"/>
        <pathelement location="../../../../.m2/repository/org/assertj/assertj-core/2.6.0/assertj-core-2.6.0.jar"/>
        <pathelement location="../../../../.m2/repository/org/mockito/mockito-core/1.10.19/mockito-core-1.10.19.jar"/>
        <pathelement location="../../../../.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/skyscreamer/jsonassert/1.4.0/jsonassert-1.4.0.jar"/>
        <pathelement location="../../../../.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar"/>
        <pathelement location="../../../../.m2/repository/org/dbunit/dbunit/2.5.3/dbunit-2.5.3.jar"/>
        <pathelement location="../../../../.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/poi/poi-ooxml/3.14/poi-ooxml-3.14.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/poi/poi/3.14/poi-3.14.jar"/>
        <pathelement location="../../../../.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/poi/poi-ooxml-schemas/3.14/poi-ooxml-schemas-3.14.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/xmlbeans/xmlbeans/2.6.0/xmlbeans-2.6.0.jar"/>
        <pathelement location="../../../../.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
        <pathelement location="../../../../.m2/repository/com/github/virtuald/curvesapi/1.03/curvesapi-1.03.jar"/>
        <pathelement location="../../../../.m2/repository/com/github/springtestdbunit/spring-test-dbunit/1.3.0/spring-test-dbunit-1.3.0.jar"/>
        <pathelement location="../../../../.m2/repository/com/h2database/h2/1.4.194/h2-1.4.194.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-api-mockito/1.6.6/powermock-api-mockito-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-api-mockito-common/1.6.6/powermock-api-mockito-common-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-api-support/1.6.6/powermock-api-support-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-module-junit4/1.6.6/powermock-module-junit4-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-module-junit4-common/1.6.6/powermock-module-junit4-common-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-core/1.6.6/powermock-core-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/powermock/powermock-reflect/1.6.6/powermock-reflect-1.6.6.jar"/>
        <pathelement location="../../../../.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar"/>
        <pathelement location="../../../../.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar"/>
        <pathelement location="../../../../.m2/repository/net/sf/dozer/dozer/5.5.1/dozer-5.5.1.jar"/>
        <pathelement location="../../../../.m2/repository/commons-beanutils/commons-beanutils/1.9.1/commons-beanutils-1.9.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/jacoco/org.jacoco.ant/0.8.1/org.jacoco.ant-0.8.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/jacoco/org.jacoco.agent/0.8.1/org.jacoco.agent-0.8.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/jacoco/org.jacoco.core/0.8.1/org.jacoco.core-0.8.1.jar"/>
        <pathelement location="../../../../.m2/repository/org/jacoco/org.jacoco.report/0.8.1/org.jacoco.report-0.8.1.jar"/>
    </path>
    <path id="JUnit 4.libraryclasspath">
        <pathelement location="${ECLIPSE_HOME}plugins/org.junit_4.12.0.v201504281640/junit.jar"/>
        <pathelement location="${ECLIPSE_HOME}plugins/org.hamcrest.core_1.3.0.v201303031735.jar"/>
    </path>
    <path id="ecwebapp.classpath">
        <pathelement location="target/classes"/>
        <pathelement location="target/test-classes"/>
        <path refid="Maven Dependencies.libraryclasspath"/>
        <path refid="JUnit 4.libraryclasspath"/>
    </path>
    <path id="run.AllDAOTests.classpath">
        <path refid="ecwebapp.classpath"/>
        <path refid="Maven Dependencies.libraryclasspath"/>
    </path>
    <path id="run.DeviceDAOTest.classpath">
        <path refid="ecwebapp.classpath"/>
        <path refid="Maven Dependencies.libraryclasspath"/>
    </path>
    <path id="run.ScheduleActivityDAOTest.classpath">
        <path refid="ecwebapp.classpath"/>
        <path refid="Maven Dependencies.libraryclasspath"/>
    </path>
    <target name="init">
        <mkdir dir="target/classes"/>
        <mkdir dir="target/test-classes"/>
        <copy includeemptydirs="false" todir="target/classes">
            <fileset dir="src/main/java">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.xtend"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/classes">
            <fileset dir="src/main/resources">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.xtend"/>
                <exclude name="**/*.java"/>
                <exclude name="**"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/test-classes">
            <fileset dir="src/test/unit/java">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.xtend"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/classes">
            <fileset dir="src/test/unit/resources">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.xtend"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/test-classes">
            <!-- <fileset dir="src/test/java"> -->
            <fileset dir="src/test/unit/java">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.xtend"/>
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="target/test-classes">
            <fileset dir="src/test/resources">
                <exclude name="**/*.launch"/>
                <exclude name="**/*.xtend"/>
                <exclude name="**/*.java"/>
                <exclude name="**"/>
            </fileset>
        </copy>
    </target>
    <target name="clean">
        <delete dir="target/classes"/>
        <delete dir="target/test-classes"/>
        <delete dir="target/test-report"/>
        <delete dir="target/coverage-report"/>
    </target>
    <!-- ADDED -->
    <target name="compile">
        <mkdir dir="${result.classes.dir}"/>
        <javac srcdir="${source.dir}" destdir="${result.classes.dir}" debug="true" includeantruntime="false"/>
        <classpath refid="Maven Dependencies.libraryclasspath"/>
        <classpath refid="ecwebapp.classpath"/>
    </target>

    <target depends="clean" name="cleanall"/>
    <target depends="build-subprojects,build-project" name="build"/>
    <target name="build-subprojects"/>
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="target/classes" includeantruntime="false" source="${source}" target="${target}">
            <src path="src/main/java"/>
            <src path="src/main/resources"/>
            <src path="src/test/unit/resources"/>
            <exclude name="**"/>
            <classpath refid="ecwebapp.classpath"/>
        </javac>
        <javac debug="true" debuglevel="${debuglevel}" destdir="target/test-classes" includeantruntime="false" source="${source}" target="${target}" encoding="iso-8859-1">
            <src path="src/test/unit/java"/>
            <!-- <src path="src/test/java"/> -->
            <src path="src/test/resources"/>
            <exclude name="**"/>
            <classpath refid="ecwebapp.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
        <copy todir="${ant.library.dir}">
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </copy>
        <unzip dest="${ant.library.dir}">
            <patternset includes="jdtCompilerAdapter.jar"/>
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </unzip>
    </target>
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        <antcall target="build"/>
    </target>

    <target name="AllDAOTests">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <!-- List of test -->
            <test name="it.********.dao.DeviceDAOTest" todir="${junit.output.dir}"/>
            <test name="it.********.dao.ScheduleActivityDAOTest" todir="${junit.output.dir}"/>
            <jvmarg line="-ea"/>
            <classpath refid="run.AllDAOTests.classpath"/>
        </junit>
    </target>

    <!-- JUNIT -->
    <!--
    <target name="junitreport">
        <!- Generates the report 
        <!- Specifies the directory to which the merged XML file is to be saved 
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <!- Added report style (styledir="junit/reportstyle") 
            <report styledir="src/test/resources" format="noframes" todir="${junit.output.dir}"/>
        </junitreport>
    </target>
    -->
    <target name="test" depends="compile">
        <mkdir dir="${result.report.dir}"/>
        <jacoco:coverage destfile="${result.exec.file}">    
            <junit printsummary="yes" haltonfailure="off" fork="yes">
                <classpath refid="run.AllDAOTests.classpath"/>
                <formatter type="xml"/>
                <batchtest todir="${result.report.dir}">
                    <fileset dir="target/test-classes">
                        <include name="**/*Test.class"/>
                    </fileset>
                </batchtest>
            </junit>
        </jacoco:coverage>
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report styledir="src/test/resources" format="noframes" todir="${junit.output.dir}"/>
        </junitreport>
     </target>

    <target name="coverage" depends="test">
        <jacoco:report>                
            <executiondata>
                <file file="${result.exec.file}"/>  
            </executiondata>               
        <structure name="Code Annotation Project"> 
          <classfiles>
            <fileset dir="${result.classes.dir}"/>
            <fileset dir="target/test-classes"/>
          </classfiles>
          <sourcefiles encoding="ISO-8859-1">
            <fileset dir="src/main/java"/>
            <!-- <fileset dir="src/test/java"/> -->
          </sourcefiles>
            </structure>
            <html destdir="${result.report.dir}"/>         
        </jacoco:report>
      </target>

</project>

0 个答案:

没有答案