eclipse3.2 下編譯jmeter源代碼

1,下載jakarta-jmeter-2.2_src.zip和jakarta-jmeter-2.2.zip解壓。
2,下載3個jar包,(很重要要不會有n多的錯誤),分別是mail.jar,jms.jar,activation.jarphp

 

javamail:    http://java.sun.com/products/javamail/downloads/index.html  ,其中包括mail.jar和文檔
Activation.jar :  http://java.sun.com/products/javabeans/jaf/downloads/index.html ,其中包括Activation.jar
打開頁面後分別點擊 進入下載頁面,點「  Accept License Agreement    」,下載zip。
Jms.jar: 參考附件中的jms.jar
 
3,將jakarta-jmeter-2.2.zip下的lib中的jar包拷到jakarta-jmeter-2.2_src.zip下的lib目錄中並加上下載的三個jar包。而且修改
commons-logging1.1.jar爲commons-logging.jar。而後在lib目錄下新增兩個空文件夾ext,junit.
4,從jakarta-jmeter-2.2.zip解壓的目錄下複製ApacheJMeter.jar和jmeter.properties到jakarta-jmeter-2.2_src.zip解壓的目錄下。
5,而後打開eclipse,新建java工程,命名,選擇import,選擇從文件導入,選擇jakarta-jmeter-2.2_src.zip解壓後的目錄,選擇除src目錄之外的全部目錄。以後再導入src目錄(由於新建java工程是已經有src目錄了),因此要分別導入。
6,關閉eclipse將jakarta-jmeter-2.2_src.zip下的eclipse.classpath中的內容複製一份替換工程下的.classpath的內容,同時增長几個jar包。內容以下:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry utput="build/jorphan" kind="src" path="src/jorphan"/>
    <classpathentry utput="build/examples" kind="src" path="src/examples"/>
    <classpathentry utput="build/junit" kind="src" path="src/junit"/>
    <classpathentry utput="build/reports" kind="src" path="src/reports"/>
    <classpathentry utput="build/test" kind="src" path="test/src"/>
    <classpathentry utput="build/protocol/jms" kind="src" path="src/protocol/jms"/>
    <classpathentry utput="build/protocol/mail" kind="src" path="src/protocol/mail"/>
    <classpathentry excluding="org/apache/jmeter/p_w_picpaths/|org/apache/jmeter/resources/*.properties" utput="build/core" kind="src" path="src/core"/>
    <classpathentry utput="build/components" kind="src" path="src/components"/>
    <classpathentry utput="build/functions" kind="src" path="src/functions"/>
    <classpathentry utput="build/protocol/http" kind="src" path="src/protocol/http"/>
    <classpathentry utput="build/protocol/ftp" kind="src" path="src/protocol/ftp"/>
    <classpathentry utput="build/protocol/jdbc" kind="src" path="src/protocol/jdbc"/>
    <classpathentry utput="build/protocol/java" kind="src" path="src/protocol/java"/>
    <classpathentry utput="build/protocol/ldap" kind="src" path="src/protocol/ldap"/>
    <classpathentry utput="build/protocol/tcp" kind="src" path="src/protocol/tcp"/>
    <classpathentry utput="build/monitor/model" kind="src" path="src/monitor/model"/>
    <classpathentry utput="build/monitor/components" kind="src" path="src/monitor/components"/>
    <classpathentry utput="build/htmlparser" kind="src" path="src/htmlparser"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="lib/excalibur-logger-1.1.jar"/>
    <classpathentry kind="lib" path="lib/avalon-framework-4.1.4.jar"/>
    <classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
    <classpathentry kind="lib" path="lib/js.jar"/>
    <classpathentry kind="lib" path="lib/junit.jar"/>
    <classpathentry kind="lib" path="lib/logkit-1.2.jar"/>
    <classpathentry kind="lib" path="lib/Tidy.jar"/>
    <classpathentry kind="lib" path="lib/commons-collections.jar"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
    <classpathentry kind="lib" path="lib/soap.jar"/>
    <classpathentry kind="lib" path="lib/jdom-1.0.jar"/>
    <classpathentry kind="lib" path="lib/xalan.jar"/>
    <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
    <classpathentry kind="lib" path="lib/xml-apis.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging.jar"/>
        <classpathentry kind="lib" path="lib/commons-jexl-1.0.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-datasource-1.1.1.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-instrument-1.0.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-pool-1.2.jar"/>
    <classpathentry kind="lib" path="lib/xstream-1.1.3.jar"/>
    <classpathentry kind="lib" path="lib/xpp3_min-1.1.3.4.I.jar"/>
    <classpathentry kind="lib" path="lib/batik-awt-util.jar"/>
    <classpathentry kind="lib" path="lib/jCharts-0.7.5.jar"/>
    <classpathentry kind="lib" path="lib/bsf-2.3.0.jar"/>
        <classpathentry kind="lib" path="lib/mail.jar"/>
        <classpathentry kind="lib" path="lib/activation.jar"/>
        <classpathentry kind="lib" path="lib/jms.jar"/>
    <classpathentry kind="output" path="lib/ext"/>
                                          
</classpath>
而後從新開啓eclipse,選擇工程編譯,此時會有20個錯誤吧,是junit的錯誤,定位到java文件修改下代碼(前幾行有正確的格式assertequal函數的參數有錯)。編譯成功了。

8,選擇build.xml使用ant打包.
9,以後可參考http://people.apache.org/~mkostrze/jmeter-eclipse/index.html的後半部份,這樣就能夠用eclipse來進行debug了。

更加詳細的信息,查看:http://people.apache.org/~mkostrze/jmeter-eclipse/index.html
----------------------------------------------------------------------------------------------------------------
本人實踐:
一、解壓jar和src到同一個目錄下。2.3.4版本使用ant進行編譯應該能夠正常經過(直接運行ant)。
源代碼: http://archive.apache.org/dist/jakarta/jmeter/source/
二進制代碼: http://archive.apache.org/dist/jakarta/jmeter/binaries/
 
二、建立java工程,再以文件方式導入jmeter工程到eclipse中
到eclipse中。
三、關閉eclipse,使用jmeter下面的eclipse.classpath覆蓋當前eclipse工程中.classpath,再啓動eclipse。2.3.4版本中,使用了多個source folder的方式,因此須要build path ->config build path ->source ->add folder -> src -> components、core、examples、functions等多個folder進行添加。再導入jmeter2.3.4的lib子文件夾下面的jar包。
四、修改commons-logging-1.1.jar爲commons-logging.jar。在2.3.4版本中,能夠不用修改。
五、導入mail.jar,jms.jar,activation.jar
六、將lib包中的commons-jexl-1.0.jar加入classpath中。在2.3.4版本中能夠不用此步驟。
七、導入以後在eclipse中去執行,ant順利經過。在2.3.4版本中,不會出現亂碼等現象。

------------------------------------------------------------------------------------------

Maven JMeter Plugin

相關文章
相關標籤/搜索