Skip to content

Instantly share code, notes, and snippets.

@rantav
Created September 12, 2012 07:40
Show Gist options
  • Save rantav/3704992 to your computer and use it in GitHub Desktop.
Save rantav/3704992 to your computer and use it in GitHub Desktop.
Using newrelic with maven, Java

When using newrelic in java, it isn't obvious how to mavenize things. Newrelic has two java jars: newrelic.jar and newrelic-api.jar. There's also another newrelic.yaml of course. For development you need the api.jar in your classpath. In production you want the api jar in the classpath, but also newrelic.jar as an agent. Newrelic have a good explanation about how to set up newrelic.jar as an agent but they don't have anything regarding how to develop and get the api jar in place using maven, so here goes...

Add the repository:

<repositories>
  <repository>
    <id>newrelic</id>
    <name>newrelic</name>
    <url>http://download.newrelic.com/</url>
  </repository>
</repositories>

Add the dependency:

<dependency>
  <groupId>newrelic.java-agent</groupId>
  <artifactId>newrelic-api</artifactId>
  <version>2.7.0</version>
</dependency>
@anandsunderraman
Copy link

Thanks this was helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment