0

i am using javemelody to monitor performance of my app. i am using jetty maven plugin which starts up during mvn install and runs all test cases before generating the war. i wanted to generate a pdf report at the end of post-integration-test phase.

<execution>
 <id>stop-jetty</id>
 <phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>

i was thinking if i can access the report url of embedded jetty to access javamelody, then maybe i can download my report to some location like using curl localserver/context/monitoring?reports=pdf

is it possible to execute a custom script/java program in the post-integration-test phase before shutting down the embedded jetty ?

Ashish Thukral
  • 1,445
  • 1
  • 16
  • 26

1 Answers1

1

I would suggest to start jetty in the pre-integration-test phase do what ever you need to do in the integration-test phase and shutdown in post-integration phase.

Everything you need to do can be run via an integration test by the usage of the maven-failsafe-plugin.

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.16</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

with the above setup you can simply write an integration test for example WhatEverINeedToDoIT.java in src/test/java location and run it.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • thanks for the direction. what i want to do in my case is before jetty is shutdown in post-integration phase, i want to call up my custom java class/method and hit the embedded jetty to download a report from javamelody. can you suggest how can i achieve that? – Ashish Thukral Feb 19 '14 at 19:29