2016-10-13 9 views
-1

コンソールでコードを実行すると、正常に動作します。それはまた、日食にうまく動作します。しかし、私がJenkinsでビルドしようとすると、srcフォルダを要求しています。Jenkins Antビルドに失敗しました "srcは存在しません!"

"C:¥Program Files(x86)¥Jenkins¥Workspace¥job1¥src"は存在しません!

のbuild.xml

<project name="Sample Ant build" basedir="."> 
<!-- ========== Initialize Properties =================================== --> 
<!-- set global properties for build --> 
<property name="basedir" value="." /> 
<property name="lib" value="${basedir}/lib" /> 
<property name="src" value="${basedir}/src" /> 
<property name="bin" value="${basedir}/bin" /> 
<property name="report-dir" value="${basedir}/Test-Report" /> 
<property name="testng-report-dir" value="${report-dir}/TestNGreport" /> 

<!-- ====== Set the classpath ==== --> 
<path id="classpath"> 
    <pathelement location="${bin}" /> 
    <fileset dir="C:\WebDriver\Selenium"> 
     <include name="*.jar" /> 
    </fileset> 
</path> 

<!-- Delete directories --> 
<target name="delete-dir"> 
    <delete dir="${bin}" /> 
    <delete dir="${report-dir}" /> 
</target> 

<!-- Creating directories --> 
<target name="create" depends="delete-dir"> 
    <mkdir dir="${bin}" /> 
    <mkdir dir="${report-dir}" /> 
</target> 

<!-- Compile the java code from ${src} into ${bin} --> 
<target name="compile" depends="create"> 
    <javac srcdir="${src}" classpathref="classpath" includeAntRuntime="No" destdir="${bin}" /> 
    <echo> /* Compiled Directory Classes */ </echo> 
</target> 

<!-- Runs the file and generates Reportng report for TestNG--> 
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpathref="classpath" /> 

<target name="testng-execution" depends="compile"> 
    <mkdir dir="${testng-report-dir}" /> 
    <testng outputdir="${testng-report-dir}" classpathref="classpath" useDefaultListeners="true"> 
     <xmlfileset dir="${basedir}" includes="testng.xml" /> 
    </testng> 
</target> 

答えて

0

のEclipseワークスペースを使用して、ジェンキンスは、ワークスペースを使用しています(そして、我々の場合には、TFSはまた、ワークスペースを使用しています)。彼らは同じことではありません。

あなたのbuild.xmlスクリプトは、BASEDIRを "。"、または作業ディレクトリに設定しています(あなたの質問には正式に回答するための詳細がいくつかありません)。ジェンキンスジョブの場合、それは以下の通りである - Administering Jenkinsを参照してください:あなたのケースで

JENKINS_HOME 
+- workspace (working directory for the version control system) 
+- [JOBNAME] (sub directory for each job) 

JENKINS_HOME\workspace\[JOBNAME]C:\Program Files (x86)\Jenkins\Work space\job1です。

私のお金は、あなたのEclipseワークスペースがマップされている場所ではありません。

私は、次の推奨事項になるだろう:

  • はあなたのコードを開発し、あなたのEclipse IDEでそれをテストします。満足したら、バージョン管理システム(VCS)にコミットします。

  • VCSのコードをジョブのローカルワークスペースにプルしてそこにビルドするようにJenkinsを設定します。作業コピーとは別のものであるため、変更を隔離し、すべてをソース管理に委ねて、再現性のある既知のソースからビルドを作成できるようにします。 C:\Program Files ...の外部位置に

    • セットJEKNINS_HOME。インストールバイナリの場所に(ソースファイルやビルドのような)データを配置するのは悪い習慣です。セキュリティなど、そうする財の理由の多く、簡単にスペース管理など

    • 適切な場所を選択し、マスターのためのディレクトリ構成設定(ジェンキンスを|ジェンキンス管理|設定システム;最初の3つの値)

    • distributed builds(マスタ/ノード)を使用して、IF
    • 、あなたのノード構成内(ジェンキンス|ジェンキンスを管理するには|ノードを管理|設定=>リモートルートディレクトリ)適切な場所に

関連する問題