kemitix-parent/README.md

247 lines
8.7 KiB
Markdown
Raw Permalink Normal View History

2015-11-27 15:41:21 +00:00
KEMITIX-PARENT
==============
2017-12-29 18:49:54 +00:00
* `kemitix-parent`
* `kemitix-maven-tiles`
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
## Parent
A parent POM for my own personal projects.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Usage
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
```xml
<project>
2015-11-27 15:41:21 +00:00
<parent>
<groupId>net.kemitix</groupId>
<artifactId>kemitix-parent</artifactId>
<version>RELEASE</version>
2015-11-27 15:41:21 +00:00
</parent>
2017-12-29 18:49:54 +00:00
```
### Contents
The POM defines the following items:
* `issueManagement`
* `scm`
* `url`
* `inceptionYear`
* `licenses`
* `developers`
* `distributionManagement`
The POM sets the following properties:
* `project.reporting.outputEncoding` as `UTF-8`
* `java.version` as `1.8`
## Tiles
Maven Tiles for preconfigured plugins. These can be used independently of the `kemitix-parent` POM.
### Usage
```xml
<project>
<properties>
<tiles-maven-plugin.version>2.10</tiles-maven-plugin.version>
<kemitix-tiles.version>0.1.0</kemitix-tiles.version>
2017-12-29 18:49:54 +00:00
</properties>
<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>${tiles-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<tiles>
<tile>net.kemitix.tiles:all-tiles:${kemitix-tiles.version}</tile>
<!-- or -->
<tile>net.kemitix.tiles:maven-plugins-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:enforcer-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:compiler-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:checkstyle-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:huntbugs-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:pmd-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:digraph-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:testing-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:coverage-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:pitest-tile:${kemitix-tiles.version}</tile>
<tile>net.kemitix.tiles:release-tile:${kemitix-tiles.version}</tile>
</tiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
```
### Properties
If you want to override the version or configuration values of any of the plugins configured by the tiles, you can set the following properties to the desired value.
* `project.build.sourceEncoding`
* `maven-javadoc-plugin.version`
* `maven-source-plugin.version`
* `maven-gpg-plugin.version`
* `maven-deploy-plugin.version`
* `maven-compiler-plugin.version`
* `maven-surefire-plugin.version`
* `maven-failsafe-plugin.version`
* `maven-jxr-plugin.version`
* `java.version`
* `versions.version`
* `coveralls-maven-plugin.version`
### Maven Plugins Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Sets updated versions for the following `org.apache.maven.plugins`:
2017-12-29 18:49:54 +00:00
* `maven-clean-plugin`
* `maven-install-plugin`
* `maven-site-plugin`
2017-12-29 18:49:54 +00:00
Adds an updated version of the `org.codehaus.mojo:versions-maven-plugin` plugin.
2017-12-29 18:49:54 +00:00
#### Maven JXR Plugin
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Maven JXR Plugin](http://maven.apache.org/jxr/maven-jxr-plugin/index.html) produces cross-referenced HTML pages of your source code as part of the `compile` phase in `target/site/xref/`.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Enforcer Tile
2017-12-29 18:49:54 +00:00
Provides the `maven-enforcer-plugin`, performing the `display-info` and `enforce` goals during the `validate` phase.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Required Maven Version is set by the `required-maven.version` property.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Required Java Version is set by the `java.version` property.
### Compiler Tile
#### Maven Compiler Plugin
The [Maven Compiler Plugin](https://maven.apache.org/plugins/maven-compiler-plugin/) compiles your sources.
2015-11-27 15:41:21 +00:00
Ref: [compile:compile](https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html)
* showDeprecation: true
* showWarnings: true
* source: ${java.version}
* target: ${java.version}
* encoding: ${project.build.sourceEncoding}
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Checkstyle Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Maven Checkstyle Plugin](https://maven.apache.org/plugins/maven-checkstyle-plugin/) verifies the source code against a Checkstyle ruleset file.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The default ruleset is the level `5-complexity` ruleset from [`kemitix-checkstyle-ruleset`](https://github.com/kemitix/kemitix-checkstyle-ruleset).
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
To use another level within `kemitix-checkstyle-ruleset`, set the `ruleset.level` property. e.g. `4-tweaks`.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
To use a different checkstyle ruleset completely, set the `checkstyle.ruleset.location` property.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Huntbugs Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Huntbugs Maven Plugin](https://github.com/amaembo/huntbugs) performs a static analysis of the compiled bytecode for common bug patterns during the `verify` phase.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### PMD Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [PMD Maven Plugin](https://maven.apache.org/plugins/maven-pmd-plugin/) performs the PMD static code analysis during the `verify` phase.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Has a transitive dependency upon the `maven-plugins-tile` and includes it automatically.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Digraph Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Digraph Maven Plugin](https://github.com/kemitix/digraph-dependency-maven-plugin/) creates a graphviz diagram of the package dependencies within the source code during the `verify` phase.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Set the property `digraph-dependency.basePackage` to the base of the project to be graphed. The default value is `net.kemitix`.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Testing Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
#### Maven Surefire Plugin
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Maven Surefire Plugin](http://maven.apache.org/surefire/maven-surefire-plugin/index.html) runs your Unit Tests during the `test` phase.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Maven Failsafe Plugin
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Maven Failsafe Plugin](http://maven.apache.org/surefire/maven-failsafe-plugin/index.html) runs your Integration Tests during the `verify` phase.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
### Coverage Tile
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
#### Jacoco
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The [Jacoco Maven Plugin](http://www.eclemma.org/jacoco/trunk/doc/maven.html) verifies that the test suite meets the required coverage ratios.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
The defaults require that all classes, lines and branches be covered by tests. i.e. 100% code coverage.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Set the following properties to set less strict targets:
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
* `jacoco-class-line-covered-ratio` - default = 1 (i.e. 100%)
* `jacoco-class-instruction-covered-ratio` - default = 1 (i.e. 100%)
* `jacoco-class-missed-count-maximum` - default = 0 (i.e. #classes with no tests <= 0)
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Classes with names that end in the following are excluded from these limits:
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
* `Test`
* `IT`
* `Main`
* `Application`
* `Configuration`
* `Immutable`
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
#### Coveralls
2017-07-21 11:20:05 +01:00
2017-12-29 18:49:54 +00:00
The [Coveralls Maven Plugin](https://github.com/trautonen/coveralls-maven-plugin) publishes coverage data to coveralls.io.
2017-07-21 11:20:05 +01:00
2017-12-29 18:49:54 +00:00
The plugin is not configured to run automatically. It must be initiated manually, and requires the `release` profile to be enabled:
2017-07-21 11:20:05 +01:00
```shell
mvn -P release test jacoco:report coveralls:report
```
2017-12-29 18:49:54 +00:00
This runs the tests, creates the jacoco report from the tests then uploads the results to http://coveralls.io.
### Pitest Tile
#### Mutation Testing
The [Pitest Maven Plugin](http://pitest.org/quickstart/maven/) perform mutation test coverage checks during the `verify` phase.
Code coverage must by 100% and all mutations must result in a test from the test suite failing.
Set `pitest.skip` to avoid running the mutation test.
Set `pitest.coverage` to a value between 0 and 1 to set the allowed ratio of uncovered code. i.e. 0 = 100% code coverage, 0.2 = 80% code coverage
Set `pitest.mutation` to a value between 0 and 1 to set the allowed mutations to survive the test suite. i.e. 0 = 100% mutations caught, 0.2 = 80% mutations caught
#### Highwheel Cyclic Analysis
The [Highwheel Maven Plugin](https://github.com/hcoles/highwheel) detects and visualises class and package cyclic dependencies during the `verify` phase. It also reports on tests that appear to have been orphaned during refactoring.
The generated report is created in `target/highwheel/`.
### Release Tile
The plugins in this Tile are only activated when the `release` profile is enabled.
#### Maven Source Plugin
The [Maven Source Plugin](https://maven.apache.org/plugins/maven-source-plugin/) bundles your sources into a jar file ready for deployment.
2017-07-21 11:20:05 +01:00
2017-12-29 18:49:54 +00:00
Runs its [jar-no-fork](https://maven.apache.org/plugins/maven-source-plugin/jar-no-fork-mojo.html) goal during the `verify` phase.
2017-07-21 11:20:05 +01:00
2017-12-29 18:49:54 +00:00
#### Maven Javadoc Plugin
2017-07-21 11:20:05 +01:00
2017-12-29 18:49:54 +00:00
The [Maven Javadoc Plugin](https://maven.apache.org/plugins/maven-javadoc-plugin/) generates your html javadocs and bundles them into a jar file ready for deployment.
2015-11-27 15:41:21 +00:00
2017-12-29 18:49:54 +00:00
Runs its [jar](https://maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html) goal during the `verify` phase.
2017-12-29 18:49:54 +00:00
#### Maven Deploy Plugin
2017-12-29 18:49:54 +00:00
The [Maven Deploy Plugin](https://maven.apache.org/plugins/maven-deploy-plugin/) uploads your artifacts to a remote repository.