eclipse配置jmeter源码开发环境

Jmeter

jmeter下载源码

新建Java Project

eclipse配置jmeter源码开发环境_第1张图片

eclipse配置jmeter源码开发环境_第2张图片

然后关闭eclipse

修改.classpath

将该Java项目目录中的.eclipse内容删掉,然后用jmeter源码里的eclipse.classpath内容复制到该文件中

eclipse.classpath

<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<!-- This is a sample Eclipse .classpath file, which can be used to help set up the proper .classpath. Note that the "con" entry may be different on individual systems, but the other entries should generally be the same, unless you attach sources or javadoc to the jars. Eclipse seems to use TABS for indenting the entries. -->
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="src" output="build/components" path="src/components"/>
    <classpathentry kind="src" output="build/core" path="src/core"/>
    <classpathentry kind="src" output="build/examples" path="src/examples"/>
    <classpathentry kind="src" output="build/functions" path="src/functions"/>
    <classpathentry kind="src" output="build/jorphan" path="src/jorphan"/>
    <classpathentry kind="src" output="build/junit" path="src/junit"/>
    <classpathentry kind="src" output="build/monitor/components" path="src/monitor/components"/>
    <classpathentry kind="src" output="build/monitor/model" path="src/monitor/model"/>
    <classpathentry kind="src" output="build/protocol/ftp" path="src/protocol/ftp"/>
    <classpathentry kind="src" output="build/protocol/http" path="src/protocol/http"/>
    <classpathentry kind="src" output="build/protocol/java" path="src/protocol/java"/>
    <classpathentry kind="src" output="build/protocol/jdbc" path="src/protocol/jdbc"/>
    <classpathentry kind="src" output="build/protocol/jms" path="src/protocol/jms"/>
    <classpathentry kind="src" output="build/protocol/ldap" path="src/protocol/ldap"/>
    <classpathentry kind="src" output="build/protocol/mail" path="src/protocol/mail"/>
    <classpathentry kind="src" output="build/protocol/mongodb" path="src/protocol/mongodb"/>
    <classpathentry kind="src" output="build/protocol/native" path="src/protocol/native"/>
    <classpathentry kind="src" output="build/protocol/tcp" path="src/protocol/tcp"/>
    <classpathentry kind="src" output="build/test" path="test/src"/>
    <classpathentry kind="lib" path="lib/avalon-framework-4.1.4.jar"/>
    <classpathentry kind="lib" path="lib/bsf-2.4.0.jar"/>
    <classpathentry kind="lib" path="lib/bsh-2.0b5.jar"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
    <classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-jexl-1.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-jexl-2.1.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-lang3-3.4.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
    <classpathentry kind="lib" path="lib/commons-math3-3.5.jar"/>
    <classpathentry kind="lib" path="lib/commons-net-3.3.jar"/>
    <classpathentry kind="lib" path="lib/commons-pool2-2.4.2.jar"/>
    <classpathentry kind="lib" path="lib/dnsjava-2.1.7.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-datasource-2.1.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-instrument-1.0.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-logger-1.1.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-pool-api-2.1.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-pool-impl-2.1.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-pool-instrumented-2.1.jar"/>
    <classpathentry kind="lib" path="lib/geronimo-jms_1.1_spec-1.1.1.jar"/>
    <classpathentry kind="lib" path="lib/htmllexer-2.1.jar"/>
    <classpathentry kind="lib" path="lib/htmlparser-2.1.jar"/>
    <classpathentry kind="lib" path="lib/httpclient-4.2.6.jar"/>
    <classpathentry kind="lib" path="lib/httpcore-4.2.5.jar"/>
    <classpathentry kind="lib" path="lib/httpmime-4.2.6.jar"/>
    <classpathentry kind="lib" path="lib/jcharts-0.7.5.jar"/>
    <classpathentry kind="lib" path="lib/jdom-1.1.3.jar"/>
    <classpathentry kind="lib" path="lib/jodd-core-3.6.6.jar"/>
    <classpathentry kind="lib" path="lib/jodd-lagarto-3.6.6.jar"/>
    <classpathentry kind="lib" path="lib/jodd-log-3.6.6.jar"/>
    <classpathentry kind="lib" path="lib/jsoup-1.8.2.jar"/>
    <classpathentry kind="lib" path="lib/jtidy-r938.jar"/>
    <classpathentry kind="lib" path="lib/junit-4.12.jar"/>
    <classpathentry kind="lib" path="lib/logkit-2.0.jar"/>
    <classpathentry kind="lib" path="lib/mail-1.5.0-b01.jar"/>
    <classpathentry kind="lib" path="lib/mongo-java-driver-2.11.3.jar"/>
    <classpathentry kind="lib" path="lib/oro-2.0.8.jar"/>
    <classpathentry kind="lib" path="lib/rhino-1.7.7.jar"/>
    <classpathentry kind="lib" path="lib/rsyntaxtextarea-2.5.7.jar"/>
    <classpathentry kind="lib" path="lib/serializer-2.7.2.jar"/>
    <classpathentry kind="lib" path="lib/slf4j-api-1.7.12.jar"/>
    <classpathentry kind="lib" path="lib/slf4j-nop-1.7.12.jar"/>
    <classpathentry kind="lib" path="lib/soap-2.3.1.jar"/>
    <classpathentry kind="lib" path="lib/tika-core-1.10.jar"/>
    <classpathentry kind="lib" path="lib/tika-parsers-1.10.jar"/>
    <classpathentry kind="lib" path="lib/xalan-2.7.2.jar"/>
    <classpathentry kind="lib" path="lib/xercesImpl-2.11.0.jar"/>
    <classpathentry kind="lib" path="lib/xml-apis-1.4.01.jar"/>
    <classpathentry kind="lib" path="lib/xmlgraphics-commons-2.0.1.jar"/>
    <classpathentry kind="lib" path="lib/xmlpull-1.1.3.1.jar"/>
    <classpathentry kind="lib" path="lib/xpp3_min-1.1.4c.jar"/>
    <classpathentry kind="lib" path="lib/xstream-1.4.8.jar"/>
    <!-- Needed for build and test -->
    <classpathentry kind="lib" path="lib/api/bcmail-jdk15on-1.49.jar"/>
    <classpathentry kind="lib" path="lib/api/bcprov-jdk15on-1.49.jar"/>
    <classpathentry kind="lib" path="lib/api/bcpkix-jdk15on-1.49.jar"/>
    <classpathentry kind="output" path="build"/>
</classpath>

复制文件到Java Project

将jmeter里的源码文件复制到Java项目中,注意这个地方要删点里面的文件夹binsrc:

复制前

eclipse配置jmeter源码开发环境_第3张图片

复制后

eclipse配置jmeter源码开发环境_第4张图片

下载jar包

在Java项目的根目录下执行ant download_jars:

eclipse配置jmeter源码开发环境_第5张图片

再次打开eclipse

刷新一下我们的Java项目,就会出现添加到目录中的所有文件
eclipse配置jmeter源码开发环境_第6张图片

build项目

eclipse配置jmeter源码开发环境_第7张图片

执行成功后输出如下:
eclipse配置jmeter源码开发环境_第8张图片

如何运行失败或无法运行,在该项目上右键Properties-Builders-New-Ant Builder,配置如下:
eclipse配置jmeter源码开发环境_第9张图片

运行项目

如果你执行到次,恭喜你已经配置好源码环境,但是还不能运行项目,你还需要配置Run Configurations:

eclipse配置jmeter源码开发环境_第10张图片

Main选项卡配置

eclipse配置jmeter源码开发环境_第11张图片

Arguments选项卡配置

eclipse配置jmeter源码开发环境_第12张图片

ClassPath选项卡配置

eclipse配置jmeter源码开发环境_第13张图片

Source选项卡配置

eclipse配置jmeter源码开发环境_第14张图片

现出原形

eclipse配置jmeter源码开发环境_第15张图片

你可能感兴趣的:(eclipse配置jmeter源码开发环境)