jmeter原始碼---匯入eclipse工程
阿新 • • 發佈:2019-02-17
下載jmeter原始檔
eclipse新建工程
1、開啟Eclipse,建立一個JavaProject,按照下面的截圖建立JavaProject;
第二步中一定要勾選 “Allow output folders for source folders”,否則會將原來資料夾已有的檔案刪除~
2、匯入jmeter原始碼
選擇 “JmeterSrc32”專案,右鍵選擇import,然後選擇“File System”
3、用Ant下載專案所需要的jar檔案
執行download_jars
Buildfile: D:\eclipsWS\jmeterWS\JmeterSrc32\build.xml
download_jars:
[mkdir] Created dir: D:\eclipsWS\jmeterWS\JmeterSrc32\build
_process_all_jars:
_check_exists:
_check_jarfile:
[echo] Checking accessors-smart-1.2.jar
[echo] Deleting accessors-smart-* (excluding accessors-smart-1.2.jar)
setproxy:
_get_jarfile:
[echo] Fetching: lib/accessors-smart-1.2.jar
[get] Getting: https://repo1.maven.org/maven2/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar
[get] To: D:\eclipsWS\jmeterWS\JmeterSrc32\build\accessors-smart-1.2.jar
……
4、新增jar到工程依賴:alt+enter調出工程屬性,java build path–>libraries–>add external Jars
lib/api子資料夾中的jar也要新增
5、 JmeterSrc32資料夾中將“eclipse.classpath”重新命名為“.classpath”
6、執行測試
執行NewDriver.java,發現提示路徑不對
ERROR StatusLogger Unable to access file:/D:/eclipsWS/jmeterWS/bin/log4j2.xml
java.io.FileNotFoundException: D:\eclipsWS\jmeterWS\bin\log4j2.xml (系統找不到指定的路徑。)
……
19:05:47.394 [main] ERROR org.apache.jmeter.JMeter - An error occurred:
java.lang.RuntimeException: Could not read JMeter properties file:D:\eclipsWS\jmeterWS\bin\jmeter.properties
……
修改NewDriver.java
tmpDir = userDir.getAbsoluteFile().getParent();
為
tmpDir = userDir.getAbsoluteFile().getAbsolutePath();
再次執行即可~