码迷,mamicode.com
首页 > 编程语言 > 详细

Adding a JavaAgent

时间:2014-09-03 09:36:16      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:http   io   java   ar   for   art   div   cti   sp   

Copy from: http://tomee.apache.org/javaagent.html

 

Adding a JavaAgent

Adding a java agent is done via a vm parameter as follows:

java -javaagent:openejb-javaagent-4.6.0.jar _\[other params...](other-params....html)

 

:title=Need the JavaAgent?} The java agent is only required if using OpenJPA as your persistence provider or if using CMP.
}

 

Maven2

In maven2 you can enable the javaagent for your tests by adding this to your pom.xml file:

<build>
  <plugins>
    <!-- this configures the surefire plugin to run your tests with the javaagent enabled -->
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <forkMode>pertest</forkMode>
        <argLine>-javaagent:${project.basedir}/target/openejb-javaagent-4.6.0.jar</argLine>
        <workingDirectory>${project.basedir}/target</workingDirectory>
      </configuration>
    </plugin>

    <!-- this tells maven to copy the openejb-javaagent jar into your target/ directory -->
    <!-- where surefire can see it -->
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <executions>
        <execution>
          <id>copy</id>
          <phase>process-resources</phase>
          <goals>
            <goal>copy</goal>
          </goals>
          <configuration>
            <artifactItems>
              <artifactItem>
                <groupId>org.apache.openejb</groupId>
                <artifactId>openejb-javaagent</artifactId>
                <version>4.6.0</version>
                <outputDirectory>${project.build.directory}</outputDirectory>
              </artifactItem>
            </artifactItems>
          </configuration>
        </execution>
      </executions>
    </plugin>

  </plugins>
</build>

Adding a JavaAgent

标签:http   io   java   ar   for   art   div   cti   sp   

原文地址:http://www.cnblogs.com/hellotech/p/3952883.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!