2013-01-11 161 views
0

我想安排在jenkins中執行一個java類的以下ANT構建。當我在Eclipse中運行構建配置時,它會編譯並執行我的java類。當我在Jenkins中調度和執行build.xml時,它會執行構建,但無法編譯我的java類。然後它將該構建標記爲已成功完成。我在eclipse和jenkins中運行ANT版本1.8.4和Java版本1.7.0_03。我不確定詹金斯爲什麼沒有編寫課程?Eclipse Ant構建不是編譯在Jenkins

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
    <!-- 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="Sel_Framework_Grid"> 
<property environment="env"/> 
<property name="debuglevel" value="source,lines,vars"/> 
<property name="target" value="1.7"/> 
<property name="source" value="1.7"/> 
<path id="TestNG.libraryclasspath"> 
    <pathelement location="../../../.eclipse/com.springsource.sts_2.9.1.RELEASE_1574885722/plugins/org.testng.eclipse_6.7.0.20120802_0752/lib/testng.jar"/> 
</path> 
<path id="Sel_Framework_Grid.classpath"> 
    <pathelement location="bin"/> 
    <pathelement location="lib/activation.jar"/> 
    <pathelement location="lib/apache-mime4j-0.6.jar"/> 
    <pathelement location="lib/axis.jar"/> 
    <pathelement location="lib/bsh-1.3.0.jar"/> 
    <pathelement location="lib/cglib-nodep-2.1_3.jar"/> 
    <pathelement location="lib/commons-codec-1.4.jar"/> 
    <pathelement location="lib/commons-collections-3.2.1.jar"/> 
    <pathelement location="lib/commons-discovery.jar"/> 
    <pathelement location="lib/commons-exec-1.1.jar"/> 
    <pathelement location="lib/commons-io-2.0.1.jar"/> 
    <pathelement location="lib/commons-jxpath-1.3.jar"/> 
    <pathelement location="lib/commons-lang-2.6.jar"/> 
    <pathelement location="lib/commons-logging-1.1.1.jar"/> 
    <pathelement location="lib/commons-logging.jar"/> 
    <pathelement location="lib/cssparser-0.9.5.jar"/> 
    <pathelement location="lib/cxf-2.5.2.jar"/> 
    <pathelement location="lib/geronimo-activation_1.1_spec-1.1.jar"/> 
    <pathelement location="lib/geronimo-annotation_1.0_spec-1.1.1.jar"/> 
    <pathelement location="lib/geronimo-javamail_1.4_spec-1.7.1.jar"/> 
    <pathelement location="lib/geronimo-stax-api_1.0_spec-1.0.1.jar"/> 
    <pathelement location="lib/guava-10.0.1.jar"/> 
    <pathelement location="lib/hamcrest-all-1.1.jar"/> 
    <pathelement location="lib/htmlunit-2.9.jar"/> 
    <pathelement location="lib/htmlunit-core-js-2.9.jar"/> 
    <pathelement location="lib/httpclient-4.1.2.jar"/> 
    <pathelement location="lib/httpcore-4.1.3.jar"/> 
    <pathelement location="lib/httpmime-4.1.2.jar"/> 
    <pathelement location="lib/jaxb-api-2.2.3.jar"/> 
    <pathelement location="lib/jaxb-impl-2.2.4-1.jar"/> 
    <pathelement location="lib/jaxb-xjc-2.2.4-1.jar"/> 
    <pathelement location="lib/jaxen-core.jar"/> 
    <pathelement location="lib/jaxen-jdom.jar"/> 
    <pathelement location="lib/jaxrpc.jar"/> 
    <pathelement location="lib/jcommander-1.13.jar"/> 
    <pathelement location="lib/jcspclasses.jar"/> 
    <pathelement location="lib/jdom.jar"/> 
    <pathelement location="lib/jna-3.3.0.jar"/> 
    <pathelement location="lib/json-20080701.jar"/> 
    <pathelement location="lib/junit-dep-4.10.jar"/> 
    <pathelement location="lib/jython.jar"/> 
    <pathelement location="lib/log4j-1.2.8.jar"/> 
    <pathelement location="lib/mail.jar"/> 
    <pathelement location="lib/neethi-3.0.1.jar"/> 
    <pathelement location="lib/nekohtml-1.9.15.jar"/> 
    <pathelement location="lib/operadriver-v0.8.1.jar"/> 
    <pathelement location="lib/phwclasses.jar"/> 
    <pathelement location="lib/protobuf-java-2.4.1.jar"/> 
    <pathelement location="lib/saaj.jar"/> 
    <pathelement location="lib/sac-1.3.jar"/> 
    <pathelement location="lib/saxpath.jar"/> 
    <pathelement location="lib/serializer-2.7.1.jar"/> 
    <pathelement location="lib/sqljdbc4.jar"/> 
    <pathelement location="lib/stax2-api-3.1.1.jar"/> 
    <pathelement location="lib/velocity-1.7.jar"/> 
    <pathelement location="lib/woodstox-core-asl-4.1.1.jar"/> 
    <pathelement location="lib/wsdl4j-1.6.2.jar"/> 
    <pathelement location="lib/wsdl4j.jar"/> 
    <pathelement location="lib/xalan-2.7.1.jar"/> 
    <pathelement location="lib/xercesImpl-2.9.1.jar"/> 
    <pathelement location="lib/xml-apis-1.3.04.jar"/> 
    <pathelement location="lib/xml-resolver-1.2.jar"/> 
    <pathelement location="lib/xmlschema-core-2.0.1.jar"/> 
    <pathelement location="lib/AspriseJavaPDF-free.jar"/> 
    <pathelement location="lib/im4java-1.3.1-1.5.jar"/> 
    <pathelement location="lib/im4java-1.3.1.jar"/> 
    <pathelement location="lib/antlr-runtime-3.4.jar"/> 
    <pathelement location="lib/jna-3.4.0.jar"/> 
    <pathelement location="lib/testng-6.5.1.jar"/> 
    <pathelement location="lib/testng-6.5.1.zip"/> 
    <pathelement location="lib/slf4j-api-1.6.4.jar"/> 
    <pathelement location="lib/slf4j-nop-1.6.4.jar"/> 
    <pathelement location="lib/dom4j-1.6.1.jar"/> 
    <pathelement location="lib/poi-3.8-20120326.jar"/> 
    <pathelement location="lib/netty-3.2.7.Final.jar"/> 
    <pathelement location="lib/webbit-0.4.8-SNAPSHOT.jar"/> 
    <pathelement location="lib/dbunit-2.4.8-compatibileWithPoi-3.5-XLSXSupport.jar"/> 
    <pathelement location="lib/poi-ooxml-3.8-20120326.jar"/> 
    <pathelement location="lib/poi-ooxml-schemas-3.8-20120326.jar"/> 
    <pathelement location="lib/xbean.jar"/> 
    <pathelement location="lib/Aspose.Words.jdk16.jar"/> 
    <pathelement location="lib/ojdbc14.jar"/> 
    <pathelement location="lib/selenium-java-2.24.1-srcs.jar"/> 
    <pathelement location="lib/selenium-java-2.24.1.jar"/> 
    <pathelement location="lib/vim25.jar"/> 
    <path refid="TestNG.libraryclasspath"/> 
</path> 
<target name="init"> 
    <mkdir dir="bin"/> 
    <copy includeemptydirs="false" todir="bin"> 
     <fileset dir="src"> 
      <exclude name="**/*.java"/> 
     </fileset> 
    </copy> 
</target> 
<target name="clean"> 
    <delete dir="bin"/> 
</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="bin" source="${source}" target="${target}"> 
     <src path="src"/> 
     <classpath refid="Sel_Framework_Grid.classpath"/> 
    </javac> 
</target> 
<target name="BaseSet Test"> 
    <java classname="BaseSet" failonerror="true" fork="yes"> 
     <arg line="C:\temp\testng-customsuite.xml c:\Jenkinstest Firefox,IE,EN,Ready"/> 
     <classpath refid="Sel_Framework_Grid.classpath"/> 

    </java> 
</target> 

詹金斯控制檯輸出

由用戶匿名 建築在工作區的下開始:\用戶\空白\文件\工作空間STS-2.9.1.RELEASE \ Sel_Framework_Grid [ Sel_Framework_Grid] $ cmd.exe/C'「C:\ AutomatedTesting \ apache-ant-1.8.4-bin \ apache-ant-1.8.4 \ bin \ ant.bat -file buildA.xml -Dbuild.sysclasspath = false - buildfile C:\ Users \ blank \ Documents \ workspace-sts-2.9.1.RELEASE \ Sel_Framework_Grid \ buildA.xml & &出口%% ERRORLEVEL %%「」 構建文件:C:\用戶\空白\文件\工作空間STS-2.9.1.RELEASE \ Sel_Framework_Grid \ buildA.xml

積聚子項目:

初始化:

積聚項目: [回波] Sel_Framework_Grid:C:\用戶\空白\文件\工作空間STS-2.9.1.RELEASE \ Sel_Framework_Grid \ buildA.xml

構建:

BUILD SUCC ESSFUL 總時間:0秒 成品:SUCCESS

的Eclipse控制檯輸出

構建文件:C:\用戶\空白\文件\工作空間STS-2.9.1.RELEASE \ Sel_Framework_Grid \ buildf.xml 集結子項目: INIT: 積聚項目: [回波] Sel_Framework_Grid:C:\用戶\空白\文件\工作空間STS-2.9.1.RELEASE \ Sel_Framework_Grid \ buildf.xml [javac的] C:\ Users \ blank \ Documents \ workspace-sts-2.9.1.RELEASE \ Sel_Framework_Grid \ buildf.xml: build: BaseSet測試: 【JAVA] [TestNG的]跑步: 【JAVA] C:\ TEMP \ TestNG的-customsuite.xml

回答

0

看來你沒有指定一組目標,從您的詹金斯建立運行。這意味着將運行默認目標「build」:

<target depends="build-subprojects,build-project" name="build"/> 

目標「BaseSet Test」是一個運行您的java類的程序。似乎失蹤。我建議改變你的詹金斯工作,以運行以下目標代替

build, BaseSet Test