{"id":103,"date":"2013-07-03T02:26:09","date_gmt":"2013-07-03T02:26:09","guid":{"rendered":"https:\/\/code4reference.com\/?p=103"},"modified":"2023-10-01T13:34:09","modified_gmt":"2023-10-01T13:34:09","slug":"code4referencejmeter-custom-build-code4reference","status":"publish","type":"post","link":"https:\/\/code4reference.com\/?p=103","title":{"rendered":"Jmeter custom build."},"content":{"rendered":"<p>JMeter provides almost all functionalities which are needed for load-testing. But sometimes functionalities do not match exactly with our requirement and code changes are required to get the custom JMeter build. This post is going to describe about my experience of building JMeter and fixing build error.<\/p>\n<p>First thing was required to get the source code. After little googling, I figured out that the source code can be cloned from the Apache repository. I used the following command to clone the source code.<\/p>\n<pre>\n\/&gt;git clone git:\/\/git.apache.org\/jmeter.git --recursive\n<\/pre>\n<p>Once looking into the source root directory I noticed build.xml which is clear indication of requirement of <code>ant<\/code> build system. Since I didn\u2019t have ant on Ubuntu, so used the following command to install <code>ant<\/code>.<\/p>\n<pre>\n\/&gt; sudo apt-get install ant\n<\/pre>\n<p>I was almost one step behind the custom build. Before issuing the build command I was curious to see what all targets are available. So I ran the following command.<\/p>\n<pre>\n\/&gt; ant -p\nBuildfile: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml\n\n\n  N.B. To build JMeter from a release you need both the binary and source archives,\n  and these must be unpacked into the same directory structure.\n\n  To download additional jars needed for building the code and documentation:\n\n      ant download_jars\n\n\n    To build JMeter from source:\n      ant [install]\n\n    To rebuild:\n      ant clean install\n\n    To update documentation\n      ant docs-site\n      ant docs-printable\n    To build API documentation (Javadoc)\n      ant docs-api\n    To build all the docs\n      ant docs-all\n\n    To build all and package up the files for distribution\n      ant distribution -Djmeter.version=vvvv [-Dsvn.revision=nnnnn]\n        \n    Add -Ddisable-svnCheck=true to disable svn check, if you build from src archive or offline\n        Add -Ddisable-check-versions=true to disable matching current svn revision and JMeterVersion.java,\n          if you want build your own custom JMeter package.\n\n    To create a nightly build (separate bin\/src\/lib jars):\n      ant nightly [-Dsvn.revision=nnnnn]\n\n    To create tar and tgz of the web-site documentation (docs and api)\n      ant site [ -Djmeter.version=vvvv ]\n\n\n    For more info:\n      ant -projecthelp\n\n    To diagnose usage of deprecated APIs:\n      ant -Ddeprecation=on clean compile\n  \nMain targets:\n\n RC_publish          Publish release candidate from svnpubsub area\n RC_upload           Upload release candidate to svnpubsub area\n batchtest           Run the batch test and compare output files\n batchtestserver     Run the batch test using client-server mode\n check_jars          Check that all required jar files are present\n clean               Clean up to force a build from source.\n clean-dist          Clean up dist directory.\n compile             Compile everything.\n compile-components  Compile generic (protocol-independent) components.\n compile-core        Compile JMeter core classes.\n compile-examples    Compile example components.\n compile-ftp         Compile components specific to FTP sampling.\n compile-functions   Compile functions.\n compile-http        Compile components specific to HTTP sampling.\n compile-java        Compile components specific to Java sampling.\n compile-jdbc        Compile components specific to JDBC sampling.\n compile-jms         Compile components specific to JMS sampling.\n compile-jorphan     Compile JOrphan utility classes.\n compile-junit       Compile components specific to JUnit sampling.\n compile-ldap        Compile components specific to LDAP sampling.\n compile-mail        Compile components specific to IMAP and POP3 sampling.\n compile-mongodb     Compile components specific to MongoDB sampling.\n compile-native      Compile components specific to Native sampling.\n compile-protocols   Compile all protocol-specific components.\n compile-report      Compile report components.\n compile-rmi         Compile RMI stubs and skeletons.\n compile-tcp         Compile components specific to TCP sampling.\n compile-tests       Compile test components only\n distribution        Build JMeter for end-user distribution\n docs-api            Generate the API documentation.\n docs-printable      Generate printable HTML documentation.\n docs-site           Generate browsable HTML documentation in web-site format.\n download_jars       Download any missing jar files\n findbugs            Run the stand-alone Findbugs detector\n generator_jar       Create the test tree generator jar\n gump-build          Build JMeter\n gump-test           Test JMeter in Gump\n install             Install JMeter. (Compiles code and creates jars)\n install-examples    Build and installs the example components.\n junit               Run individual JUnit test\n maven_upload        Upload Maven jars and poms (and sigs if present) to Nexus.\n nightly             Build JMeter for nightly dir (package docs-printable pack-nightly)\n package             Compile everything and create the jars\n package-only        Package already-compiled classes (shortcut for IDE users)\n prepare-resources   Prepare some resources files, update date\n release_delete      Delete old release candidate from svnpubsub area\n run_gui             Run the JMeter GUI off the jar files\n sign_dist           Sign release artifacts in dist and dist\/maven.  Usage: ant sign_dist -Dgpg.keyname=key-id [-Dgpg.secretKeyring=path-to-keyring]      \n svnCheck            Use SVN to get the current revision\n test                Run tests (use -Djava.awt.headless=true on systems without graphic displays)\nDefault target: install\n<\/pre>\n<p>Here help instructions ask to run <code>ant download_jars<\/code> first to get the depencies jar first since those are not present in the source directory. When executed the command I got the following failure.<\/p>\n<pre>\nBUILD FAILED\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2834: The following error occurred while executing this line:\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2772: The following error occurred while executing this line:\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2663: The following error occurred while executing this line:\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2701: Directory does not exist: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/lib\/api\n<\/pre>\n<p>I tried to google the solution but couldn\u2019t find any post. As pointed by the last line of the failure statement, I created the directory using the following command.<\/p>\n<pre>\n\/&gt; mkdir -p \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/lib\/api\n<\/pre>\n<p>And issued the same build command. I again got the similar failure message again..<\/p>\n<pre>\nBUILD FAILED\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2834: The following error occurred while executing this line:\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2813: The following error occurred while executing this line:\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2663: The following error occurred while executing this line:\n\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/build.xml:2701: Directory does not exist: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/lib\/doc\n<\/pre>\n<p>Because this was similar error, without waiting I issued the command to create the folder and tried the build command same command.<\/p>\n<pre>\n\/&gt; mkdir -p \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/lib\/doc\n<\/pre>\n<p>After download task was complete , issued <code>ant install<\/code> command to build the project. It worked fine and created the jar file in bin directory. Now the next step is to generate the distribution so issued the following command.<\/p>\n<pre>\n\/&gt; ant distribution -Djmeter.version=2.9 -Ddisable-svnCheck=true -Ddisable-check-versions=true\n<\/pre>\n<p>But got the following error.<\/p>\n<pre>\n     1 Setting JMeterHome: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\n     1 Setting up logging props using file: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/bin\/testfiles\/jmetertest.properties\n     1 \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/bin\/testfiles\/jmetertest.properties (No such file or directory)\n     1 Using initializeProperties() from org.apache.jmeter.util.JMeterUtils\n     1 Setting up initial properties using: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/bin\/testfiles\/jmetertest.properties\n     1 Initializing Properties: \/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/bin\/testfiles\/jmetertest.properties\n     1 Exception in thread \"main\" java.lang.RuntimeException: Could not read JMeter properties file:\/home\/rakeshHome2\/sprint\/jMeter\/src\/jmeter\/bin\/testfiles\/jmetertest.properties\n     1  at org.apache.jmeter.util.JMeterUtils.loadJMeterProperties(JMeterUtils.java:190)\n     1  at org.apache.jmeter.util.JMeterUtils.getProperties(JMeterUtils.java:139)\n     1  at org.apache.jmeter.util.JMeterUtils.initializeProperties(JMeterUtils.java:290)\n     1  at org.apache.jorphan.test.AllTests.initializeManager(AllTests.java:300)\n     1  at org.apache.jorphan.test.AllTests.main(AllTests.java:144)\n<\/pre>\n<p>After examining the error it looked like test target is looking for <code>jmetertest.properties<\/code> in testfiles directory. Tried to locate the directory but couldn\u2019t find it. Since <code>test<\/code> was throwing exception<br \/>\nI removed test from \u2018depends\u2019 section present in distribution target. After updating the line, it looked like this.<\/p>\n<pre>\n \n<\/pre>\n<p>It worked after this update. I was able to get the distribution in zip file. I tried to investigate this issue and turned to <code>git<\/code>. After executing <code>git status<\/code> command, I realized that somehow I have deleted the <code>testfiles<\/code> directory. After resetting the git, I was able to build JMeter successfully.<\/p>\n<p>Hope this blog helped you in some way. If you like this blog then please share it. You can also leave your comment below. You can find <a href=\"http:\/\/www.facebook.com\/Code4Reference\">Facebook page here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JMeter provides almost all functionalities which are needed for load-testing. But sometimes functionalities do not match exactly with our requirement and code changes are required to get the custom JMeter build. This post is going to describe about my experience of building JMeter and fixing build error. First thing was required to get the source [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=103"}],"version-history":[{"count":2,"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts\/103\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}