Class TestCheckMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
de.thetaphi.forbiddenapis.maven.AbstractCheckMojo
de.thetaphi.forbiddenapis.maven.TestCheckMojo
All Implemented Interfaces:
Constants, org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="testCheck", threadSafe=true, requiresProject=true, requiresDependencyResolution=TEST, defaultPhase=VERIFY) public final class TestCheckMojo extends AbstractCheckMojo
Mojo to check if no project generated class files (test scope) contain calls to forbidden APIs from the project classpath and a list of API signatures (either inline or as pointer to files or bundled signatures). At least one signature must be given, using any of the corresponding optional parameters.

Since version 2.0 this Mojo defaults to run in the 'verify' lifecycle phase, before it was done in 'process-test-classes' phase, which caused problems for some users (especially debugging tests).

Since:
1.2
  • Field Details

    • classpathElements

      @Parameter(defaultValue="${project.testClasspathElements}", readonly=true, required=true) private List<String> classpathElements
      Injected test classpath.
    • classesDirectory

      @Parameter(required=false, defaultValue="${project.build.testOutputDirectory}") private File classesDirectory
      Directory with the class files to check.
    • testTargetVersion

      @Parameter(required=false, defaultValue="${maven.compiler.testTarget}") private String testTargetVersion
      The default compiler target version used to expand references to bundled JDK signatures. This setting falls back to "targetVersion" if undefined. This can be used to override the target version solely used for tests. E.g., if you use "jdk-deprecated", it will expand to this version. This setting should be identical to the target version used in the compiler plugin.
      Since:
      1.4
    • testReleaseVersion

      @Parameter(required=false, defaultValue="${maven.compiler.testRelease}") private String testReleaseVersion
      The default compiler release version used to expand references to bundled JDK signatures. This setting falls back to "releaseVersion" if undefined. This can be used to override the release version solely used for tests. E.g., if you use "jdk-deprecated", it will expand to this version. This setting should be identical to the release version used in the compiler plugin. If given, this setting is used in preference to testTargetVersion.
      Since:
      3.1
  • Constructor Details

    • TestCheckMojo

      public TestCheckMojo()
  • Method Details