6

We're using the maven-jmeter-plugin and I've setup a jmeter profile. When I run mvn -Pjmeter verify the various maven life cycles get run, but none of them need to.

How can I run just the JMeter tests?

<profile>
  <id>jmeter</id>
  <build>
    <plugins>
      <plugin>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>${jmeter.version}</version>
        <executions>
          <execution>
            <id>jmeter-tests</id>
            <phase>verify</phase>
            <goals>
              <goal>jmeter</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <testResultsTimestamp>false</testResultsTimestamp>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>
Ardesco
  • 7,281
  • 26
  • 49
EGHM
  • 2,144
  • 23
  • 37

2 Answers2

2

Unfortunately, it looks like the author of the plugin did not implement a MOJO that would support direct invocation, hence the plugin must be used as a part of lifecycle execution — within the <build> section.

If you need to run tests quickly, you could try to temporarily change the <phase> to some earlier one, for example validate. I'm sure, though, this is not the phase the plugin intended to be run in, so you can't change this permanently.

MaDa
  • 10,511
  • 9
  • 46
  • 84
  • Do you know enough about implementing a MOJO that would support direct invocation to clue me in on how I could patch it to do so? Or maybe a link to an example or tutorial specific to MOJO direct invocation? – EGHM Jul 23 '13 at 20:51
  • 1
    Annotate the MOJO class with `@Mojo(name="goalName",requiresDirectInvocation=true)`. A starting place for MOJO development is http://maven.apache.org/guides/plugin/guide-java-plugin-development.html – MaDa Jul 23 '13 at 22:33
  • Thanks for the details, I've made the modification and submitted a pull request. – EGHM Jul 24 '13 at 23:28
  • But the pull request is being backed out. See https://github.com/Ronnie76er/jmeter-maven-plugin/pull/70 for details – EGHM Aug 15 '13 at 22:17
2

You can run just JMeter tests with the following command:

mvn jmeter:jmeter -Pjmeter

To see the rest of the goals you can execute the following:

mvn help:describe -DgroupId=com.lazerycode.jmeter  -DartifactId=jmeter-maven-plugin -Ddetail=true
Ruslans Uralovs
  • 1,122
  • 10
  • 18