You can pass variables to snyk test running on Maven or Gradle projects. This is useful when you want to test a specific profile (in Maven) or configuration (in Gradle), or pass system properties. This is done by sending flags after a double-dash option when running snyk test. Note that all flags after the double-dash option will be used as Maven or Gradle flags.
For example, suppose you want to test a specific Maven profile: prod. Running the following will test this profile:
snyk test -- -Pprod
In another example, if you use a system property in your pom.xml file, e.g: <version>${pkg_version}</version>, you can define the system property in snyk test as follows:
snyk test -- -Dpkg_version=1.4
For testing a Gradle project with test dependencies, you would be able to pass the appropriate configuration to snyk test:
snyk test -- --configuration testCompile
Comments
0 comments
Article is closed for comments.