Skip to content

Instantly share code, notes, and snippets.

@stephenc
Created August 11, 2020 10:17
Show Gist options
  • Save stephenc/4961f40fba9d208bebd811c73387a719 to your computer and use it in GitHub Desktop.
Save stephenc/4961f40fba9d208bebd811c73387a719 to your computer and use it in GitHub Desktop.
How to allow testing with a different version from the command line
<project>
...
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>com.example.foo</groupId>
<artifactId>bar</artifactId>
<version>1.2.3</version>
</dependency>
...
</dependencies>
</dependencyManagement>
...
<profiles>
<profile>
<id>foo-bar-version</id>
<!-- support testing with a different version of foo-bar -->
<activation>
<property>
<name>foo-bar-version</name> <!-- remember folks, properties with . can cause surprise issues -->
</property>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.example.foo</groupId>
<artifactId>bar</artifactId>
<version>${foo-bar-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment