Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Avoid using maven.test.skip


You might manage an extremely small project that does not evolve a lot without unit tests. However, any large-scale project cannot exist without unit tests. Unit tests provide the first level of guarantee that you do not break any existing functionality with a newly introduced code change. In an ideal scenario, you should not commit any code to a source repository without building the complete project with unit tests.

Maven uses the surefire plugin to run tests, and as a malpractice, developers skip the execution of unit tests by setting the maven.test.skip property to true:

$ mvn clean install –Dmaven.test.skip=true

This can lead to serious repercussions in the later stage of the project, and you must ensure that all your developers do not skip testing while building.

Using the requireProperty rule of the Maven enforcer plugin, you can ban developers from using the maven.test.skip property. The following shows the enforcer plugin configuration that you need to...