This page describes information about using Eclipse to develop JMeter. You don't have to use Eclipse, but many of us do. So here are some tips for getting it set up.
The JMeterAndEclipseHowTo describes the basics of setting up a JMeter project in Eclipse and configuring Eclipse to run JMeter successfully.
In order to match the conventions agreed to by JMeter committers in January 2003 (see the mailing list archive) the following settings are recommended. These settings are in Eclipse 2.1.1 – earlier or later versions probably have similar settings, but possibly in different places.
- Select Window | Preferences. Choose Java | Code Formatter. Use the following options in the "New Lines" tab. (Options which aren't listed are up to you to decide.)
- Insert a new line before an opening brace (selected)
- Insert new lines in control statements (selected)
- Insert new line between 'else if' (deselected)
- Insert a new line inside an empty block (selected)
- In the "Line Splitting" tab, "Maximum line length" should be set to 80.
- In the "Style" tab, use the following options:
- Insert space after a cast (selected)
- Insert tabs for indentation, not spaces (deselected)
- Number of spaces representing an indentation level: 4
- In Java | Code Generation, use patterns similar to the following in the "Code and Comments" section:
- Code | New Java files, see http://www.apache.org/legal/src-headers.html#headers for the boilerplate to be used.
- In Java | Editor, use the following settings:
- Print margin column: 80
- Show print margin (selected) (This way you can see where 80 columns is at when writing code and comments.)
Most Eclipse formatting settings are managed at the workspace level. If you work on other projects in addition to JMeter, you probably don't want the JMeter formatting to apply to your other projects. One way to manage this is to set up multiple Eclipse workspaces – one for JMeter, and one (or more) for other projects. To use multiple workspaces, simply start eclipse with the "-data" parameter:
You could also create a batch file, shell script, or Windows shortcut to automatically specify the workspace so you don't have to type it each time.