Package de.thetaphi.forbiddenapis.maven
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 Summary
FieldsModifier and TypeFieldDescriptionprivate FileDirectory with the class files to check.Injected test classpath.private StringThe default compiler release version used to expand references to bundled JDK signatures.private StringThe default compiler target version used to expand references to bundled JDK signatures.Fields inherited from interface de.thetaphi.forbiddenapis.Constants
BS_JDK_NONPORTABLE, CLASS_CONSTRUCTOR_METHOD_NAME, CONSTRUCTOR_METHOD_NAME, DEPRECATED_DESCRIPTOR, DEPRECATED_TYPE, DEPRECATED_WARN_FAIL_ON_UNRESOLVABLE_SIGNATURES, ENDS_WITH_VERSION_PATTERN, JDK_SIG_PATTERN, LAMBDA_META_FACTORY_INTERNALNAME, LAMBDA_METHOD_NAME_PREFIX, SIGNATURE_POLYMORPHIC_DESCRIPTOR, SIGNATURE_POLYMORPHIC_PKG_INTERNALNAMEFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class de.thetaphi.forbiddenapis.maven.AbstractCheckMojo
executeMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
classpathElements
@Parameter(defaultValue="${project.testClasspathElements}", readonly=true, required=true) private List<String> classpathElementsInjected test classpath. -
classesDirectory
@Parameter(required=false, defaultValue="${project.build.testOutputDirectory}") private File classesDirectoryDirectory with the class files to check. -
testTargetVersion
@Parameter(required=false, defaultValue="${maven.compiler.testTarget}") private String testTargetVersionThe 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 testReleaseVersionThe 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 totestTargetVersion.- Since:
- 3.1
-
-
Constructor Details
-
TestCheckMojo
public TestCheckMojo()
-
-
Method Details
-
getClassPathElements
Description copied from class:AbstractCheckMojoprovided by the concrete Mojos for compile and test classes processing- Specified by:
getClassPathElementsin classAbstractCheckMojo
-
getClassesDirectory
Description copied from class:AbstractCheckMojoprovided by the concrete Mojos for compile and test classes processing- Specified by:
getClassesDirectoryin classAbstractCheckMojo
-
getTargetVersion
Description copied from class:AbstractCheckMojogets overridden for test, because it uses testTargetVersion as optional name to override- Overrides:
getTargetVersionin classAbstractCheckMojo
-