[英]How to generate executeable jar file using eclipse with multiple packages
[英]How to create testNG executeable .jar
我對testNG有問題,如何從testNG文件創建.jar(可執行文件)。 我正在使用蝕月神。
謝謝
您的問題令人困惑。 但是我想您想使用testng
生成jar文件,其中您具有一組具有不同功能的類以進行自動化測試。
創建將導入ITestListener
或ISuiteListener
並根據要求實現功能的testng類文件。
生成具有不同目標的ant文件,您可以在其中編譯代碼。 您必須在ant xml文件中設置生成jar的目標。
使用此jar文件,您只需導入並設置其他項目的構建路徑。 現在,您可以訪問在jar中創建的全部功能。
下面的代碼將有助於將可執行的jar創建到ant xml文件中。
<!-- compile-build is previous target. current build is depend on it. After compilation this build executed -->
<!-- directory-attrib is attribule to where you save your jar -->
<!-- bin.dir is you compiled class file, generally it is bin directory -->
<!-- version-num is version num specified by you -->
<property name="bin.dir" value="${basedir}/bin" />
<target name="build" depends="compile-build"
description="build and pack Jar API classes">
<jar destfile="${directory-attrib}/ur-jar-name.jar" basedir="${bin.dir}">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<section name="Build-Info">
<attribute name="Version" value="${version-num}" />
</section>
</manifest>
</jar>
</target>
生成構建xml文件並編譯為Ant Build。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.