Skip to content

Instantly share code, notes, and snippets.

@JohnZavyn
Created August 5, 2016 16:54
Show Gist options
  • Save JohnZavyn/205cc62085210bd94d86747de9017d1d to your computer and use it in GitHub Desktop.
Save JohnZavyn/205cc62085210bd94d86747de9017d1d to your computer and use it in GitHub Desktop.
Renaming a dependency JAR before buiding a WAR in Maven
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<!--
New Relic is used for monitoring and troubleshooting in all environments.
It is configured on the server with the -javaagent JVM option.
This file needs to be named in a predictable manner when updates occur,
so we use this plugin to download the artifact and manually name it "newrelic.jar"
-->
<groupId>com.newrelic.agent.java</groupId>
<artifactId>newrelic-agent</artifactId>
<version>${com.newrelic.version}</version>
<type>jar</type>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
<destFileName>newrelic.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment