You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2023/02/13 19:27:57 UTC

[maven-build-cache-extension] 02/02: [MBUILDCACHE-39] Reformat

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git

commit 42eb2ec4dbd992d2172779fa2dc8c920cc46b4af
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Feb 13 11:04:21 2023 +0100

    [MBUILDCACHE-39] Reformat
---
 pom.xml                                            | 830 +++++++++----------
 .../BuildCacheMojosExecutionStrategy.java          | 307 +++----
 .../org/apache/maven/buildcache/CacheContext.java  |  23 +-
 .../apache/maven/buildcache/CacheController.java   |  24 +-
 .../maven/buildcache/CacheControllerImpl.java      | 922 +++++++++------------
 .../org/apache/maven/buildcache/CacheDiff.java     | 261 +++---
 .../buildcache/CacheLifecycleParticipant.java      |  19 +-
 .../apache/maven/buildcache/CacheRepository.java   |  17 +-
 .../org/apache/maven/buildcache/CacheResult.java   |  86 +-
 .../org/apache/maven/buildcache/CacheUtils.java    | 202 ++---
 .../apache/maven/buildcache/ChainedListener.java   | 132 ++-
 .../buildcache/DefaultMultiModuleSupport.java      | 181 ++--
 .../buildcache/DefaultNormalizedModelProvider.java | 160 ++--
 .../maven/buildcache/DefaultPluginScanConfig.java  |  23 +-
 .../buildcache/DefaultProjectInputCalculator.java  |  75 +-
 .../buildcache/DefaultRestoredArtifactHandler.java | 117 ++-
 .../maven/buildcache/LifecyclePhasesHelper.java    | 179 ++--
 .../maven/buildcache/LocalCacheRepository.java     |  19 +-
 .../maven/buildcache/LocalCacheRepositoryImpl.java | 450 +++++-----
 .../maven/buildcache/MojoParametersListener.java   |  59 +-
 .../maven/buildcache/MultiModuleSupport.java       |  13 +-
 .../maven/buildcache/NormalizedModelProvider.java  |   8 +-
 .../apache/maven/buildcache/PluginScanConfig.java  |  12 +-
 .../maven/buildcache/PluginScanConfigImpl.java     | 106 +--
 .../maven/buildcache/ProjectInputCalculator.java   |   8 +-
 .../maven/buildcache/RemoteCacheRepository.java    |  15 +-
 .../buildcache/RemoteCacheRepositoryImpl.java      | 268 +++---
 .../buildcache/RemoteCacheRepositoryNoOp.java      |  43 +-
 .../buildcache/RemoteCacheRepositoryProvider.java  |  24 +-
 .../org/apache/maven/buildcache/RestoreStatus.java |   5 +-
 .../maven/buildcache/RestoredArtifactHandler.java  |  16 +-
 .../maven/buildcache/ScanConfigProperties.java     |  14 +-
 .../org/apache/maven/buildcache/Xpp3DomUtils.java  |  76 +-
 .../buildcache/artifact/RestoredArtifact.java      | 102 +--
 .../checksum/DependencyNotResolvedException.java   |  10 +-
 .../maven/buildcache/checksum/DigestUtils.java     | 146 ++--
 .../apache/maven/buildcache/checksum/KeyUtils.java |  87 +-
 .../buildcache/checksum/MavenProjectInput.java     | 751 ++++++++---------
 .../apache/maven/buildcache/checksum/WalkKey.java  |  44 +-
 .../maven/buildcache/hash/CloseableBuffer.java     | 115 +--
 .../org/apache/maven/buildcache/hash/Hash.java     |  22 +-
 .../maven/buildcache/hash/HashAlgorithm.java       |  18 +-
 .../apache/maven/buildcache/hash/HashChecksum.java |  35 +-
 .../apache/maven/buildcache/hash/HashFactory.java  |  52 +-
 .../org/apache/maven/buildcache/hash/HexUtils.java |  49 +-
 .../maven/buildcache/hash/ReflectionUtils.java     |  39 +-
 .../java/org/apache/maven/buildcache/hash/SHA.java |  51 +-
 .../maven/buildcache/hash/ThreadLocalBuffer.java   |  54 +-
 .../maven/buildcache/hash/ThreadLocalDigest.java   |  45 +-
 .../java/org/apache/maven/buildcache/hash/XX.java  |  50 +-
 .../org/apache/maven/buildcache/hash/XXMM.java     |  29 +-
 .../org/apache/maven/buildcache/xml/Build.java     | 146 ++--
 .../apache/maven/buildcache/xml/CacheConfig.java   |  29 +-
 .../maven/buildcache/xml/CacheConfigImpl.java      | 494 +++++------
 .../apache/maven/buildcache/xml/CacheSource.java   |   5 +-
 .../apache/maven/buildcache/xml/CacheState.java    |   5 +-
 .../org/apache/maven/buildcache/xml/DtoUtils.java  | 166 ++--
 .../apache/maven/buildcache/xml/XmlService.java    | 156 ++--
 .../BuildCacheMojosExecutionStrategyTest.java      | 177 ++--
 .../org/apache/maven/buildcache/BuildInfoTest.java |  90 +-
 .../buildcache/LifecyclePhasesHelperTest.java      | 437 +++++-----
 .../java/org/apache/maven/buildcache/TestMojo.java |  93 +--
 .../buildcache/checksum/MavenProjectInputTest.java |  53 +-
 .../maven/buildcache/checksum/SHAHashTest.java     |  63 +-
 .../maven/buildcache/checksum/XXHashTest.java      | 132 +--
 .../apache/maven/buildcache/hash/HexUtilsTest.java |  50 +-
 .../maven/buildcache/its/BuildExtensionTest.java   |  23 +-
 .../maven/buildcache/its/CoreExtensionTest.java    |  23 +-
 .../its/ForkedExecutionCoreExtensionTest.java      |  50 +-
 .../apache/maven/buildcache/its/Issue21Test.java   |  17 +-
 .../maven/buildcache/its/RemoteCacheDavTest.java   | 480 +++++------
 .../maven/buildcache/its/junit/BeforeEach.java     |  10 +-
 .../apache/maven/buildcache/its/junit/Inject.java  |  10 +-
 .../buildcache/its/junit/IntegrationTest.java      |  13 +-
 .../its/junit/IntegrationTestExtension.java        | 264 +++---
 .../apache/maven/buildcache/its/junit/Test.java    |  14 +-
 .../maven/buildcache/xml/XmlServiceTest.java       |  89 +-
 .../internal/stub/LifecyclesTestUtils.java         | 136 +--
 78 files changed, 4180 insertions(+), 5438 deletions(-)

diff --git a/pom.xml b/pom.xml
index a8026e7..95c350b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
@@ -18,288 +17,238 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
-
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.maven.extensions</groupId>
-        <artifactId>maven-extensions</artifactId>
-        <version>39</version>
-        <relativePath />
-    </parent>
+  <modelVersion>4.0.0</modelVersion>
 
+  <parent>
     <groupId>org.apache.maven.extensions</groupId>
-    <artifactId>maven-build-cache-extension</artifactId>
-    <version>1.0.1-SNAPSHOT</version>
-    <packaging>jar</packaging>
+    <artifactId>maven-extensions</artifactId>
+    <version>39</version>
+    <relativePath />
+  </parent>
 
-    <name>Apache Maven Build Cache Extension</name>
-    <description>Maven Incremental Build and Cache (local and remote).</description>
-    <inceptionYear>2021</inceptionYear>
-    <url>https://maven.apache.org/extensions/maven-build-cache-extension/</url>
+  <groupId>org.apache.maven.extensions</groupId>
+  <artifactId>maven-build-cache-extension</artifactId>
+  <version>1.0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
 
-    <properties>
-        <javaVersion>8</javaVersion>
-        <minimalMavenBuildVersion>3.5.0</minimalMavenBuildVersion>
-        <minimalJavaBuildVersion>11</minimalJavaBuildVersion>
-        <classWorldsVersion>2.6.0</classWorldsVersion>
+  <name>Apache Maven Build Cache Extension</name>
+  <description>Maven Incremental Build and Cache (local and remote).</description>
+  <url>https://maven.apache.org/extensions/maven-build-cache-extension/</url>
+  <inceptionYear>2021</inceptionYear>
 
-        <!-- default maven version, can be override by maven3 profile -->
-        <mavenVersion>4.0.0-alpha-2</mavenVersion>
-        <maven.dir>maven4</maven.dir>
-        <maven.basedir>${project.build.directory}/${maven.dir}</maven.basedir>
+  <scm>
+    <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git</connection>
+    <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git</developerConnection>
+    <tag>master</tag>
+    <url>https://github.com/apache/maven-build-cache-extension/tree/${project.scm.tag}</url>
+  </scm>
+  <issueManagement>
+    <system>jira</system>
+    <url>https://issues.apache.org/jira/browse/MBUILDCACHE</url>
+  </issueManagement>
+  <ciManagement>
+    <system>Jenkins</system>
+    <url>https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-build-cache-extension/</url>
+  </ciManagement>
+  <distributionManagement>
+    <site>
+      <id>apache.website</id>
+      <url>scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path}</url>
+    </site>
+  </distributionManagement>
 
-        <formatter-maven-plugin.version>2.20.0</formatter-maven-plugin.version>
-        <impsort-maven-plugin.version>1.7.0</impsort-maven-plugin.version>
+  <properties>
+    <javaVersion>8</javaVersion>
+    <minimalMavenBuildVersion>3.5.0</minimalMavenBuildVersion>
+    <minimalJavaBuildVersion>11</minimalJavaBuildVersion>
+    <classWorldsVersion>2.6.0</classWorldsVersion>
 
-        <commonsCliVersion>1.4</commonsCliVersion>
-        <commonsLangVersion>3.12.0</commonsLangVersion>
-        <junitVersion>5.8.1</junitVersion>
-        <mockitoVersion>3.2.0</mockitoVersion>
-        <plexusUtilsVersion>3.4.1</plexusUtilsVersion>
-        <wagonVersion>3.4.3</wagonVersion>
-        <securityDispatcherVersion>2.0</securityDispatcherVersion>
-        <cipherVersion>2.0</cipherVersion>
-        <modelloVersion>1.11</modelloVersion>
-        <jxpathVersion>1.3</jxpathVersion>
-        <resolverVersion>1.8.0</resolverVersion>
-        <slf4jVersion>1.7.32</slf4jVersion>
-        <xmlunitVersion>2.6.4</xmlunitVersion>
-        <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
+    <!-- default maven version, can be override by maven3 profile -->
+    <mavenVersion>4.0.0-alpha-2</mavenVersion>
+    <maven.dir>maven4</maven.dir>
+    <maven.basedir>${project.build.directory}/${maven.dir}</maven.basedir>
 
-        <maven.site.path>extensions-archives/${project.artifactId}-LATEST</maven.site.path><!-- TODO remove when switching parent to maven-extensions:35 -->
-        <project.build.outputTimestamp>2022-10-27T09:45:25Z</project.build.outputTimestamp>
-    </properties>
+    <commonsCliVersion>1.4</commonsCliVersion>
+    <commonsLangVersion>3.12.0</commonsLangVersion>
+    <junitVersion>5.8.1</junitVersion>
+    <mockitoVersion>3.2.0</mockitoVersion>
+    <plexusUtilsVersion>3.4.1</plexusUtilsVersion>
+    <wagonVersion>3.4.3</wagonVersion>
+    <securityDispatcherVersion>2.0</securityDispatcherVersion>
+    <cipherVersion>2.0</cipherVersion>
+    <modelloVersion>1.11</modelloVersion>
+    <jxpathVersion>1.3</jxpathVersion>
+    <resolverVersion>1.8.0</resolverVersion>
+    <slf4jVersion>1.7.32</slf4jVersion>
+    <xmlunitVersion>2.6.4</xmlunitVersion>
+    <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
 
-    <scm>
-        <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git</connection>
-        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git</developerConnection>
-        <url>https://github.com/apache/maven-build-cache-extension/tree/${project.scm.tag}</url>
-        <tag>master</tag>
-    </scm>
-    <issueManagement>
-        <system>jira</system>
-        <url>https://issues.apache.org/jira/browse/MBUILDCACHE</url>
-    </issueManagement>
-    <ciManagement>
-        <system>Jenkins</system>
-        <url>https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-build-cache-extension/</url>
-    </ciManagement>
-    <distributionManagement>
-        <site>
-            <id>apache.website</id>
-            <url>scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path}</url>
-        </site>
-    </distributionManagement>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.testcontainers</groupId>
-                <artifactId>testcontainers-bom</artifactId>
-                <version>1.17.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
+    <maven.site.path>extensions-archives/${project.artifactId}-LATEST</maven.site.path>
+    <!-- TODO remove when switching parent to maven-extensions:35 -->
+    <project.build.outputTimestamp>2022-10-27T09:45:25Z</project.build.outputTimestamp>
+  </properties>
 
+  <dependencyManagement>
     <dependencies>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-core</artifactId>
-            <version>${mavenVersion}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven.resolver</groupId>
-            <artifactId>maven-resolver-transport-http</artifactId>
-            <version>${resolverVersion}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>net.openhft</groupId>
-            <artifactId>zero-allocation-hashing</artifactId>
-            <version>0.9</version>
-        </dependency>
-        <dependency>
-            <groupId>com.github.albfernandez</groupId>
-            <artifactId>juniversalchardet</artifactId>
-            <version>2.4.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>${commonsLangVersion}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>2.7</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.annotation</groupId>
-            <artifactId>javax.annotation-api</artifactId>
-            <version>1.3.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-utils</artifactId>
-            <version>${plexusUtilsVersion}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-            <version>3.0.2</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven.wagon</groupId>
-            <artifactId>wagon-webdav-jackrabbit</artifactId>
-            <version>3.5.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <version>5.8.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven.shared</groupId>
-            <artifactId>maven-verifier</artifactId>
-            <version>1.7.2</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-embedder</artifactId>
-            <version>${mavenVersion}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>testcontainers</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.2.10</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>log4j-over-slf4j</artifactId>
-            <version>1.7.35</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <version>1.7.35 </version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jul-to-slf4j</artifactId>
-            <version>1.7.35</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.assertj</groupId>
-            <artifactId>assertj-core</artifactId>
-            <version>3.22.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <version>${mockitoVersion}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-params</artifactId>
-            <version>${junitVersion}</version>
-            <scope>test</scope>
-        </dependency>
+      <dependency>
+        <groupId>org.testcontainers</groupId>
+        <artifactId>testcontainers-bom</artifactId>
+        <version>1.17.2</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
     </dependencies>
+  </dependencyManagement>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>.mvn/maven.config</exclude>
-                        <exclude>.asf.yaml</exclude>
-                        <exclude>src/test/resources*/**</exclude>
-                        <exclude>src/test/projects/**</exclude>
-                        <exclude>src/test/remote-repo/**</exclude>
-                        <exclude>src/build/maven-header.txt</exclude>
-                        <exclude>.gitmodules</exclude>
-                        <exclude>.gitattributes</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>net.revelc.code.formatter</groupId>
-                <artifactId>formatter-maven-plugin</artifactId>
-                <version>${formatter-maven-plugin.version}</version>
-                <configuration>
-                    <configFile>${maven.multiModuleProjectDirectory}/src/build/eclipse-formatter-config.xml</configFile>
-                    <skip>${format.skip}</skip>
-                    <lineEnding>KEEP</lineEnding>
-                    <cachedir>${project.build.directory}/cache</cachedir>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>format</id>
-                        <goals>
-                            <goal>format</goal>
-                        </goals>
-                        <phase>process-sources</phase>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>net.revelc.code</groupId>
-                <artifactId>impsort-maven-plugin</artifactId>
-                <version>${impsort-maven-plugin.version}</version>
-                <configuration>
-                    <removeUnused>true</removeUnused>
-                    <staticAfter>true</staticAfter>
-                    <lineEnding>KEEP</lineEnding>
-                    <skip>${format.skip}</skip>
-                    <cachedir>${project.build.directory}/cache</cachedir>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.codehaus.plexus</groupId>
-                        <artifactId>plexus-utils</artifactId>
-                        <version>3.4.1</version>
-                    </dependency>
-                </dependencies>
-                <executions>
-                    <execution>
-                        <id>sort-imports</id>
-                        <goals>
-                            <goal>sort</goal>
-                        </goals>
-                        <phase>process-sources</phase>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>${mavenVersion}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.resolver</groupId>
+      <artifactId>maven-resolver-transport-http</artifactId>
+      <version>${resolverVersion}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>net.openhft</groupId>
+      <artifactId>zero-allocation-hashing</artifactId>
+      <version>0.9</version>
+    </dependency>
+    <dependency>
+      <groupId>com.github.albfernandez</groupId>
+      <artifactId>juniversalchardet</artifactId>
+      <version>2.4.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>${commonsLangVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.7</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.annotation</groupId>
+      <artifactId>javax.annotation-api</artifactId>
+      <version>1.3.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>${plexusUtilsVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <version>3.0.2</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-webdav-jackrabbit</artifactId>
+      <version>3.5.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-verifier</artifactId>
+      <version>1.7.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-embedder</artifactId>
+      <version>${mavenVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.testcontainers</groupId>
+      <artifactId>testcontainers</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.testcontainers</groupId>
+      <artifactId>junit-jupiter</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>1.2.10</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+      <version>1.7.35</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>1.7.35</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jul-to-slf4j</artifactId>
+      <version>1.7.35</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>3.22.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>${mockitoVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-params</artifactId>
+      <version>${junitVersion}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>.mvn/maven.config</exclude>
+            <exclude>.asf.yaml</exclude>
+            <exclude>src/test/resources*/**</exclude>
+            <exclude>src/test/projects/**</exclude>
+            <exclude>src/test/remote-repo/**</exclude>
+            <exclude>src/build/maven-header.txt</exclude>
+            <exclude>.gitmodules</exclude>
+            <exclude>.gitattributes</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <!--
                 <version>3.1.2</version>
                 <configuration>
                     <violationSeverity>info</violationSeverity>
@@ -318,179 +267,180 @@ under the License.
                         <version>3</version>
                     </dependency>
                 </dependencies>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.modello</groupId>
-                <artifactId>modello-maven-plugin</artifactId>
-                <configuration>
-                    <models>
-                        <model>src/main/mdo/build-cache-config.mdo</model>
-                        <model>src/main/mdo/build-cache-build.mdo</model>
-                        <model>src/main/mdo/build-cache-diff.mdo</model>
-                        <model>src/main/mdo/build-cache-report.mdo</model>
-                    </models>
-                    <version>1.0.0</version>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>modello-cache</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>java</goal>
-                            <goal>xpp3-reader</goal>
-                            <goal>xpp3-writer</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>modello-cache-xsd</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>xsd</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${basedir}/target/generated-resources/modello</outputDirectory>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>modello-site-docs</id>
-                        <phase>pre-site</phase>
-                        <goals>
-                            <goal>xdoc</goal>
-                            <goal>xsd</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <version>3.3.0</version>
-                <executions>
-                    <execution>
-                        <id>add-resources</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>add-resource</goal>
-                        </goals>
-                        <configuration>
-                            <resources>
-                                <resource>
-                                    <directory>${basedir}/target/generated-resources/modello</directory>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.10.1</version>
-                <configuration>
-                    <release>${javaVersion}</release>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <version>3.3.0</version>
-                <executions>
-                    <execution>
-                        <id>copy-maven-distribution</id>
-                        <phase>pre-integration-test</phase>
-                        <goals>
-                            <goal>unpack</goal>
-                        </goals>
-                        <configuration>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.apache.maven</groupId>
-                                    <artifactId>apache-maven</artifactId>
-                                    <version>${mavenVersion}</version>
-                                    <classifier>bin</classifier>
-                                    <type>tar.gz</type>
-                                    <overWrite>false</overWrite>
-                                    <outputDirectory>${maven.basedir}</outputDirectory>
-                                </artifactItem>
-                            </artifactItems>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>3.0.0-M7</version>
+                -->
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.modello</groupId>
+        <artifactId>modello-maven-plugin</artifactId>
+        <configuration>
+          <models>
+            <model>src/main/mdo/build-cache-config.mdo</model>
+            <model>src/main/mdo/build-cache-build.mdo</model>
+            <model>src/main/mdo/build-cache-diff.mdo</model>
+            <model>src/main/mdo/build-cache-report.mdo</model>
+          </models>
+          <version>1.0.0</version>
+        </configuration>
+        <executions>
+          <execution>
+            <id>modello-cache</id>
+            <goals>
+              <goal>java</goal>
+              <goal>xpp3-reader</goal>
+              <goal>xpp3-writer</goal>
+            </goals>
+            <phase>generate-sources</phase>
+          </execution>
+          <execution>
+            <id>modello-cache-xsd</id>
+            <goals>
+              <goal>xsd</goal>
+            </goals>
+            <phase>generate-resources</phase>
+            <configuration>
+              <outputDirectory>${basedir}/target/generated-resources/modello</outputDirectory>
+            </configuration>
+          </execution>
+          <execution>
+            <id>modello-site-docs</id>
+            <goals>
+              <goal>xdoc</goal>
+              <goal>xsd</goal>
+            </goals>
+            <phase>pre-site</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>3.3.0</version>
+        <executions>
+          <execution>
+            <id>add-resources</id>
+            <goals>
+              <goal>add-resource</goal>
+            </goals>
+            <phase>generate-resources</phase>
+            <configuration>
+              <resources>
+                <resource>
+                  <directory>${basedir}/target/generated-resources/modello</directory>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.10.1</version>
+        <configuration>
+          <release>${javaVersion}</release>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>3.3.0</version>
+        <executions>
+          <execution>
+            <id>copy-maven-distribution</id>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <phase>pre-integration-test</phase>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.maven</groupId>
+                  <artifactId>apache-maven</artifactId>
+                  <version>${mavenVersion}</version>
+                  <classifier>bin</classifier>
+                  <type>tar.gz</type>
+                  <overWrite>false</overWrite>
+                  <outputDirectory>${maven.basedir}</outputDirectory>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>3.0.0-M7</version>
+        <configuration>
+          <argLine>-Xmx256m --add-exports java.base/sun.nio.ch=ALL-UNNAMED</argLine>
+          <environmentVariables>
+            <JENKINS_MAVEN_AGENT_DISABLED>true</JENKINS_MAVEN_AGENT_DISABLED>
+            <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
+          </environmentVariables>
+        </configuration>
+        <executions>
+          <execution>
+            <id>default-test</id>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <phase>test</phase>
+            <configuration>
+              <excludes>**/its/**</excludes>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>3.4.0</version>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>run-its</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <version>3.0.0-M7</version>
+            <configuration>
+              <systemPropertyVariables>
+                <!-- local repo provided by m-invoker-p:install -->
+                <localRepo>${project.build.directory}/local-repo</localRepo>
+                <projectVersion>${project.version}</projectVersion>
+                <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory>
+                <maven.basedir>${maven.basedir}</maven.basedir>
+              </systemPropertyVariables>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <goals>
+                  <goal>test</goal>
+                </goals>
+                <phase>integration-test</phase>
                 <configuration>
-                    <argLine>-Xmx256m --add-exports java.base/sun.nio.ch=ALL-UNNAMED</argLine>
-                    <environmentVariables>
-                        <JENKINS_MAVEN_AGENT_DISABLED>true</JENKINS_MAVEN_AGENT_DISABLED>
-                        <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
-                    </environmentVariables>
+                  <includes>**/its/**</includes>
                 </configuration>
-                <executions>
-                    <execution>
-                        <id>default-test</id>
-                        <phase>test</phase>
-                        <goals>
-                            <goal>test</goal>
-                        </goals>
-                        <configuration>
-                            <excludes>**/its/**</excludes>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>3.4.0</version>
-            </plugin>
+              </execution>
+            </executions>
+          </plugin>
         </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>run-its</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <version>3.0.0-M7</version>
-                        <configuration>
-                            <systemPropertyVariables>
-                                <!-- local repo provided by m-invoker-p:install -->
-                                <localRepo>${project.build.directory}/local-repo</localRepo>
-                                <projectVersion>${project.version}</projectVersion>
-                                <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory>
-                                <maven.basedir>${maven.basedir}</maven.basedir>
-                            </systemPropertyVariables>
-                        </configuration>
-                        <executions>
-                            <execution>
-                                <id>integration-test</id>
-                                <phase>integration-test</phase>
-                                <goals>
-                                    <goal>test</goal>
-                                </goals>
-                                <configuration>
-                                    <includes>**/its/**</includes>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-        <profile>
-            <id>maven3</id>
-            <properties>
-                <mavenVersion>3.9.0</mavenVersion>
-                <maven.dir>maven3</maven.dir>
-                <maven.basedir>${project.build.directory}/${maven.dir}</maven.basedir>
-            </properties>
-        </profile>
-    </profiles>
+      </build>
+    </profile>
+    <profile>
+      <id>maven3</id>
+      <properties>
+        <mavenVersion>3.9.0</mavenVersion>
+        <maven.dir>maven3</maven.dir>
+        <maven.basedir>${project.build.directory}/${maven.dir}</maven.basedir>
+      </properties>
+    </profile>
+  </profiles>
 
 </project>
diff --git a/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java b/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java
index a27b025..72306d6 100644
--- a/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java
+++ b/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,13 +18,15 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Priority;
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.io.File;
 import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
-import javax.annotation.Priority;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.SessionScoped;
@@ -61,12 +63,11 @@ import static org.apache.maven.buildcache.xml.CacheState.INITIALIZED;
  */
 @SessionScoped
 @Named
-@Priority( 10 )
-@SuppressWarnings( "unused" )
-public class BuildCacheMojosExecutionStrategy implements MojosExecutionStrategy
-{
+@Priority(10)
+@SuppressWarnings("unused")
+public class BuildCacheMojosExecutionStrategy implements MojosExecutionStrategy {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( BuildCacheMojosExecutionStrategy.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(BuildCacheMojosExecutionStrategy.class);
 
     private final CacheController cacheController;
     private final CacheConfig cacheConfig;
@@ -80,8 +81,7 @@ public class BuildCacheMojosExecutionStrategy implements MojosExecutionStrategy
             CacheConfig cacheConfig,
             MojoParametersListener mojoListener,
             LifecyclePhasesHelper lifecyclePhasesHelper,
-            MavenPluginManager mavenPluginManager )
-    {
+            MavenPluginManager mavenPluginManager) {
         this.cacheController = cacheController;
         this.cacheConfig = cacheConfig;
         this.mojoListener = mojoListener;
@@ -89,261 +89,214 @@ public class BuildCacheMojosExecutionStrategy implements MojosExecutionStrategy
         this.mavenPluginManager = mavenPluginManager;
     }
 
-    public void execute( List<MojoExecution> mojoExecutions,
-            MavenSession session,
-            MojoExecutionRunner mojoExecutionRunner )
-            throws LifecycleExecutionException
-    {
+    public void execute(
+            List<MojoExecution> mojoExecutions, MavenSession session, MojoExecutionRunner mojoExecutionRunner)
+            throws LifecycleExecutionException {
         final MavenProject project = session.getCurrentProject();
-        final Source source = getSource( mojoExecutions );
+        final Source source = getSource(mojoExecutions);
 
         // execute clean bound goals before restoring to not interfere/slowdown clean
         CacheState cacheState = DISABLED;
         CacheResult result = CacheResult.empty();
-        boolean skipCache = cacheConfig.isSkipCache() || MavenProjectInput.isSkipCache( project );
-        if ( source == Source.LIFECYCLE )
-        {
-            List<MojoExecution> cleanPhase = lifecyclePhasesHelper.getCleanSegment( project, mojoExecutions );
-            for ( MojoExecution mojoExecution : cleanPhase )
-            {
-                mojoExecutionRunner.run( mojoExecution );
+        boolean skipCache = cacheConfig.isSkipCache() || MavenProjectInput.isSkipCache(project);
+        if (source == Source.LIFECYCLE) {
+            List<MojoExecution> cleanPhase = lifecyclePhasesHelper.getCleanSegment(project, mojoExecutions);
+            for (MojoExecution mojoExecution : cleanPhase) {
+                mojoExecutionRunner.run(mojoExecution);
             }
             cacheState = cacheConfig.initialize();
-            if ( cacheState == INITIALIZED || skipCache )
-            {
-                result = cacheController.findCachedBuild( session, project, mojoExecutions, skipCache );
+            if (cacheState == INITIALIZED || skipCache) {
+                result = cacheController.findCachedBuild(session, project, mojoExecutions, skipCache);
             }
         }
 
         boolean restorable = result.isSuccess() || result.isPartialSuccess();
         boolean restored = result.isSuccess(); // if partially restored need to save increment
-        if ( restorable )
-        {
-            restored &= restoreProject( result, mojoExecutions, mojoExecutionRunner, cacheConfig );
-        }
-        else
-        {
-            for ( MojoExecution mojoExecution : mojoExecutions )
-            {
-                if ( source == Source.CLI
+        if (restorable) {
+            restored &= restoreProject(result, mojoExecutions, mojoExecutionRunner, cacheConfig);
+        } else {
+            for (MojoExecution mojoExecution : mojoExecutions) {
+                if (source == Source.CLI
                         || mojoExecution.getLifecyclePhase() == null
-                        || lifecyclePhasesHelper.isLaterPhaseThanClean( mojoExecution.getLifecyclePhase() ) )
-                {
-                    mojoExecutionRunner.run( mojoExecution );
+                        || lifecyclePhasesHelper.isLaterPhaseThanClean(mojoExecution.getLifecyclePhase())) {
+                    mojoExecutionRunner.run(mojoExecution);
                 }
             }
         }
 
-        if ( cacheState == INITIALIZED && ( !restorable || !restored ) )
-        {
-            final Map<String, MojoExecutionEvent> executionEvents = mojoListener.getProjectExecutions( project );
-            cacheController.save( result, mojoExecutions, executionEvents );
+        if (cacheState == INITIALIZED && (!restorable || !restored)) {
+            final Map<String, MojoExecutionEvent> executionEvents = mojoListener.getProjectExecutions(project);
+            cacheController.save(result, mojoExecutions, executionEvents);
         }
 
-        if ( cacheConfig.isFailFast() && !result.isSuccess() && !skipCache )
-        {
+        if (cacheConfig.isFailFast() && !result.isSuccess() && !skipCache) {
             throw new LifecycleExecutionException(
-                    "Failed to restore project[" + getVersionlessProjectKey( project ) + "] from cache, failing build.",
-                    project );
+                    "Failed to restore project[" + getVersionlessProjectKey(project) + "] from cache, failing build.",
+                    project);
         }
     }
 
-    private Source getSource( List<MojoExecution> mojoExecutions )
-    {
-        if ( mojoExecutions == null || mojoExecutions.isEmpty() )
-        {
+    private Source getSource(List<MojoExecution> mojoExecutions) {
+        if (mojoExecutions == null || mojoExecutions.isEmpty()) {
             return null;
         }
-        for ( MojoExecution mojoExecution : mojoExecutions )
-        {
-            if ( mojoExecution.getSource() == Source.CLI )
-            {
+        for (MojoExecution mojoExecution : mojoExecutions) {
+            if (mojoExecution.getSource() == Source.CLI) {
                 return Source.CLI;
             }
         }
         return Source.LIFECYCLE;
     }
 
-    private boolean restoreProject( CacheResult cacheResult,
+    private boolean restoreProject(
+            CacheResult cacheResult,
             List<MojoExecution> mojoExecutions,
             MojoExecutionRunner mojoExecutionRunner,
-            CacheConfig cacheConfig ) throws LifecycleExecutionException
-    {
+            CacheConfig cacheConfig)
+            throws LifecycleExecutionException {
         final Build build = cacheResult.getBuildInfo();
         final MavenProject project = cacheResult.getContext().getProject();
         final MavenSession session = cacheResult.getContext().getSession();
-        final List<MojoExecution> cachedSegment = lifecyclePhasesHelper.getCachedSegment( project, mojoExecutions,
-                build );
+        final List<MojoExecution> cachedSegment =
+                lifecyclePhasesHelper.getCachedSegment(project, mojoExecutions, build);
 
-        boolean restored = cacheController.restoreProjectArtifacts( cacheResult );
-        if ( !restored )
-        {
-            LOGGER.info( "Cannot restore project artifacts, continuing with non cached build" );
+        boolean restored = cacheController.restoreProjectArtifacts(cacheResult);
+        if (!restored) {
+            LOGGER.info("Cannot restore project artifacts, continuing with non cached build");
             return false;
         }
 
-        for ( MojoExecution cacheCandidate : cachedSegment )
-        {
-            if ( cacheController.isForcedExecution( project, cacheCandidate ) )
-            {
-                LOGGER.info( "Mojo execution is forced by project property: {}",
-                        cacheCandidate.getMojoDescriptor().getFullGoalName() );
-                mojoExecutionRunner.run( cacheCandidate );
-            }
-            else
-            {
-                restored = verifyCacheConsistency( cacheCandidate, build, project, session,
-                        mojoExecutionRunner, cacheConfig );
-                if ( !restored )
-                {
+        for (MojoExecution cacheCandidate : cachedSegment) {
+            if (cacheController.isForcedExecution(project, cacheCandidate)) {
+                LOGGER.info(
+                        "Mojo execution is forced by project property: {}",
+                        cacheCandidate.getMojoDescriptor().getFullGoalName());
+                mojoExecutionRunner.run(cacheCandidate);
+            } else {
+                restored = verifyCacheConsistency(
+                        cacheCandidate, build, project, session, mojoExecutionRunner, cacheConfig);
+                if (!restored) {
                     break;
                 }
             }
         }
 
-        if ( !restored )
-        {
+        if (!restored) {
             // cleanup partial state
-            project.getArtifact().setFile( null );
-            project.getArtifact().setResolved( false );
-            mojoListener.remove( project );
+            project.getArtifact().setFile(null);
+            project.getArtifact().setResolved(false);
+            mojoListener.remove(project);
             // build as usual
-            for ( MojoExecution mojoExecution : cachedSegment )
-            {
-                mojoExecutionRunner.run( mojoExecution );
+            for (MojoExecution mojoExecution : cachedSegment) {
+                mojoExecutionRunner.run(mojoExecution);
             }
         }
 
-        List<MojoExecution> postCachedSegment = lifecyclePhasesHelper.getPostCachedSegment( project, mojoExecutions,
-                build );
-        for ( MojoExecution mojoExecution : postCachedSegment )
-        {
-            mojoExecutionRunner.run( mojoExecution );
+        List<MojoExecution> postCachedSegment =
+                lifecyclePhasesHelper.getPostCachedSegment(project, mojoExecutions, build);
+        for (MojoExecution mojoExecution : postCachedSegment) {
+            mojoExecutionRunner.run(mojoExecution);
         }
         return restored;
     }
 
-    private boolean verifyCacheConsistency( MojoExecution cacheCandidate,
+    private boolean verifyCacheConsistency(
+            MojoExecution cacheCandidate,
             Build cachedBuild,
             MavenProject project,
             MavenSession session,
             MojoExecutionRunner mojoExecutionRunner,
-            CacheConfig cacheConfig ) throws LifecycleExecutionException
-    {
+            CacheConfig cacheConfig)
+            throws LifecycleExecutionException {
         long createdTimestamp = System.currentTimeMillis();
         boolean consistent = true;
 
-        if ( !cacheConfig.getTrackedProperties( cacheCandidate ).isEmpty() )
-        {
+        if (!cacheConfig.getTrackedProperties(cacheCandidate).isEmpty()) {
             Mojo mojo = null;
-            try
-            {
-                mojo = mavenPluginManager.getConfiguredMojo( Mojo.class, session, cacheCandidate );
-                final CompletedExecution completedExecution = cachedBuild.findMojoExecutionInfo( cacheCandidate );
+            try {
+                mojo = mavenPluginManager.getConfiguredMojo(Mojo.class, session, cacheCandidate);
+                final CompletedExecution completedExecution = cachedBuild.findMojoExecutionInfo(cacheCandidate);
                 final String fullGoalName = cacheCandidate.getMojoDescriptor().getFullGoalName();
 
-                if ( completedExecution != null
-                        && !isParamsMatched( project, cacheCandidate, mojo, completedExecution ) )
-                {
-                    LOGGER.info( "Mojo cached parameters mismatch with actual, forcing full project build. Mojo: {}",
-                            fullGoalName );
+                if (completedExecution != null && !isParamsMatched(project, cacheCandidate, mojo, completedExecution)) {
+                    LOGGER.info(
+                            "Mojo cached parameters mismatch with actual, forcing full project build. Mojo: {}",
+                            fullGoalName);
                     consistent = false;
                 }
 
-                if ( consistent )
-                {
+                if (consistent) {
                     long elapsed = System.currentTimeMillis() - createdTimestamp;
-                    LOGGER.info( "Skipping plugin execution (reconciled in {} millis): {}", elapsed, fullGoalName );
+                    LOGGER.info("Skipping plugin execution (reconciled in {} millis): {}", elapsed, fullGoalName);
                 }
 
-                if ( LOGGER.isDebugEnabled() )
-                {
-                    LOGGER.debug( "Checked {}, resolved mojo: {}, cached params: {}",
-                            fullGoalName, mojo, completedExecution );
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug(
+                            "Checked {}, resolved mojo: {}, cached params: {}", fullGoalName, mojo, completedExecution);
                 }
-            }
-            catch ( PluginContainerException | PluginConfigurationException e )
-            {
-                throw new LifecycleExecutionException( "Cannot get configured mojo", e );
-            }
-            finally
-            {
-                if ( mojo != null )
-                {
-                    mavenPluginManager.releaseMojo( mojo, cacheCandidate );
+            } catch (PluginContainerException | PluginConfigurationException e) {
+                throw new LifecycleExecutionException("Cannot get configured mojo", e);
+            } finally {
+                if (mojo != null) {
+                    mavenPluginManager.releaseMojo(mojo, cacheCandidate);
                 }
             }
-        }
-        else
-        {
-            LOGGER.info( "Skipping plugin execution (cached): {}",
-                    cacheCandidate.getMojoDescriptor().getFullGoalName() );
+        } else {
+            LOGGER.info(
+                    "Skipping plugin execution (cached): {}",
+                    cacheCandidate.getMojoDescriptor().getFullGoalName());
         }
 
         return consistent;
     }
 
-    boolean isParamsMatched( MavenProject project,
-            MojoExecution mojoExecution,
-            Mojo mojo,
-            CompletedExecution completedExecution )
-    {
-        List<TrackedProperty> tracked = cacheConfig.getTrackedProperties( mojoExecution );
+    boolean isParamsMatched(
+            MavenProject project, MojoExecution mojoExecution, Mojo mojo, CompletedExecution completedExecution) {
+        List<TrackedProperty> tracked = cacheConfig.getTrackedProperties(mojoExecution);
 
-        for ( TrackedProperty trackedProperty : tracked )
-        {
+        for (TrackedProperty trackedProperty : tracked) {
             final String propertyName = trackedProperty.getPropertyName();
 
-            String expectedValue = DtoUtils.findPropertyValue( propertyName, completedExecution );
-            if ( expectedValue == null )
-            {
+            String expectedValue = DtoUtils.findPropertyValue(propertyName, completedExecution);
+            if (expectedValue == null) {
                 expectedValue = trackedProperty.getDefaultValue() != null ? trackedProperty.getDefaultValue() : "null";
             }
 
             final String currentValue;
-            try
-            {
-                Object value = ReflectionUtils.getValueIncludingSuperclasses( propertyName, mojo );
+            try {
+                Object value = ReflectionUtils.getValueIncludingSuperclasses(propertyName, mojo);
 
-                if ( value instanceof File )
-                {
+                if (value instanceof File) {
                     Path baseDirPath = project.getBasedir().toPath();
-                    Path path = ( ( File ) value ).toPath();
-                    currentValue = normalizedPath( path, baseDirPath );
-                }
-                else if ( value instanceof Path )
-                {
+                    Path path = ((File) value).toPath();
+                    currentValue = normalizedPath(path, baseDirPath);
+                } else if (value instanceof Path) {
                     Path baseDirPath = project.getBasedir().toPath();
-                    currentValue = normalizedPath( ( ( Path ) value ), baseDirPath );
+                    currentValue = normalizedPath(((Path) value), baseDirPath);
+                } else if (value != null && value.getClass().isArray()) {
+                    currentValue = ArrayUtils.toString(value);
+                } else {
+                    currentValue = String.valueOf(value);
                 }
-                else if ( value != null && value.getClass().isArray() )
-                {
-                    currentValue = ArrayUtils.toString( value );
-                }
-                else
-                {
-                    currentValue = String.valueOf( value );
-                }
-            }
-            catch ( IllegalAccessException e )
-            {
-                LOGGER.error( "Cannot extract plugin property {} from mojo {}", propertyName, mojo, e );
+            } catch (IllegalAccessException e) {
+                LOGGER.error("Cannot extract plugin property {} from mojo {}", propertyName, mojo, e);
                 return false;
             }
 
-            if ( !StringUtils.equals( currentValue, expectedValue ) )
-            {
-                if ( !StringUtils.equals( currentValue, trackedProperty.getSkipValue() ) )
-                {
-                    LOGGER.info( "Plugin parameter mismatch found. Parameter: {}, expected: {}, actual: {}",
-                            propertyName, expectedValue, currentValue );
+            if (!StringUtils.equals(currentValue, expectedValue)) {
+                if (!StringUtils.equals(currentValue, trackedProperty.getSkipValue())) {
+                    LOGGER.info(
+                            "Plugin parameter mismatch found. Parameter: {}, expected: {}, actual: {}",
+                            propertyName,
+                            expectedValue,
+                            currentValue);
                     return false;
-                }
-                else
-                {
-                    LOGGER.warn( "Cache contains plugin execution with skip flag and might be incomplete. "
-                            + "Property: {}, execution {}",
-                            propertyName, mojoExecutionKey( mojoExecution ) );
+                } else {
+                    LOGGER.warn(
+                            "Cache contains plugin execution with skip flag and might be incomplete. "
+                                    + "Property: {}, execution {}",
+                            propertyName,
+                            mojoExecutionKey(mojoExecution));
                 }
             }
         }
@@ -357,11 +310,9 @@ public class BuildCacheMojosExecutionStrategy implements MojosExecutionStrategy
      * - all relative paths are considered portable and should not be touched
      * - absolute paths outside of project directory could not be deterministically relativized and not touched
      */
-    private static String normalizedPath( Path path, Path baseDirPath )
-    {
-        boolean isProjectSubdir = path.isAbsolute() && path.startsWith( baseDirPath );
-        Path preparedPath = isProjectSubdir ? baseDirPath.relativize( path ) : path;
+    private static String normalizedPath(Path path, Path baseDirPath) {
+        boolean isProjectSubdir = path.isAbsolute() && path.startsWith(baseDirPath);
+        Path preparedPath = isProjectSubdir ? baseDirPath.relativize(path) : path;
         return preparedPath.normalize().toString();
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheContext.java b/src/main/java/org/apache/maven/buildcache/CacheContext.java
index 0841aeb..613f75a 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheContext.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheContext.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -27,32 +27,27 @@ import static java.util.Objects.requireNonNull;
 /**
  * CacheContext
  */
-public class CacheContext
-{
+public class CacheContext {
 
     private final MavenProject project;
     private final ProjectsInputInfo inputInfo;
     private final MavenSession session;
 
-    public CacheContext( MavenProject project, ProjectsInputInfo inputInfo, MavenSession session )
-    {
-        this.project = requireNonNull( project );
-        this.inputInfo = requireNonNull( inputInfo );
-        this.session = requireNonNull( session );
+    public CacheContext(MavenProject project, ProjectsInputInfo inputInfo, MavenSession session) {
+        this.project = requireNonNull(project);
+        this.inputInfo = requireNonNull(inputInfo);
+        this.session = requireNonNull(session);
     }
 
-    public MavenProject getProject()
-    {
+    public MavenProject getProject() {
         return project;
     }
 
-    public ProjectsInputInfo getInputInfo()
-    {
+    public ProjectsInputInfo getInputInfo() {
         return inputInfo;
     }
 
-    public MavenSession getSession()
-    {
+    public MavenSession getSession() {
         return session;
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheController.java b/src/main/java/org/apache/maven/buildcache/CacheController.java
index 7622cba..1cac935 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheController.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheController.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -20,6 +20,7 @@ package org.apache.maven.buildcache;
 
 import java.util.List;
 import java.util.Map;
+
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.MojoExecutionEvent;
 import org.apache.maven.plugin.MojoExecution;
@@ -28,22 +29,19 @@ import org.apache.maven.project.MavenProject;
 /**
  * CacheController
  */
-public interface CacheController
-{
+public interface CacheController {
 
-    CacheResult findCachedBuild( MavenSession session,
-            MavenProject project,
-            List<MojoExecution> mojoExecutions,
-            boolean skipCache );
+    CacheResult findCachedBuild(
+            MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions, boolean skipCache);
 
-    boolean restoreProjectArtifacts( CacheResult cacheResult );
+    boolean restoreProjectArtifacts(CacheResult cacheResult);
 
-    void save( CacheResult cacheResult,
+    void save(
+            CacheResult cacheResult,
             List<MojoExecution> mojoExecutions,
-            Map<String, MojoExecutionEvent> executionEvents );
-
-    boolean isForcedExecution( MavenProject project, MojoExecution execution );
+            Map<String, MojoExecutionEvent> executionEvents);
 
-    void saveCacheReport( MavenSession session );
+    boolean isForcedExecution(MavenProject project, MojoExecution execution);
 
+    void saveCacheReport(MavenSession session);
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java b/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
index 293d94a..06ba2d8 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,6 +18,10 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -42,9 +46,7 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
 import java.util.regex.Pattern;
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -101,9 +103,8 @@ import static org.apache.maven.buildcache.checksum.MavenProjectInput.CACHE_IMPLE
  */
 @SessionScoped
 @Named
-@SuppressWarnings( "unused" )
-public class CacheControllerImpl implements CacheController
-{
+@SuppressWarnings("unused")
+public class CacheControllerImpl implements CacheController {
 
     public static final String FILE_SEPARATOR_SUBST = "_";
     /**
@@ -111,7 +112,7 @@ public class CacheControllerImpl implements CacheController
      */
     private static final String BUILD_PREFIX = "build" + FILE_SEPARATOR_SUBST;
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( CacheControllerImpl.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(CacheControllerImpl.class);
 
     private final MavenProjectHelper projectHelper;
     private final ArtifactHandlerManager artifactHandlerManager;
@@ -138,8 +139,7 @@ public class CacheControllerImpl implements CacheController
             ProjectInputCalculator projectInputCalculator,
             RestoredArtifactHandler restoreArtifactHandler,
             LifecyclePhasesHelper lifecyclePhasesHelper,
-            MavenSession session )
-    {
+            MavenSession session) {
         this.projectHelper = projectHelper;
         this.localCache = localCache;
         this.remoteCache = remoteCache;
@@ -153,162 +153,135 @@ public class CacheControllerImpl implements CacheController
 
     @Override
     @Nonnull
-    public CacheResult findCachedBuild( MavenSession session, MavenProject project,
-            List<MojoExecution> mojoExecutions, boolean skipCache )
-    {
-        final String highestPhase = lifecyclePhasesHelper.resolveHighestLifecyclePhase( project, mojoExecutions );
+    public CacheResult findCachedBuild(
+            MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions, boolean skipCache) {
+        final String highestPhase = lifecyclePhasesHelper.resolveHighestLifecyclePhase(project, mojoExecutions);
 
-        if ( !lifecyclePhasesHelper.isLaterPhaseThanClean( highestPhase ) )
-        {
+        if (!lifecyclePhasesHelper.isLaterPhaseThanClean(highestPhase)) {
             return empty();
         }
 
-        String projectName = getVersionlessProjectKey( project );
+        String projectName = getVersionlessProjectKey(project);
 
-        ProjectsInputInfo inputInfo = projectInputCalculator.calculateInput( project );
+        ProjectsInputInfo inputInfo = projectInputCalculator.calculateInput(project);
 
-        final CacheContext context = new CacheContext( project, inputInfo, session );
+        final CacheContext context = new CacheContext(project, inputInfo, session);
 
-        CacheResult result = empty( context );
-        if ( !skipCache )
-        {
+        CacheResult result = empty(context);
+        if (!skipCache) {
 
-            LOGGER.info( "Attempting to restore project {} from build cache", projectName );
+            LOGGER.info("Attempting to restore project {} from build cache", projectName);
 
             // remote build first
-            result = findCachedBuild( mojoExecutions, context );
+            result = findCachedBuild(mojoExecutions, context);
 
-            if ( !result.isSuccess() && result.getContext() != null )
-            {
-                LOGGER.info( "Remote cache is incomplete or missing, trying local build for {}", projectName );
+            if (!result.isSuccess() && result.getContext() != null) {
+                LOGGER.info("Remote cache is incomplete or missing, trying local build for {}", projectName);
 
-                CacheResult localBuild = findLocalBuild( mojoExecutions, context );
-                if ( localBuild.isSuccess() || ( localBuild.isPartialSuccess() && !result.isPartialSuccess() ) )
-                {
+                CacheResult localBuild = findLocalBuild(mojoExecutions, context);
+                if (localBuild.isSuccess() || (localBuild.isPartialSuccess() && !result.isPartialSuccess())) {
                     result = localBuild;
-                }
-                else
-                {
-                    LOGGER.info( "Local build was not found by checksum {} for {}", inputInfo.getChecksum(),
-                            projectName );
+                } else {
+                    LOGGER.info(
+                            "Local build was not found by checksum {} for {}", inputInfo.getChecksum(), projectName);
                 }
             }
+        } else {
+            LOGGER.info(
+                    "Project {} is marked as requiring force rebuild, will skip lookup in build cache", projectName);
         }
-        else
-        {
-            LOGGER.info( "Project {} is marked as requiring force rebuild, will skip lookup in build cache",
-                    projectName );
-        }
-        cacheResults.put( getVersionlessProjectKey( project ), result );
+        cacheResults.put(getVersionlessProjectKey(project), result);
 
         return result;
     }
 
-    private CacheResult findCachedBuild( List<MojoExecution> mojoExecutions, CacheContext context )
-    {
+    private CacheResult findCachedBuild(List<MojoExecution> mojoExecutions, CacheContext context) {
         Optional<Build> cachedBuild = Optional.empty();
-        try
-        {
-            cachedBuild = localCache.findBuild( context );
-            if ( cachedBuild.isPresent() )
-            {
-                return analyzeResult( context, mojoExecutions, cachedBuild.get() );
+        try {
+            cachedBuild = localCache.findBuild(context);
+            if (cachedBuild.isPresent()) {
+                return analyzeResult(context, mojoExecutions, cachedBuild.get());
             }
+        } catch (Exception e) {
+            LOGGER.error("Cannot read cached remote build", e);
         }
-        catch ( Exception e )
-        {
-            LOGGER.error( "Cannot read cached remote build", e );
-        }
-        return cachedBuild.map( build -> failure( build, context ) )
-                .orElseGet( () -> empty( context ) );
+        return cachedBuild.map(build -> failure(build, context)).orElseGet(() -> empty(context));
     }
 
-    private CacheResult findLocalBuild( List<MojoExecution> mojoExecutions, CacheContext context )
-    {
+    private CacheResult findLocalBuild(List<MojoExecution> mojoExecutions, CacheContext context) {
         Optional<Build> localBuild = Optional.empty();
-        try
-        {
-            localBuild = localCache.findLocalBuild( context );
-            if ( localBuild.isPresent() )
-            {
-                return analyzeResult( context, mojoExecutions, localBuild.get() );
+        try {
+            localBuild = localCache.findLocalBuild(context);
+            if (localBuild.isPresent()) {
+                return analyzeResult(context, mojoExecutions, localBuild.get());
             }
+        } catch (Exception e) {
+            LOGGER.error("Cannot read local build", e);
         }
-        catch ( Exception e )
-        {
-            LOGGER.error( "Cannot read local build", e );
-        }
-        return localBuild.map( build -> failure( build, context ) )
-                .orElseGet( () -> empty( context ) );
+        return localBuild.map(build -> failure(build, context)).orElseGet(() -> empty(context));
     }
 
-    private CacheResult analyzeResult( CacheContext context, List<MojoExecution> mojoExecutions, Build build )
-    {
-        try
-        {
+    private CacheResult analyzeResult(CacheContext context, List<MojoExecution> mojoExecutions, Build build) {
+        try {
             final ProjectsInputInfo inputInfo = context.getInputInfo();
-            String projectName = getVersionlessProjectKey( context.getProject() );
+            String projectName = getVersionlessProjectKey(context.getProject());
 
-            LOGGER.info( "Found cached build, restoring {} from cache by checksum {}", projectName,
-                    inputInfo.getChecksum() );
-            LOGGER.debug( "Cached build details: {}", build );
+            LOGGER.info(
+                    "Found cached build, restoring {} from cache by checksum {}", projectName, inputInfo.getChecksum());
+            LOGGER.debug("Cached build details: {}", build);
 
             final String cacheImplementationVersion = build.getCacheImplementationVersion();
-            if ( !CACHE_IMPLEMENTATION_VERSION.equals( cacheImplementationVersion ) )
-            {
+            if (!CACHE_IMPLEMENTATION_VERSION.equals(cacheImplementationVersion)) {
                 LOGGER.warn(
                         "Maven and cached build implementations mismatch, caching might not work correctly. "
                                 + "Implementation version: " + CACHE_IMPLEMENTATION_VERSION + ", cached build: {}",
-                        build.getCacheImplementationVersion() );
+                        build.getCacheImplementationVersion());
             }
 
-            List<MojoExecution> cachedSegment = lifecyclePhasesHelper.getCachedSegment( context.getProject(),
-                    mojoExecutions, build );
-            List<MojoExecution> missingMojos = build.getMissingExecutions( cachedSegment );
-            if ( !missingMojos.isEmpty() )
-            {
-                LOGGER.warn( "Cached build doesn't contains all requested plugin executions "
-                        + "(missing: {}), cannot restore", missingMojos );
-                return failure( build, context );
+            List<MojoExecution> cachedSegment =
+                    lifecyclePhasesHelper.getCachedSegment(context.getProject(), mojoExecutions, build);
+            List<MojoExecution> missingMojos = build.getMissingExecutions(cachedSegment);
+            if (!missingMojos.isEmpty()) {
+                LOGGER.warn(
+                        "Cached build doesn't contains all requested plugin executions "
+                                + "(missing: {}), cannot restore",
+                        missingMojos);
+                return failure(build, context);
             }
 
-            if ( !isCachedSegmentPropertiesPresent( context.getProject(), build, cachedSegment ) )
-            {
-                LOGGER.info( "Cached build violates cache rules, cannot restore" );
-                return failure( build, context );
+            if (!isCachedSegmentPropertiesPresent(context.getProject(), build, cachedSegment)) {
+                LOGGER.info("Cached build violates cache rules, cannot restore");
+                return failure(build, context);
             }
 
-            final String highestRequestPhase = lifecyclePhasesHelper.resolveHighestLifecyclePhase( context.getProject(),
-                    mojoExecutions );
+            final String highestRequestPhase =
+                    lifecyclePhasesHelper.resolveHighestLifecyclePhase(context.getProject(), mojoExecutions);
 
-            if ( lifecyclePhasesHelper.isLaterPhaseThanBuild( highestRequestPhase, build )
-                    && !canIgnoreMissingSegment( context.getProject(), build, mojoExecutions ) )
-            {
-                LOGGER.info( "Project {} restored partially. Highest cached goal: {}, requested: {}",
-                        projectName, build.getHighestCompletedGoal(), highestRequestPhase );
-                return partialSuccess( build, context );
+            if (lifecyclePhasesHelper.isLaterPhaseThanBuild(highestRequestPhase, build)
+                    && !canIgnoreMissingSegment(context.getProject(), build, mojoExecutions)) {
+                LOGGER.info(
+                        "Project {} restored partially. Highest cached goal: {}, requested: {}",
+                        projectName,
+                        build.getHighestCompletedGoal(),
+                        highestRequestPhase);
+                return partialSuccess(build, context);
             }
 
-            return success( build, context );
+            return success(build, context);
 
-        }
-        catch ( Exception e )
-        {
-            LOGGER.error( "Failed to restore project", e );
-            localCache.clearCache( context );
-            return failure( build, context );
+        } catch (Exception e) {
+            LOGGER.error("Failed to restore project", e);
+            localCache.clearCache(context);
+            return failure(build, context);
         }
     }
 
-    private boolean canIgnoreMissingSegment( MavenProject project, Build info, List<MojoExecution> mojoExecutions )
-    {
-        final List<MojoExecution> postCachedSegment = lifecyclePhasesHelper.getPostCachedSegment( project,
-                mojoExecutions, info );
+    private boolean canIgnoreMissingSegment(MavenProject project, Build info, List<MojoExecution> mojoExecutions) {
+        final List<MojoExecution> postCachedSegment =
+                lifecyclePhasesHelper.getPostCachedSegment(project, mojoExecutions, info);
 
-        for ( MojoExecution mojoExecution : postCachedSegment )
-        {
-            if ( !cacheConfig.canIgnore( mojoExecution ) )
-            {
+        for (MojoExecution mojoExecution : postCachedSegment) {
+            if (!cacheConfig.canIgnore(mojoExecution)) {
                 return false;
             }
         }
@@ -316,84 +289,62 @@ public class CacheControllerImpl implements CacheController
     }
 
     @Override
-    public boolean restoreProjectArtifacts( CacheResult cacheResult )
-    {
+    public boolean restoreProjectArtifacts(CacheResult cacheResult) {
         final Build build = cacheResult.getBuildInfo();
         final CacheContext context = cacheResult.getContext();
         final MavenProject project = context.getProject();
 
-        try
-        {
+        try {
             RestoredArtifact restoredProjectArtifact = null;
             List<RestoredArtifact> restoredAttachedArtifacts = new ArrayList<>();
 
-            if ( build.getArtifact() != null && isNotBlank( build.getArtifact().getFileName() ) )
-            {
+            if (build.getArtifact() != null && isNotBlank(build.getArtifact().getFileName())) {
                 final Artifact artifactInfo = build.getArtifact();
                 String originalVersion = artifactInfo.getVersion();
-                artifactInfo.setVersion( project.getVersion() );
+                artifactInfo.setVersion(project.getVersion());
                 // TODO if remote is forced, probably need to refresh or reconcile all files
-                final Future<File> downloadTask = createDownloadTask(
-                        cacheResult,
-                        context,
-                        project,
-                        artifactInfo,
-                        originalVersion );
-                restoredProjectArtifact = restoredArtifact( project.getArtifact(), artifactInfo.getType(),
-                        artifactInfo.getClassifier(),
-                        downloadTask );
-            }
-
-            for ( Artifact attachedArtifactInfo : build.getAttachedArtifacts() )
-            {
+                final Future<File> downloadTask =
+                        createDownloadTask(cacheResult, context, project, artifactInfo, originalVersion);
+                restoredProjectArtifact = restoredArtifact(
+                        project.getArtifact(), artifactInfo.getType(), artifactInfo.getClassifier(), downloadTask);
+            }
+
+            for (Artifact attachedArtifactInfo : build.getAttachedArtifacts()) {
                 String originalVersion = attachedArtifactInfo.getVersion();
-                attachedArtifactInfo.setVersion( project.getVersion() );
-                if ( isNotBlank( attachedArtifactInfo.getFileName() ) )
-                {
-                    if ( StringUtils.startsWith( attachedArtifactInfo.getClassifier(), BUILD_PREFIX ) )
-                    {
+                attachedArtifactInfo.setVersion(project.getVersion());
+                if (isNotBlank(attachedArtifactInfo.getFileName())) {
+                    if (StringUtils.startsWith(attachedArtifactInfo.getClassifier(), BUILD_PREFIX)) {
                         // restoring generated sources might be unnecessary in CI, could be disabled for
                         // performance reasons
                         // it may also be disabled on a per-project level (defaults to true - enable)
-                        if ( cacheConfig.isRestoreGeneratedSources()
-                                && MavenProjectInput.isRestoreGeneratedSources( project ) )
-                        {
+                        if (cacheConfig.isRestoreGeneratedSources()
+                                && MavenProjectInput.isRestoreGeneratedSources(project)) {
                             // generated sources artifact
-                            final Path attachedArtifactFile = localCache.getArtifactFile( context,
-                                    cacheResult.getSource(), attachedArtifactInfo );
-                            restoreGeneratedSources( attachedArtifactInfo, attachedArtifactFile, project );
+                            final Path attachedArtifactFile =
+                                    localCache.getArtifactFile(context, cacheResult.getSource(), attachedArtifactInfo);
+                            restoreGeneratedSources(attachedArtifactInfo, attachedArtifactFile, project);
                         }
-                    }
-                    else
-                    {
+                    } else {
                         Future<File> downloadTask = createDownloadTask(
-                                cacheResult,
-                                context,
-                                project,
-                                attachedArtifactInfo,
-                                originalVersion );
+                                cacheResult, context, project, attachedArtifactInfo, originalVersion);
                         final RestoredArtifact restoredAttachedArtifact = restoredArtifact(
-                                restoredProjectArtifact == null ? project.getArtifact()
-                                        : restoredProjectArtifact,
+                                restoredProjectArtifact == null ? project.getArtifact() : restoredProjectArtifact,
                                 attachedArtifactInfo.getType(),
                                 attachedArtifactInfo.getClassifier(),
-                                downloadTask );
-                        restoredAttachedArtifacts.add( restoredAttachedArtifact );
+                                downloadTask);
+                        restoredAttachedArtifacts.add(restoredAttachedArtifact);
                     }
                 }
             }
             // Actually modify project at the end in case something went wrong during restoration,
             // in which case, the project is unmodified and we continue with normal build.
-            if ( restoredProjectArtifact != null )
-            {
-                project.setArtifact( restoredProjectArtifact );
+            if (restoredProjectArtifact != null) {
+                project.setArtifact(restoredProjectArtifact);
             }
-            restoredAttachedArtifacts.forEach( project::addAttachedArtifact );
+            restoredAttachedArtifacts.forEach(project::addAttachedArtifact);
             return true;
-        }
-        catch ( Exception e )
-        {
-            LOGGER.debug( "Cannot restore cache, continuing with normal build.", e );
+        } catch (Exception e) {
+            LOGGER.debug("Cannot restore cache, continuing with normal build.", e);
             return false;
         }
     }
@@ -402,309 +353,280 @@ public class CacheControllerImpl implements CacheController
      * Helper method similar to {@link org.apache.maven.project.MavenProjectHelper#attachArtifact} to work specifically
      * with restored from cache artifacts
      */
-    private RestoredArtifact restoredArtifact( org.apache.maven.artifact.Artifact parent, String artifactType,
+    private RestoredArtifact restoredArtifact(
+            org.apache.maven.artifact.Artifact parent,
+            String artifactType,
             String artifactClassifier,
-            Future<File> artifactFile )
-    {
+            Future<File> artifactFile) {
         ArtifactHandler handler = null;
 
-        if ( artifactType != null )
-        {
-            handler = artifactHandlerManager.getArtifactHandler( artifactType );
+        if (artifactType != null) {
+            handler = artifactHandlerManager.getArtifactHandler(artifactType);
         }
 
-        if ( handler == null )
-        {
-            handler = artifactHandlerManager.getArtifactHandler( "jar" );
+        if (handler == null) {
+            handler = artifactHandlerManager.getArtifactHandler("jar");
         }
 
         // todo: probably need update download url to cache
-        RestoredArtifact artifact = new RestoredArtifact( parent, artifactFile, artifactType, artifactClassifier,
-                handler );
-        artifact.setResolved( true );
+        RestoredArtifact artifact =
+                new RestoredArtifact(parent, artifactFile, artifactType, artifactClassifier, handler);
+        artifact.setResolved(true);
 
         return artifact;
     }
 
-    private Future<File> createDownloadTask( CacheResult cacheResult, CacheContext context, MavenProject project,
-            Artifact artifact, String originalVersion )
-    {
-        final FutureTask<File> downloadTask = new FutureTask<>( () ->
-        {
-            LOGGER.debug( "Downloading artifact {}", artifact.getArtifactId() );
-            final Path artifactFile = localCache.getArtifactFile( context, cacheResult.getSource(),
-                    artifact );
-            if ( !Files.exists( artifactFile ) )
-            {
-                throw new FileNotFoundException(
-                        "Missing file for cached build, cannot restore. File: " + artifactFile );
-            }
-            LOGGER.debug( "Downloaded artifact " + artifact.getArtifactId() + " to: " + artifactFile );
-            return restoreArtifactHandler.adjustArchiveArtifactVersion(
-                    project,
-                    originalVersion,
-                    artifactFile ).toFile();
-        } );
-        if ( !cacheConfig.isLazyRestore() )
-        {
+    private Future<File> createDownloadTask(
+            CacheResult cacheResult,
+            CacheContext context,
+            MavenProject project,
+            Artifact artifact,
+            String originalVersion) {
+        final FutureTask<File> downloadTask = new FutureTask<>(() -> {
+            LOGGER.debug("Downloading artifact {}", artifact.getArtifactId());
+            final Path artifactFile = localCache.getArtifactFile(context, cacheResult.getSource(), artifact);
+            if (!Files.exists(artifactFile)) {
+                throw new FileNotFoundException("Missing file for cached build, cannot restore. File: " + artifactFile);
+            }
+            LOGGER.debug("Downloaded artifact " + artifact.getArtifactId() + " to: " + artifactFile);
+            return restoreArtifactHandler
+                    .adjustArchiveArtifactVersion(project, originalVersion, artifactFile)
+                    .toFile();
+        });
+        if (!cacheConfig.isLazyRestore()) {
             downloadTask.run();
         }
         return downloadTask;
     }
 
     @Override
-    public void save( CacheResult cacheResult, List<MojoExecution> mojoExecutions,
-            Map<String, MojoExecutionEvent> executionEvents )
-    {
+    public void save(
+            CacheResult cacheResult,
+            List<MojoExecution> mojoExecutions,
+            Map<String, MojoExecutionEvent> executionEvents) {
         CacheContext context = cacheResult.getContext();
 
-        if ( context == null || context.getInputInfo() == null )
-        {
-            LOGGER.info( "Cannot save project in cache, skipping" );
+        if (context == null || context.getInputInfo() == null) {
+            LOGGER.info("Cannot save project in cache, skipping");
             return;
         }
 
         final MavenProject project = context.getProject();
         final MavenSession session = context.getSession();
-        try
-        {
+        try {
             final HashFactory hashFactory = cacheConfig.getHashFactory();
             final org.apache.maven.artifact.Artifact projectArtifact = project.getArtifact();
             final List<org.apache.maven.artifact.Artifact> attachedArtifacts;
             final List<Artifact> attachedArtifactDtos;
             final Artifact projectArtifactDto;
-            if ( project.hasLifecyclePhase( "package" ) )
-            {
+            if (project.hasLifecyclePhase("package")) {
                 final HashAlgorithm algorithm = hashFactory.createAlgorithm();
-                attachGeneratedSources( project );
-                attachOutputs( project );
+                attachGeneratedSources(project);
+                attachOutputs(project);
                 attachedArtifacts = project.getAttachedArtifacts() != null
-                        ? project.getAttachedArtifacts() : Collections.emptyList();
-                attachedArtifactDtos = artifactDtos( attachedArtifacts, algorithm );
-                projectArtifactDto = artifactDto( project.getArtifact(), algorithm );
-            }
-            else
-            {
+                        ? project.getAttachedArtifacts()
+                        : Collections.emptyList();
+                attachedArtifactDtos = artifactDtos(attachedArtifacts, algorithm);
+                projectArtifactDto = artifactDto(project.getArtifact(), algorithm);
+            } else {
                 attachedArtifacts = Collections.emptyList();
                 attachedArtifactDtos = new ArrayList<>();
                 projectArtifactDto = null;
             }
 
-            List<CompletedExecution> completedExecution = buildExecutionInfo( mojoExecutions, executionEvents );
+            List<CompletedExecution> completedExecution = buildExecutionInfo(mojoExecutions, executionEvents);
 
-            final Build build = new Build( session.getGoals(), projectArtifactDto, attachedArtifactDtos,
-                    context.getInputInfo(), completedExecution, hashFactory.getAlgorithm() );
-            populateGitInfo( build, session );
-            build.getDto().set_final( cacheConfig.isSaveFinal() );
-            cacheResults.put( getVersionlessProjectKey( project ), rebuilded( cacheResult, build ) );
+            final Build build = new Build(
+                    session.getGoals(),
+                    projectArtifactDto,
+                    attachedArtifactDtos,
+                    context.getInputInfo(),
+                    completedExecution,
+                    hashFactory.getAlgorithm());
+            populateGitInfo(build, session);
+            build.getDto().set_final(cacheConfig.isSaveFinal());
+            cacheResults.put(getVersionlessProjectKey(project), rebuilded(cacheResult, build));
 
             // if package phase presence means new artifacts were packaged
-            if ( project.hasLifecyclePhase( "package" ) )
-            {
-                localCache.beforeSave( context );
-                localCache.saveBuildInfo( cacheResult, build );
-                if ( projectArtifact.getFile() != null )
-                {
-                    localCache.saveArtifactFile( cacheResult, projectArtifact );
+            if (project.hasLifecyclePhase("package")) {
+                localCache.beforeSave(context);
+                localCache.saveBuildInfo(cacheResult, build);
+                if (projectArtifact.getFile() != null) {
+                    localCache.saveArtifactFile(cacheResult, projectArtifact);
                 }
-                for ( org.apache.maven.artifact.Artifact attachedArtifact : attachedArtifacts )
-                {
-                    if ( attachedArtifact.getFile() != null && isOutputArtifact(
-                            attachedArtifact.getFile().getName() ) )
-                    {
-                        localCache.saveArtifactFile( cacheResult, attachedArtifact );
+                for (org.apache.maven.artifact.Artifact attachedArtifact : attachedArtifacts) {
+                    if (attachedArtifact.getFile() != null
+                            && isOutputArtifact(attachedArtifact.getFile().getName())) {
+                        localCache.saveArtifactFile(cacheResult, attachedArtifact);
                     }
                 }
-            }
-            else
-            {
-                localCache.saveBuildInfo( cacheResult, build );
+            } else {
+                localCache.saveBuildInfo(cacheResult, build);
             }
 
-            if ( cacheConfig.isBaselineDiffEnabled() )
-            {
-                produceDiffReport( cacheResult, build );
+            if (cacheConfig.isBaselineDiffEnabled()) {
+                produceDiffReport(cacheResult, build);
             }
 
-        }
-        catch ( Exception e )
-        {
-            LOGGER.error( "Failed to save project, cleaning cache. Project: {}", project, e );
-            try
-            {
-                localCache.clearCache( context );
-            }
-            catch ( Exception ex )
-            {
-                LOGGER.error( "Failed to clean cache due to unexpected error:", ex );
+        } catch (Exception e) {
+            LOGGER.error("Failed to save project, cleaning cache. Project: {}", project, e);
+            try {
+                localCache.clearCache(context);
+            } catch (Exception ex) {
+                LOGGER.error("Failed to clean cache due to unexpected error:", ex);
             }
         }
     }
 
-    public void produceDiffReport( CacheResult cacheResult, Build build )
-    {
+    public void produceDiffReport(CacheResult cacheResult, Build build) {
         MavenProject project = cacheResult.getContext().getProject();
-        Optional<Build> baselineHolder = remoteCache.findBaselineBuild( project );
-        if ( baselineHolder.isPresent() )
-        {
+        Optional<Build> baselineHolder = remoteCache.findBaselineBuild(project);
+        if (baselineHolder.isPresent()) {
             Build baseline = baselineHolder.get();
             String outputDirectory = project.getBuild().getDirectory();
-            Path reportOutputDir = Paths.get( outputDirectory, "incremental-maven" );
-            LOGGER.info( "Saving cache builds diff to: {}", reportOutputDir );
-            Diff diff = new CacheDiff( build.getDto(), baseline.getDto(), cacheConfig ).compare();
-            try
-            {
-                Files.createDirectories( reportOutputDir );
+            Path reportOutputDir = Paths.get(outputDirectory, "incremental-maven");
+            LOGGER.info("Saving cache builds diff to: {}", reportOutputDir);
+            Diff diff = new CacheDiff(build.getDto(), baseline.getDto(), cacheConfig).compare();
+            try {
+                Files.createDirectories(reportOutputDir);
                 final ProjectsInputInfo baselineInputs = baseline.getDto().getProjectsInputInfo();
                 final String checksum = baselineInputs.getChecksum();
-                Files.write( reportOutputDir.resolve( "buildinfo-baseline-" + checksum + ".xml" ),
-                        xmlService.toBytes( baseline.getDto() ), TRUNCATE_EXISTING, CREATE );
-                Files.write( reportOutputDir.resolve( "buildinfo-" + checksum + ".xml" ),
-                        xmlService.toBytes( build.getDto() ), TRUNCATE_EXISTING, CREATE );
-                Files.write( reportOutputDir.resolve( "buildsdiff-" + checksum + ".xml" ),
-                        xmlService.toBytes( diff ), TRUNCATE_EXISTING, CREATE );
-                final Optional<DigestItem> pom = CacheDiff.findPom( build.getDto().getProjectsInputInfo() );
-                if ( pom.isPresent() )
-                {
-                    Files.write( reportOutputDir.resolve( "effective-pom-" + checksum + ".xml" ),
-                            pom.get().getValue().getBytes( StandardCharsets.UTF_8 ),
-                            TRUNCATE_EXISTING, CREATE );
+                Files.write(
+                        reportOutputDir.resolve("buildinfo-baseline-" + checksum + ".xml"),
+                        xmlService.toBytes(baseline.getDto()),
+                        TRUNCATE_EXISTING,
+                        CREATE);
+                Files.write(
+                        reportOutputDir.resolve("buildinfo-" + checksum + ".xml"),
+                        xmlService.toBytes(build.getDto()),
+                        TRUNCATE_EXISTING,
+                        CREATE);
+                Files.write(
+                        reportOutputDir.resolve("buildsdiff-" + checksum + ".xml"),
+                        xmlService.toBytes(diff),
+                        TRUNCATE_EXISTING,
+                        CREATE);
+                final Optional<DigestItem> pom =
+                        CacheDiff.findPom(build.getDto().getProjectsInputInfo());
+                if (pom.isPresent()) {
+                    Files.write(
+                            reportOutputDir.resolve("effective-pom-" + checksum + ".xml"),
+                            pom.get().getValue().getBytes(StandardCharsets.UTF_8),
+                            TRUNCATE_EXISTING,
+                            CREATE);
                 }
-                final Optional<DigestItem> baselinePom = CacheDiff.findPom( baselineInputs );
-                if ( baselinePom.isPresent() )
-                {
-                    Files.write( reportOutputDir.resolve(
-                            "effective-pom-baseline-" + baselineInputs.getChecksum() + ".xml" ),
-                            baselinePom.get().getValue().getBytes( StandardCharsets.UTF_8 ),
-                            TRUNCATE_EXISTING, CREATE );
+                final Optional<DigestItem> baselinePom = CacheDiff.findPom(baselineInputs);
+                if (baselinePom.isPresent()) {
+                    Files.write(
+                            reportOutputDir.resolve("effective-pom-baseline-" + baselineInputs.getChecksum() + ".xml"),
+                            baselinePom.get().getValue().getBytes(StandardCharsets.UTF_8),
+                            TRUNCATE_EXISTING,
+                            CREATE);
                 }
+            } catch (IOException e) {
+                LOGGER.error("Cannot produce build diff for project", e);
             }
-            catch ( IOException e )
-            {
-                LOGGER.error( "Cannot produce build diff for project", e );
-            }
-        }
-        else
-        {
-            LOGGER.info( "Cannot find project in baseline build, skipping diff" );
+        } else {
+            LOGGER.info("Cannot find project in baseline build, skipping diff");
         }
     }
 
-    private List<Artifact> artifactDtos( List<org.apache.maven.artifact.Artifact> attachedArtifacts,
-            HashAlgorithm digest ) throws IOException
-    {
+    private List<Artifact> artifactDtos(
+            List<org.apache.maven.artifact.Artifact> attachedArtifacts, HashAlgorithm digest) throws IOException {
         List<Artifact> result = new ArrayList<>();
-        for ( org.apache.maven.artifact.Artifact attachedArtifact : attachedArtifacts )
-        {
-            if ( attachedArtifact.getFile() != null && isOutputArtifact( attachedArtifact.getFile().getName() ) )
-            {
-                result.add( artifactDto( attachedArtifact, digest ) );
+        for (org.apache.maven.artifact.Artifact attachedArtifact : attachedArtifacts) {
+            if (attachedArtifact.getFile() != null
+                    && isOutputArtifact(attachedArtifact.getFile().getName())) {
+                result.add(artifactDto(attachedArtifact, digest));
             }
         }
         return result;
     }
 
-    private Artifact artifactDto( org.apache.maven.artifact.Artifact projectArtifact,
-            HashAlgorithm algorithm ) throws IOException
-    {
-        final Artifact dto = DtoUtils.createDto( projectArtifact );
-        if ( projectArtifact.getFile() != null && projectArtifact.getFile().isFile() )
-        {
+    private Artifact artifactDto(org.apache.maven.artifact.Artifact projectArtifact, HashAlgorithm algorithm)
+            throws IOException {
+        final Artifact dto = DtoUtils.createDto(projectArtifact);
+        if (projectArtifact.getFile() != null && projectArtifact.getFile().isFile()) {
             final Path file = projectArtifact.getFile().toPath();
-            dto.setFileHash( algorithm.hash( file ) );
-            dto.setFileSize( Files.size( file ) );
+            dto.setFileHash(algorithm.hash(file));
+            dto.setFileSize(Files.size(file));
         }
         return dto;
     }
 
-    private List<CompletedExecution> buildExecutionInfo( List<MojoExecution> mojoExecutions,
-            Map<String, MojoExecutionEvent> executionEvents )
-    {
+    private List<CompletedExecution> buildExecutionInfo(
+            List<MojoExecution> mojoExecutions, Map<String, MojoExecutionEvent> executionEvents) {
         List<CompletedExecution> list = new ArrayList<>();
-        for ( MojoExecution mojoExecution : mojoExecutions )
-        {
-            final String executionKey = CacheUtils.mojoExecutionKey( mojoExecution );
-            final MojoExecutionEvent executionEvent = executionEvents != null ? executionEvents.get( executionKey )
-                    : null;
+        for (MojoExecution mojoExecution : mojoExecutions) {
+            final String executionKey = CacheUtils.mojoExecutionKey(mojoExecution);
+            final MojoExecutionEvent executionEvent =
+                    executionEvents != null ? executionEvents.get(executionKey) : null;
             CompletedExecution executionInfo = new CompletedExecution();
-            executionInfo.setExecutionKey( executionKey );
-            executionInfo.setMojoClassName( mojoExecution.getMojoDescriptor().getImplementation() );
-            if ( executionEvent != null )
-            {
-                recordMojoProperties( executionInfo, executionEvent );
+            executionInfo.setExecutionKey(executionKey);
+            executionInfo.setMojoClassName(mojoExecution.getMojoDescriptor().getImplementation());
+            if (executionEvent != null) {
+                recordMojoProperties(executionInfo, executionEvent);
             }
-            list.add( executionInfo );
+            list.add(executionInfo);
         }
         return list;
     }
 
-    private void recordMojoProperties( CompletedExecution execution, MojoExecutionEvent executionEvent )
-    {
+    private void recordMojoProperties(CompletedExecution execution, MojoExecutionEvent executionEvent) {
         final MojoExecution mojoExecution = executionEvent.getExecution();
 
-        final boolean logAll = cacheConfig.isLogAllProperties( mojoExecution );
-        List<TrackedProperty> trackedProperties = cacheConfig.getTrackedProperties( mojoExecution );
-        List<PropertyName> noLogProperties = cacheConfig.getNologProperties( mojoExecution );
-        List<PropertyName> forceLogProperties = cacheConfig.getLoggedProperties( mojoExecution );
+        final boolean logAll = cacheConfig.isLogAllProperties(mojoExecution);
+        List<TrackedProperty> trackedProperties = cacheConfig.getTrackedProperties(mojoExecution);
+        List<PropertyName> noLogProperties = cacheConfig.getNologProperties(mojoExecution);
+        List<PropertyName> forceLogProperties = cacheConfig.getLoggedProperties(mojoExecution);
         final Object mojo = executionEvent.getMojo();
 
         final File baseDir = executionEvent.getProject().getBasedir();
-        final String baseDirPath = FilenameUtils.normalizeNoEndSeparator( baseDir.getAbsolutePath() ) + File.separator;
+        final String baseDirPath = FilenameUtils.normalizeNoEndSeparator(baseDir.getAbsolutePath()) + File.separator;
 
         final List<Parameter> parameters = mojoExecution.getMojoDescriptor().getParameters();
-        for ( Parameter parameter : parameters )
-        {
+        for (Parameter parameter : parameters) {
             // editable parameters could be configured by user
-            if ( !parameter.isEditable() )
-            {
+            if (!parameter.isEditable()) {
                 continue;
             }
 
             final String propertyName = parameter.getName();
-            final boolean tracked = isTracked( propertyName, trackedProperties );
-            if ( !tracked && isExcluded( propertyName, logAll, noLogProperties, forceLogProperties ) )
-            {
+            final boolean tracked = isTracked(propertyName, trackedProperties);
+            if (!tracked && isExcluded(propertyName, logAll, noLogProperties, forceLogProperties)) {
                 continue;
             }
 
-            try
-            {
-                final Object value = ReflectionUtils.getValueIncludingSuperclasses( propertyName, mojo );
-                DtoUtils.addProperty( execution, propertyName, value, baseDirPath, tracked );
-            }
-            catch ( IllegalAccessException e )
-            {
-                LOGGER.info( "Cannot get property {} value from {}: {}", propertyName, mojo, e.getMessage() );
-                if ( tracked )
-                {
-                    throw new IllegalArgumentException( "Property configured in cache introspection config "
-                            + "for " + mojo + " is not accessible: " + propertyName );
+            try {
+                final Object value = ReflectionUtils.getValueIncludingSuperclasses(propertyName, mojo);
+                DtoUtils.addProperty(execution, propertyName, value, baseDirPath, tracked);
+            } catch (IllegalAccessException e) {
+                LOGGER.info("Cannot get property {} value from {}: {}", propertyName, mojo, e.getMessage());
+                if (tracked) {
+                    throw new IllegalArgumentException("Property configured in cache introspection config " + "for "
+                            + mojo + " is not accessible: " + propertyName);
                 }
             }
         }
     }
 
-    private boolean isExcluded( String propertyName, boolean logAll, List<PropertyName> excludedProperties,
-            List<PropertyName> forceLogProperties )
-    {
-        if ( !forceLogProperties.isEmpty() )
-        {
-            for ( PropertyName logProperty : forceLogProperties )
-            {
-                if ( StringUtils.equals( propertyName, logProperty.getPropertyName() ) )
-                {
+    private boolean isExcluded(
+            String propertyName,
+            boolean logAll,
+            List<PropertyName> excludedProperties,
+            List<PropertyName> forceLogProperties) {
+        if (!forceLogProperties.isEmpty()) {
+            for (PropertyName logProperty : forceLogProperties) {
+                if (StringUtils.equals(propertyName, logProperty.getPropertyName())) {
                     return false;
                 }
             }
             return true;
         }
 
-        if ( !excludedProperties.isEmpty() )
-        {
-            for ( PropertyName excludedProperty : excludedProperties )
-            {
-                if ( StringUtils.equals( propertyName, excludedProperty.getPropertyName() ) )
-                {
+        if (!excludedProperties.isEmpty()) {
+            for (PropertyName excludedProperty : excludedProperties) {
+                if (StringUtils.equals(propertyName, excludedProperty.getPropertyName())) {
                     return true;
                 }
             }
@@ -714,39 +636,38 @@ public class CacheControllerImpl implements CacheController
         return !logAll;
     }
 
-    private boolean isTracked( String propertyName, List<TrackedProperty> trackedProperties )
-    {
-        for ( TrackedProperty trackedProperty : trackedProperties )
-        {
-            if ( StringUtils.equals( propertyName, trackedProperty.getPropertyName() ) )
-            {
+    private boolean isTracked(String propertyName, List<TrackedProperty> trackedProperties) {
+        for (TrackedProperty trackedProperty : trackedProperties) {
+            if (StringUtils.equals(propertyName, trackedProperty.getPropertyName())) {
                 return true;
             }
         }
         return false;
     }
 
-    private boolean isCachedSegmentPropertiesPresent( MavenProject project, Build build,
-            List<MojoExecution> mojoExecutions )
-    {
-        for ( MojoExecution mojoExecution : mojoExecutions )
-        {
+    private boolean isCachedSegmentPropertiesPresent(
+            MavenProject project, Build build, List<MojoExecution> mojoExecutions) {
+        for (MojoExecution mojoExecution : mojoExecutions) {
             // completion of all mojos checked above, so we expect tp have execution info here
-            final List<TrackedProperty> trackedProperties = cacheConfig.getTrackedProperties( mojoExecution );
-            final CompletedExecution cachedExecution = build.findMojoExecutionInfo( mojoExecution );
-
-            if ( cachedExecution == null )
-            {
-                LOGGER.info( "Execution is not cached. Plugin: {}, goal {}, executionId: {}", mojoExecution.getPlugin(),
-                        mojoExecution.getGoal(), mojoExecution.getExecutionId() );
+            final List<TrackedProperty> trackedProperties = cacheConfig.getTrackedProperties(mojoExecution);
+            final CompletedExecution cachedExecution = build.findMojoExecutionInfo(mojoExecution);
+
+            if (cachedExecution == null) {
+                LOGGER.info(
+                        "Execution is not cached. Plugin: {}, goal {}, executionId: {}",
+                        mojoExecution.getPlugin(),
+                        mojoExecution.getGoal(),
+                        mojoExecution.getExecutionId());
                 return false;
             }
 
-            if ( !DtoUtils.containsAllProperties( cachedExecution, trackedProperties ) )
-            {
-                LOGGER.warn( "Cached build record doesn't contain all tracked properties. Plugin: {}, goal: {},"
-                        + " executionId: {}", mojoExecution.getPlugin(), mojoExecution.getGoal(),
-                        mojoExecution.getExecutionId() );
+            if (!DtoUtils.containsAllProperties(cachedExecution, trackedProperties)) {
+                LOGGER.warn(
+                        "Cached build record doesn't contain all tracked properties. Plugin: {}, goal: {},"
+                                + " executionId: {}",
+                        mojoExecution.getPlugin(),
+                        mojoExecution.getGoal(),
+                        mojoExecution.getExecutionId());
                 return false;
             }
         }
@@ -754,24 +675,19 @@ public class CacheControllerImpl implements CacheController
     }
 
     @Override
-    public boolean isForcedExecution( MavenProject project, MojoExecution execution )
-    {
-        if ( cacheConfig.isForcedExecution( execution ) )
-        {
+    public boolean isForcedExecution(MavenProject project, MojoExecution execution) {
+        if (cacheConfig.isForcedExecution(execution)) {
             return true;
         }
 
-        if ( StringUtils.isNotBlank( cacheConfig.getAlwaysRunPlugins() ) )
-        {
-            String[] alwaysRunPluginsList = split( cacheConfig.getAlwaysRunPlugins(), "," );
-            for ( String pluginAndGoal : alwaysRunPluginsList )
-            {
-                String[] tokens = pluginAndGoal.split( ":" );
+        if (StringUtils.isNotBlank(cacheConfig.getAlwaysRunPlugins())) {
+            String[] alwaysRunPluginsList = split(cacheConfig.getAlwaysRunPlugins(), ",");
+            for (String pluginAndGoal : alwaysRunPluginsList) {
+                String[] tokens = pluginAndGoal.split(":");
                 String alwaysRunPlugin = tokens[0];
                 String alwaysRunGoal = tokens.length == 1 ? "*" : tokens[1];
-                if ( Objects.equals( execution.getPlugin().getArtifactId(), alwaysRunPlugin )
-                        && ( "*".equals( alwaysRunGoal ) || Objects.equals( execution.getGoal(), alwaysRunGoal ) ) )
-                {
+                if (Objects.equals(execution.getPlugin().getArtifactId(), alwaysRunPlugin)
+                        && ("*".equals(alwaysRunGoal) || Objects.equals(execution.getGoal(), alwaysRunGoal))) {
                     return true;
                 }
             }
@@ -780,189 +696,151 @@ public class CacheControllerImpl implements CacheController
     }
 
     @Override
-    public void saveCacheReport( MavenSession session )
-    {
-        try
-        {
+    public void saveCacheReport(MavenSession session) {
+        try {
             CacheReport cacheReport = new CacheReport();
-            for ( CacheResult result : cacheResults.values() )
-            {
+            for (CacheResult result : cacheResults.values()) {
                 ProjectReport projectReport = new ProjectReport();
                 CacheContext context = result.getContext();
                 MavenProject project = context.getProject();
-                projectReport.setGroupId( project.getGroupId() );
-                projectReport.setArtifactId( project.getArtifactId() );
-                projectReport.setChecksum( context.getInputInfo().getChecksum() );
+                projectReport.setGroupId(project.getGroupId());
+                projectReport.setArtifactId(project.getArtifactId());
+                projectReport.setChecksum(context.getInputInfo().getChecksum());
                 boolean checksumMatched = result.getStatus() != RestoreStatus.EMPTY;
-                projectReport.setChecksumMatched( checksumMatched );
-                projectReport.setLifecycleMatched( checksumMatched && result.isSuccess() );
-                projectReport.setSource( String.valueOf( result.getSource() ) );
-                if ( result.getSource() == CacheSource.REMOTE )
-                {
-                    projectReport.setUrl( remoteCache.getResourceUrl( context, BUILDINFO_XML ) );
-                }
-                else if ( result.getSource() == CacheSource.BUILD && cacheConfig.isSaveToRemote() )
-                {
-                    projectReport.setSharedToRemote( true );
-                    projectReport.setUrl( remoteCache.getResourceUrl( context, BUILDINFO_XML ) );
+                projectReport.setChecksumMatched(checksumMatched);
+                projectReport.setLifecycleMatched(checksumMatched && result.isSuccess());
+                projectReport.setSource(String.valueOf(result.getSource()));
+                if (result.getSource() == CacheSource.REMOTE) {
+                    projectReport.setUrl(remoteCache.getResourceUrl(context, BUILDINFO_XML));
+                } else if (result.getSource() == CacheSource.BUILD && cacheConfig.isSaveToRemote()) {
+                    projectReport.setSharedToRemote(true);
+                    projectReport.setUrl(remoteCache.getResourceUrl(context, BUILDINFO_XML));
                 }
-                cacheReport.addProject( projectReport );
+                cacheReport.addProject(projectReport);
             }
 
             String buildId = UUID.randomUUID().toString();
-            localCache.saveCacheReport( buildId, session, cacheReport );
-        }
-        catch ( Exception e )
-        {
-            LOGGER.error( "Cannot save incremental build aggregated report", e );
+            localCache.saveCacheReport(buildId, session, cacheReport);
+        } catch (Exception e) {
+            LOGGER.error("Cannot save incremental build aggregated report", e);
         }
     }
 
-    private void populateGitInfo( Build build, MavenSession session )
-    {
-        if ( scm == null )
-        {
-            synchronized ( this )
-            {
-                if ( scm == null )
-                {
-                    try
-                    {
-                        scm = CacheUtils.readGitInfo( session );
-                    }
-                    catch ( IOException e )
-                    {
+    private void populateGitInfo(Build build, MavenSession session) {
+        if (scm == null) {
+            synchronized (this) {
+                if (scm == null) {
+                    try {
+                        scm = CacheUtils.readGitInfo(session);
+                    } catch (IOException e) {
                         scm = new Scm();
-                        LOGGER.error( "Cannot populate git info", e );
+                        LOGGER.error("Cannot populate git info", e);
                     }
                 }
             }
         }
-        build.getDto().setScm( scm );
+        build.getDto().setScm(scm);
     }
 
-    private void zipAndAttachArtifact( MavenProject project, Path dir, String classifier ) throws IOException
-    {
-        Path temp = Files.createTempFile( "maven-incremental", project.getArtifactId() );
+    private void zipAndAttachArtifact(MavenProject project, Path dir, String classifier) throws IOException {
+        Path temp = Files.createTempFile("maven-incremental", project.getArtifactId());
         temp.toFile().deleteOnExit();
-        CacheUtils.zip( dir, temp );
-        projectHelper.attachArtifact( project, "zip", classifier, temp.toFile() );
+        CacheUtils.zip(dir, temp);
+        projectHelper.attachArtifact(project, "zip", classifier, temp.toFile());
     }
 
-    private String pathToClassifier( Path relative )
-    {
+    private String pathToClassifier(Path relative) {
         final int nameCount = relative.getNameCount();
-        List<String> segments = new ArrayList<>( nameCount + 1 );
-        for ( int i = 0; i < nameCount; i++ )
-        {
-            segments.add( relative.getName( i ).toFile().getName() );
+        List<String> segments = new ArrayList<>(nameCount + 1);
+        for (int i = 0; i < nameCount; i++) {
+            segments.add(relative.getName(i).toFile().getName());
         }
         // todo handle _ in file names
-        return BUILD_PREFIX + StringUtils.join( segments.iterator(), FILE_SEPARATOR_SUBST );
+        return BUILD_PREFIX + StringUtils.join(segments.iterator(), FILE_SEPARATOR_SUBST);
     }
 
-    private Path classifierToPath( Path outputDir, String classifier )
-    {
-        classifier = StringUtils.removeStart( classifier, BUILD_PREFIX );
-        final String relPath = replace( classifier, FILE_SEPARATOR_SUBST, File.separator );
-        return outputDir.resolve( relPath );
+    private Path classifierToPath(Path outputDir, String classifier) {
+        classifier = StringUtils.removeStart(classifier, BUILD_PREFIX);
+        final String relPath = replace(classifier, FILE_SEPARATOR_SUBST, File.separator);
+        return outputDir.resolve(relPath);
     }
 
-    private void restoreGeneratedSources( Artifact artifact, Path artifactFilePath, MavenProject project )
-            throws IOException
-    {
-        final Path targetDir = Paths.get( project.getBuild().getDirectory() );
-        final Path outputDir = classifierToPath( targetDir, artifact.getClassifier() );
-        if ( Files.exists( outputDir ) )
-        {
-            FileUtils.cleanDirectory( outputDir.toFile() );
-        }
-        else
-        {
-            Files.createDirectories( outputDir );
+    private void restoreGeneratedSources(Artifact artifact, Path artifactFilePath, MavenProject project)
+            throws IOException {
+        final Path targetDir = Paths.get(project.getBuild().getDirectory());
+        final Path outputDir = classifierToPath(targetDir, artifact.getClassifier());
+        if (Files.exists(outputDir)) {
+            FileUtils.cleanDirectory(outputDir.toFile());
+        } else {
+            Files.createDirectories(outputDir);
         }
-        CacheUtils.unzip( artifactFilePath, outputDir );
+        CacheUtils.unzip(artifactFilePath, outputDir);
     }
 
-    //TODO: move to config
-    public void attachGeneratedSources( MavenProject project ) throws IOException
-    {
-        final Path targetDir = Paths.get( project.getBuild().getDirectory() );
+    // TODO: move to config
+    public void attachGeneratedSources(MavenProject project) throws IOException {
+        final Path targetDir = Paths.get(project.getBuild().getDirectory());
 
-        final Path generatedSourcesDir = targetDir.resolve( "generated-sources" );
-        attachDirIfNotEmpty( generatedSourcesDir, targetDir, project );
+        final Path generatedSourcesDir = targetDir.resolve("generated-sources");
+        attachDirIfNotEmpty(generatedSourcesDir, targetDir, project);
 
-        final Path generatedTestSourcesDir = targetDir.resolve( "generated-test-sources" );
-        attachDirIfNotEmpty( generatedTestSourcesDir, targetDir, project );
+        final Path generatedTestSourcesDir = targetDir.resolve("generated-test-sources");
+        attachDirIfNotEmpty(generatedTestSourcesDir, targetDir, project);
 
         Set<String> sourceRoots = new TreeSet<>();
-        if ( project.getCompileSourceRoots() != null )
-        {
-            sourceRoots.addAll( project.getCompileSourceRoots() );
+        if (project.getCompileSourceRoots() != null) {
+            sourceRoots.addAll(project.getCompileSourceRoots());
         }
-        if ( project.getTestCompileSourceRoots() != null )
-        {
-            sourceRoots.addAll( project.getTestCompileSourceRoots() );
+        if (project.getTestCompileSourceRoots() != null) {
+            sourceRoots.addAll(project.getTestCompileSourceRoots());
         }
 
-        for ( String sourceRoot : sourceRoots )
-        {
-            final Path sourceRootPath = Paths.get( sourceRoot );
-            if ( Files.isDirectory( sourceRootPath )
-                    && sourceRootPath.startsWith( targetDir )
-                    && !( sourceRootPath.startsWith( generatedSourcesDir )
-                            || sourceRootPath.startsWith( generatedTestSourcesDir ) ) )
-            { // dir within target
-                attachDirIfNotEmpty( sourceRootPath, targetDir, project );
+        for (String sourceRoot : sourceRoots) {
+            final Path sourceRootPath = Paths.get(sourceRoot);
+            if (Files.isDirectory(sourceRootPath)
+                    && sourceRootPath.startsWith(targetDir)
+                    && !(sourceRootPath.startsWith(generatedSourcesDir)
+                            || sourceRootPath.startsWith(generatedTestSourcesDir))) { // dir within target
+                attachDirIfNotEmpty(sourceRootPath, targetDir, project);
             }
         }
     }
 
-    private void attachOutputs( MavenProject project ) throws IOException
-    {
+    private void attachOutputs(MavenProject project) throws IOException {
         final List<String> attachedDirs = cacheConfig.getAttachedOutputs();
-        for ( String dir : attachedDirs )
-        {
-            final Path targetDir = Paths.get( project.getBuild().getDirectory() );
-            final Path outputDir = targetDir.resolve( dir );
-            attachDirIfNotEmpty( outputDir, targetDir, project );
+        for (String dir : attachedDirs) {
+            final Path targetDir = Paths.get(project.getBuild().getDirectory());
+            final Path outputDir = targetDir.resolve(dir);
+            attachDirIfNotEmpty(outputDir, targetDir, project);
         }
     }
 
-    private void attachDirIfNotEmpty( Path candidateSubDir, Path parentDir, MavenProject project ) throws IOException
-    {
-        if ( Files.isDirectory( candidateSubDir ) && hasFiles( candidateSubDir ) )
-        {
-            final Path relativePath = parentDir.relativize( candidateSubDir );
-            final String classifier = pathToClassifier( relativePath );
-            zipAndAttachArtifact( project, candidateSubDir, classifier );
-            LOGGER.debug( "Attached directory: {}", candidateSubDir );
+    private void attachDirIfNotEmpty(Path candidateSubDir, Path parentDir, MavenProject project) throws IOException {
+        if (Files.isDirectory(candidateSubDir) && hasFiles(candidateSubDir)) {
+            final Path relativePath = parentDir.relativize(candidateSubDir);
+            final String classifier = pathToClassifier(relativePath);
+            zipAndAttachArtifact(project, candidateSubDir, classifier);
+            LOGGER.debug("Attached directory: {}", candidateSubDir);
         }
     }
 
-    private boolean hasFiles( Path candidateSubDir ) throws IOException
-    {
+    private boolean hasFiles(Path candidateSubDir) throws IOException {
         final MutableBoolean hasFiles = new MutableBoolean();
-        Files.walkFileTree( candidateSubDir, new SimpleFileVisitor<Path>()
-        {
+        Files.walkFileTree(candidateSubDir, new SimpleFileVisitor<Path>() {
 
             @Override
-            public FileVisitResult visitFile( Path path, BasicFileAttributes basicFileAttributes )
-            {
+            public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) {
                 hasFiles.setTrue();
                 return FileVisitResult.TERMINATE;
             }
-        } );
+        });
         return hasFiles.booleanValue();
     }
 
-    private boolean isOutputArtifact( String name )
-    {
+    private boolean isOutputArtifact(String name) {
         List<Pattern> excludePatterns = cacheConfig.getExcludePatterns();
-        for ( Pattern pattern : excludePatterns )
-        {
-            if ( pattern.matcher( name ).matches() )
-            {
+        for (Pattern pattern : excludePatterns) {
+            if (pattern.matcher(name).matches()) {
                 return false;
             }
         }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheDiff.java b/src/main/java/org/apache/maven/buildcache/CacheDiff.java
index f740faa..4c9c63b 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheDiff.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheDiff.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -27,6 +27,7 @@ import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.buildcache.xml.CacheConfig;
 import org.apache.maven.buildcache.xml.build.Build;
@@ -40,242 +41,221 @@ import org.apache.maven.buildcache.xml.diff.Mismatch;
 /**
  * Utility class for comparing 2 builds
  */
-public class CacheDiff
-{
+public class CacheDiff {
 
     private final CacheConfig config;
     private final Build current;
     private final Build baseline;
     private final LinkedList<Mismatch> report;
 
-    public CacheDiff( Build current, Build baseline, CacheConfig config )
-    {
+    public CacheDiff(Build current, Build baseline, CacheConfig config) {
         this.current = current;
         this.baseline = baseline;
         this.config = config;
         this.report = new LinkedList<>();
     }
 
-    public Diff compare()
-    {
-        if ( !StringUtils.equals( current.getHashFunction(), baseline.getHashFunction() ) )
-        {
+    public Diff compare() {
+        if (!StringUtils.equals(current.getHashFunction(), baseline.getHashFunction())) {
             addNewMismatch(
                     "hashFunction",
                     current.getHashFunction(),
                     baseline.getHashFunction(),
                     "Different algorithms render caches not comparable and cached could not be reused",
-                    "Ensure the same algorithm as remote" );
+                    "Ensure the same algorithm as remote");
         }
-        compareEffectivePoms( current.getProjectsInputInfo(), baseline.getProjectsInputInfo() );
-        compareExecutions( current.getExecutions(), baseline.getExecutions() );
-        compareFiles( current.getProjectsInputInfo(), baseline.getProjectsInputInfo() );
-        compareDependencies( current.getProjectsInputInfo(), baseline.getProjectsInputInfo() );
+        compareEffectivePoms(current.getProjectsInputInfo(), baseline.getProjectsInputInfo());
+        compareExecutions(current.getExecutions(), baseline.getExecutions());
+        compareFiles(current.getProjectsInputInfo(), baseline.getProjectsInputInfo());
+        compareDependencies(current.getProjectsInputInfo(), baseline.getProjectsInputInfo());
 
         final Diff buildDiffType = new Diff();
-        buildDiffType.getMismatches().addAll( report );
+        buildDiffType.getMismatches().addAll(report);
         return buildDiffType;
     }
 
-    private void compareEffectivePoms( ProjectsInputInfo current, ProjectsInputInfo baseline )
-    {
-        Optional<DigestItem> currentPom = findPom( current );
-        String currentPomHash = currentPom.map( DigestItem::getHash ).orElse( null );
+    private void compareEffectivePoms(ProjectsInputInfo current, ProjectsInputInfo baseline) {
+        Optional<DigestItem> currentPom = findPom(current);
+        String currentPomHash = currentPom.map(DigestItem::getHash).orElse(null);
 
-        Optional<DigestItem> baseLinePom = findPom( baseline );
-        String baselinePomHash = baseLinePom.map( DigestItem::getHash ).orElse( null );
+        Optional<DigestItem> baseLinePom = findPom(baseline);
+        String baselinePomHash = baseLinePom.map(DigestItem::getHash).orElse(null);
 
-        if ( !StringUtils.equals( currentPomHash, baselinePomHash ) )
-        {
+        if (!StringUtils.equals(currentPomHash, baselinePomHash)) {
             addNewMismatch(
-                    "effectivePom", currentPomHash, baselinePomHash,
+                    "effectivePom",
+                    currentPomHash,
+                    baselinePomHash,
                     "Difference in effective pom suggests effectively different builds which cannot be reused",
                     "Compare raw content of effective poms and eliminate differences. "
-                            + "See How-To for common techniques" );
+                            + "See How-To for common techniques");
         }
     }
 
-    public static Optional<DigestItem> findPom( ProjectsInputInfo projectInputs )
-    {
-        for ( DigestItem digestItemType : projectInputs.getItems() )
-        {
-            if ( "pom".equals( digestItemType.getType() ) )
-            {
-                return Optional.of( digestItemType );
-
+    public static Optional<DigestItem> findPom(ProjectsInputInfo projectInputs) {
+        for (DigestItem digestItemType : projectInputs.getItems()) {
+            if ("pom".equals(digestItemType.getType())) {
+                return Optional.of(digestItemType);
             }
         }
         return Optional.empty();
     }
 
-    @SuppressWarnings( "checkstyle:LineLength" )
-    private void compareFiles( ProjectsInputInfo current, ProjectsInputInfo baseline )
-    {
+    @SuppressWarnings("checkstyle:LineLength")
+    private void compareFiles(ProjectsInputInfo current, ProjectsInputInfo baseline) {
         final Map<String, DigestItem> currentFiles = current.getItems().stream()
-                .filter( item -> "file".equals( item.getType() ) )
-                .collect( Collectors.toMap( DigestItem::getValue, item -> item ) );
+                .filter(item -> "file".equals(item.getType()))
+                .collect(Collectors.toMap(DigestItem::getValue, item -> item));
 
         final Map<String, DigestItem> baselineFiles = baseline.getItems().stream()
-                .filter( item -> "file".equals( item.getType() ) )
-                .collect( Collectors.toMap( DigestItem::getValue, item -> item ) );
+                .filter(item -> "file".equals(item.getType()))
+                .collect(Collectors.toMap(DigestItem::getValue, item -> item));
 
-        if ( !Objects.equals( currentFiles.keySet(), baselineFiles.keySet() ) )
-        {
-            Set<String> currentVsBaseline = diff( currentFiles.keySet(), baselineFiles.keySet() );
-            Set<String> baselineVsCurrent = diff( baselineFiles.keySet(), currentFiles.keySet() );
+        if (!Objects.equals(currentFiles.keySet(), baselineFiles.keySet())) {
+            Set<String> currentVsBaseline = diff(currentFiles.keySet(), baselineFiles.keySet());
+            Set<String> baselineVsCurrent = diff(baselineFiles.keySet(), currentFiles.keySet());
 
-            addNewMismatch( "source files",
-                    "Remote and local cache contain different sets of input files. "
-                            + "Added files: " + currentVsBaseline + ". Removed files: " + baselineVsCurrent,
+            addNewMismatch(
+                    "source files",
+                    "Remote and local cache contain different sets of input files. " + "Added files: "
+                            + currentVsBaseline + ". Removed files: " + baselineVsCurrent,
                     "To match remote and local caches should have identical file sets."
                             + " Unnecessary and transient files must be filtered out to make file sets match"
-                            + " - see configuration guide" );
+                            + " - see configuration guide");
             return;
         }
 
-        for ( Map.Entry<String, DigestItem> entry : currentFiles.entrySet() )
-        {
+        for (Map.Entry<String, DigestItem> entry : currentFiles.entrySet()) {
             String filePath = entry.getKey();
             DigestItem currentFile = entry.getValue();
             // should be null safe because sets are compared above for differences
-            final DigestItem baselineFile = baselineFiles.get( filePath );
-            if ( !StringUtils.equals( currentFile.getHash(), baselineFile.getHash() ) )
-            {
+            final DigestItem baselineFile = baselineFiles.get(filePath);
+            if (!StringUtils.equals(currentFile.getHash(), baselineFile.getHash())) {
                 String reason = "File content is different.";
-                if ( currentFile.getEol() != null && baselineFile.getEol() != null && !StringUtils.equals(
-                        baselineFile.getEol(), currentFile.getEol() ) )
-                {
-                    reason += " Different line endings detected (text files relevant). "
-                            + "Remote: " + baselineFile.getEol() + ", local: " + currentFile.getEol() + ".";
+                if (currentFile.getEol() != null
+                        && baselineFile.getEol() != null
+                        && !StringUtils.equals(baselineFile.getEol(), currentFile.getEol())) {
+                    reason += " Different line endings detected (text files relevant). " + "Remote: "
+                            + baselineFile.getEol() + ", local: " + currentFile.getEol() + ".";
                 }
-                if ( currentFile.getCharset() != null && baselineFile.getCharset() != null && !StringUtils.equals(
-                        baselineFile.getCharset(), currentFile.getCharset() ) )
-                {
-                    reason += " Different charset detected (text files relevant). "
-                            + "Remote: " + baselineFile.getEol() + ", local: " + currentFile.getEol() + ".";
+                if (currentFile.getCharset() != null
+                        && baselineFile.getCharset() != null
+                        && !StringUtils.equals(baselineFile.getCharset(), currentFile.getCharset())) {
+                    reason += " Different charset detected (text files relevant). " + "Remote: " + baselineFile.getEol()
+                            + ", local: " + currentFile.getEol() + ".";
                 }
 
-                addNewMismatch( filePath, currentFile.getHash(), baselineFile.getHash(), reason,
+                addNewMismatch(
+                        filePath,
+                        currentFile.getHash(),
+                        baselineFile.getHash(),
+                        reason,
                         "Different content manifests different build outcome. "
-                                + "Ensure that difference is not caused by environment specifics, like line separators" );
+                                + "Ensure that difference is not caused by environment specifics, like line separators");
             }
         }
     }
 
-    private void compareDependencies( ProjectsInputInfo current, ProjectsInputInfo baseline )
-    {
+    private void compareDependencies(ProjectsInputInfo current, ProjectsInputInfo baseline) {
         final Map<String, DigestItem> currentDependencies = current.getItems().stream()
-                .filter( item -> "dependency".equals( item.getType() ) )
-                .collect( Collectors.toMap( DigestItem::getValue, item -> item ) );
+                .filter(item -> "dependency".equals(item.getType()))
+                .collect(Collectors.toMap(DigestItem::getValue, item -> item));
 
         final Map<String, DigestItem> baselineDependencies = baseline.getItems().stream()
-                .filter( item -> "dependency".equals( item.getType() ) )
-                .collect( Collectors.toMap( DigestItem::getValue, item -> item ) );
+                .filter(item -> "dependency".equals(item.getType()))
+                .collect(Collectors.toMap(DigestItem::getValue, item -> item));
 
-        if ( !Objects.equals( currentDependencies.keySet(), baselineDependencies.keySet() ) )
-        {
-            Set<String> currentVsBaseline = diff( currentDependencies.keySet(), baselineDependencies.keySet() );
-            Set<String> baselineVsCurrent = diff( baselineDependencies.keySet(), currentDependencies.keySet() );
+        if (!Objects.equals(currentDependencies.keySet(), baselineDependencies.keySet())) {
+            Set<String> currentVsBaseline = diff(currentDependencies.keySet(), baselineDependencies.keySet());
+            Set<String> baselineVsCurrent = diff(baselineDependencies.keySet(), currentDependencies.keySet());
 
-            addNewMismatch( "dependencies files",
+            addNewMismatch(
+                    "dependencies files",
                     "Remote and local builds contain different sets of dependencies and cannot be matched. "
                             + "Added dependencies: " + currentVsBaseline + ". Removed dependencies: "
                             + baselineVsCurrent,
                     "Remote and local builds should have identical dependencies. "
-                            + "The difference manifests changes in downstream dependencies or introduced snapshots." );
+                            + "The difference manifests changes in downstream dependencies or introduced snapshots.");
             return;
         }
 
-        for ( Map.Entry<String, DigestItem> entry : currentDependencies.entrySet() )
-        {
+        for (Map.Entry<String, DigestItem> entry : currentDependencies.entrySet()) {
             String dependencyKey = entry.getKey();
             DigestItem currentDependency = entry.getValue();
             // null safe - sets compared for differences above
-            final DigestItem baselineDependency = baselineDependencies.get( dependencyKey );
-            if ( !StringUtils.equals( currentDependency.getHash(), baselineDependency.getHash() ) )
-            {
-                addNewMismatch( dependencyKey, currentDependency.getHash(), baselineDependency.getHash(),
+            final DigestItem baselineDependency = baselineDependencies.get(dependencyKey);
+            if (!StringUtils.equals(currentDependency.getHash(), baselineDependency.getHash())) {
+                addNewMismatch(
+                        dependencyKey,
+                        currentDependency.getHash(),
+                        baselineDependency.getHash(),
                         "Downstream project or snapshot changed",
                         "Find downstream project and investigate difference in the downstream project. "
-                                + "Enable fail fast mode and single threaded execution to simplify debug." );
+                                + "Enable fail fast mode and single threaded execution to simplify debug.");
             }
         }
     }
 
-    private void compareExecutions( List<CompletedExecution> current, List<CompletedExecution> baseline )
-    {
+    private void compareExecutions(List<CompletedExecution> current, List<CompletedExecution> baseline) {
         Map<String, CompletedExecution> baselineExecutionsByKey = new HashMap<>();
-        for ( CompletedExecution completedExecutionType : baseline )
-        {
-            baselineExecutionsByKey.put( completedExecutionType.getExecutionKey(), completedExecutionType );
+        for (CompletedExecution completedExecutionType : baseline) {
+            baselineExecutionsByKey.put(completedExecutionType.getExecutionKey(), completedExecutionType);
         }
 
         Map<String, CompletedExecution> currentExecutionsByKey = new HashMap<>();
-        for ( CompletedExecution e1 : current )
-        {
-            currentExecutionsByKey.put( e1.getExecutionKey(), e1 );
+        for (CompletedExecution e1 : current) {
+            currentExecutionsByKey.put(e1.getExecutionKey(), e1);
         }
 
         // such situation normally means different poms and mismatch in effective poms,
         // but in any case it is helpful to report
-        for ( CompletedExecution baselineExecution : baseline )
-        {
-            if ( !currentExecutionsByKey.containsKey( baselineExecution.getExecutionKey() ) )
-            {
+        for (CompletedExecution baselineExecution : baseline) {
+            if (!currentExecutionsByKey.containsKey(baselineExecution.getExecutionKey())) {
                 addNewMismatch(
                         baselineExecution.getExecutionKey(),
                         "Baseline build contains excessive plugin " + baselineExecution.getExecutionKey(),
                         "Different set of plugins produces different build results. "
-                                + "Exclude non-critical plugins or make sure plugin sets match" );
+                                + "Exclude non-critical plugins or make sure plugin sets match");
             }
         }
 
-        for ( CompletedExecution currentExecution : current )
-        {
-            if ( !baselineExecutionsByKey.containsKey( currentExecution.getExecutionKey() ) )
-            {
+        for (CompletedExecution currentExecution : current) {
+            if (!baselineExecutionsByKey.containsKey(currentExecution.getExecutionKey())) {
                 addNewMismatch(
                         currentExecution.getExecutionKey(),
                         "Cached build doesn't contain plugin " + currentExecution.getExecutionKey(),
                         "Different set of plugins produces different build results. "
                                 + "Filter out non-critical plugins or make sure remote cache always run full build "
-                                + "with all plugins" );
+                                + "with all plugins");
                 continue;
             }
 
-            final CompletedExecution baselineExecution = baselineExecutionsByKey
-                    .get( currentExecution.getExecutionKey() );
-            comparePlugins( currentExecution, baselineExecution );
+            final CompletedExecution baselineExecution =
+                    baselineExecutionsByKey.get(currentExecution.getExecutionKey());
+            comparePlugins(currentExecution, baselineExecution);
         }
     }
 
-    private void comparePlugins( CompletedExecution current, CompletedExecution baseline )
-    {
+    private void comparePlugins(CompletedExecution current, CompletedExecution baseline) {
         // TODO add support for skip values
         final List<PropertyValue> trackedProperties = new ArrayList<>();
-        for ( PropertyValue propertyValueType : current.getProperties() )
-        {
-            if ( propertyValueType.isTracked() )
-            {
-                trackedProperties.add( propertyValueType );
+        for (PropertyValue propertyValueType : current.getProperties()) {
+            if (propertyValueType.isTracked()) {
+                trackedProperties.add(propertyValueType);
             }
         }
-        if ( trackedProperties.isEmpty() )
-        {
+        if (trackedProperties.isEmpty()) {
             return;
         }
 
         final Map<String, PropertyValue> baselinePropertiesByName = new HashMap<>();
-        for ( PropertyValue propertyValueType : baseline.getProperties() )
-        {
-            baselinePropertiesByName.put( propertyValueType.getName(), propertyValueType );
+        for (PropertyValue propertyValueType : baseline.getProperties()) {
+            baselinePropertiesByName.put(propertyValueType.getName(), propertyValueType);
         }
 
-        for ( PropertyValue p : trackedProperties )
-        {
-            final PropertyValue baselineValue = baselinePropertiesByName.get( p.getName() );
-            if ( baselineValue == null || !StringUtils.equals( baselineValue.getValue(), p.getValue() ) )
-            {
+        for (PropertyValue p : trackedProperties) {
+            final PropertyValue baselineValue = baselinePropertiesByName.get(p.getName());
+            if (baselineValue == null || !StringUtils.equals(baselineValue.getValue(), p.getValue())) {
                 addNewMismatch(
                         p.getName(),
                         p.getValue(),
@@ -284,37 +264,30 @@ public class CacheDiff
                                 + " has mismatch in tracked property and cannot be reused",
                         "Align properties between remote and local build or remove property from tracked "
                                 + "list if mismatch could be tolerated. In some cases it is possible to add skip value "
-                                + "to ignore lax mismatch" );
+                                + "to ignore lax mismatch");
             }
         }
     }
 
-    private void addNewMismatch( String item, String current, String baseline, String reason,
-            String resolution )
-    {
+    private void addNewMismatch(String item, String current, String baseline, String reason, String resolution) {
         final Mismatch mismatch = new Mismatch();
-        mismatch.setItem( item );
-        mismatch.setCurrent( current );
-        mismatch.setBaseline( baseline );
-        mismatch.setReason( reason );
-        mismatch.setResolution( resolution );
-        report.add( mismatch );
+        mismatch.setItem(item);
+        mismatch.setCurrent(current);
+        mismatch.setBaseline(baseline);
+        mismatch.setReason(reason);
+        mismatch.setResolution(resolution);
+        report.add(mismatch);
     }
 
-    private void addNewMismatch( String property, String reason, String resolution )
-    {
+    private void addNewMismatch(String property, String reason, String resolution) {
         final Mismatch mismatchType = new Mismatch();
-        mismatchType.setItem( property );
-        mismatchType.setReason( reason );
-        mismatchType.setResolution( resolution );
-        report.add( mismatchType );
+        mismatchType.setItem(property);
+        mismatchType.setReason(reason);
+        mismatchType.setResolution(resolution);
+        report.add(mismatchType);
     }
 
-    private static <T> Set<T> diff( Set<T> a, Set<T> b )
-    {
-        return a.stream()
-                .filter( v -> !b.contains( v ) )
-                .collect( Collectors.toSet() );
-
+    private static <T> Set<T> diff(Set<T> a, Set<T> b) {
+        return a.stream().filter(v -> !b.contains(v)).collect(Collectors.toSet());
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheLifecycleParticipant.java b/src/main/java/org/apache/maven/buildcache/CacheLifecycleParticipant.java
index 4b46266..a4f2e91 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheLifecycleParticipant.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheLifecycleParticipant.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -20,6 +20,7 @@ package org.apache.maven.buildcache;
 
 import javax.inject.Inject;
 import javax.inject.Named;
+
 import org.apache.maven.AbstractMavenLifecycleParticipant;
 import org.apache.maven.MavenExecutionException;
 import org.apache.maven.SessionScoped;
@@ -28,26 +29,22 @@ import org.apache.maven.execution.MavenSession;
 
 @SessionScoped
 @Named
-@SuppressWarnings( "unused" )
-public class CacheLifecycleParticipant extends AbstractMavenLifecycleParticipant
-{
+@SuppressWarnings("unused")
+public class CacheLifecycleParticipant extends AbstractMavenLifecycleParticipant {
 
     private final CacheConfig cacheConfig;
     private final CacheController cacheController;
 
     @Inject
-    public CacheLifecycleParticipant( CacheConfig cacheConfig, CacheController cacheController )
-    {
+    public CacheLifecycleParticipant(CacheConfig cacheConfig, CacheController cacheController) {
         this.cacheConfig = cacheConfig;
         this.cacheController = cacheController;
     }
 
     @Override
-    public void afterSessionEnd( MavenSession session ) throws MavenExecutionException
-    {
-        if ( cacheConfig.isEnabled() )
-        {
-            cacheController.saveCacheReport( session );
+    public void afterSessionEnd(MavenSession session) throws MavenExecutionException {
+        if (cacheConfig.isEnabled()) {
+            cacheController.saveCacheReport(session);
         }
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheRepository.java b/src/main/java/org/apache/maven/buildcache/CacheRepository.java
index 5851011..6a9a293 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheRepository.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheRepository.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,9 +18,11 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+
 import java.io.IOException;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.buildcache.xml.Build;
 import org.apache.maven.buildcache.xml.report.CacheReport;
@@ -29,15 +31,14 @@ import org.apache.maven.execution.MavenSession;
 /**
  * Cache repository.
  */
-public interface CacheRepository
-{
+public interface CacheRepository {
 
     @Nonnull
-    Optional<Build> findBuild( CacheContext context ) throws IOException;
+    Optional<Build> findBuild(CacheContext context) throws IOException;
 
-    void saveBuildInfo( CacheResult cacheResult, Build build ) throws IOException;
+    void saveBuildInfo(CacheResult cacheResult, Build build) throws IOException;
 
-    void saveArtifactFile( CacheResult cacheResult, Artifact artifact ) throws IOException;
+    void saveArtifactFile(CacheResult cacheResult, Artifact artifact) throws IOException;
 
-    void saveCacheReport( String buildId, MavenSession session, CacheReport cacheReport ) throws IOException;
+    void saveCacheReport(String buildId, MavenSession session, CacheReport cacheReport) throws IOException;
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheResult.java b/src/main/java/org/apache/maven/buildcache/CacheResult.java
index 65ad7a8..e2c118b 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheResult.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheResult.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -26,97 +26,81 @@ import static java.util.Objects.requireNonNull;
 /**
  * CacheResult
  */
-public class CacheResult
-{
+public class CacheResult {
 
     private final RestoreStatus status;
     private final Build build;
     private final CacheContext context;
 
-    private CacheResult( RestoreStatus status, Build build, CacheContext context )
-    {
-        this.status = requireNonNull( status );
+    private CacheResult(RestoreStatus status, Build build, CacheContext context) {
+        this.status = requireNonNull(status);
         this.build = build;
         this.context = context;
     }
 
-    public static CacheResult empty( CacheContext context )
-    {
-        requireNonNull( context );
-        return new CacheResult( RestoreStatus.EMPTY, null, context );
+    public static CacheResult empty(CacheContext context) {
+        requireNonNull(context);
+        return new CacheResult(RestoreStatus.EMPTY, null, context);
     }
 
-    public static CacheResult empty()
-    {
-        return new CacheResult( RestoreStatus.EMPTY, null, null );
+    public static CacheResult empty() {
+        return new CacheResult(RestoreStatus.EMPTY, null, null);
     }
 
-    public static CacheResult failure( Build build, CacheContext context )
-    {
-        requireNonNull( build );
-        requireNonNull( context );
-        return new CacheResult( RestoreStatus.FAILURE, build, context );
+    public static CacheResult failure(Build build, CacheContext context) {
+        requireNonNull(build);
+        requireNonNull(context);
+        return new CacheResult(RestoreStatus.FAILURE, build, context);
     }
 
-    public static CacheResult success( Build build, CacheContext context )
-    {
-        requireNonNull( build );
-        requireNonNull( context );
-        return new CacheResult( RestoreStatus.SUCCESS, build, context );
+    public static CacheResult success(Build build, CacheContext context) {
+        requireNonNull(build);
+        requireNonNull(context);
+        return new CacheResult(RestoreStatus.SUCCESS, build, context);
     }
 
-    public static CacheResult partialSuccess( Build build, CacheContext context )
-    {
-        requireNonNull( build );
-        requireNonNull( context );
-        return new CacheResult( RestoreStatus.PARTIAL, build, context );
+    public static CacheResult partialSuccess(Build build, CacheContext context) {
+        requireNonNull(build);
+        requireNonNull(context);
+        return new CacheResult(RestoreStatus.PARTIAL, build, context);
     }
 
-    public static CacheResult failure( CacheContext context )
-    {
-        requireNonNull( context );
-        return new CacheResult( RestoreStatus.FAILURE, null, context );
+    public static CacheResult failure(CacheContext context) {
+        requireNonNull(context);
+        return new CacheResult(RestoreStatus.FAILURE, null, context);
     }
 
-    public static CacheResult rebuilded( CacheResult orig, Build build )
-    {
-        requireNonNull( orig );
-        requireNonNull( build );
-        return new CacheResult( orig.status, build, orig.context );
+    public static CacheResult rebuilded(CacheResult orig, Build build) {
+        requireNonNull(orig);
+        requireNonNull(build);
+        return new CacheResult(orig.status, build, orig.context);
     }
 
-    public boolean isSuccess()
-    {
+    public boolean isSuccess() {
         return status == RestoreStatus.SUCCESS;
     }
 
-    public Build getBuildInfo()
-    {
+    public Build getBuildInfo() {
         return build;
     }
 
-    public CacheSource getSource()
-    {
+    public CacheSource getSource() {
         return build != null ? build.getSource() : null;
     }
 
-    public CacheContext getContext()
-    {
+    public CacheContext getContext() {
         return context;
     }
 
-    public boolean isPartialSuccess()
-    {
+    public boolean isPartialSuccess() {
         return status == RestoreStatus.PARTIAL;
     }
 
-    public RestoreStatus getStatus()
-    {
+    public RestoreStatus getStatus() {
         return status;
     }
 
-    public boolean isFinal()
-    {
+    public boolean isFinal() {
         return build != null && build.getDto().is_final();
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/CacheUtils.java b/src/main/java/org/apache/maven/buildcache/CacheUtils.java
index fa471ba..2396a0b 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheUtils.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -35,6 +35,7 @@ import java.util.function.Supplier;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
@@ -54,118 +55,96 @@ import static org.apache.maven.artifact.Artifact.SNAPSHOT_VERSION;
 /**
  * Cache Utils
  */
-public class CacheUtils
-{
+public class CacheUtils {
 
-    public static boolean isPom( MavenProject project )
-    {
-        return project.getPackaging().equals( "pom" );
+    public static boolean isPom(MavenProject project) {
+        return project.getPackaging().equals("pom");
     }
 
-    public static boolean isPom( Dependency dependency )
-    {
-        return dependency.getType().equals( "pom" );
+    public static boolean isPom(Dependency dependency) {
+        return dependency.getType().equals("pom");
     }
 
-    public static boolean isSnapshot( String version )
-    {
-        return version.endsWith( SNAPSHOT_VERSION ) || version.endsWith( LATEST_VERSION );
+    public static boolean isSnapshot(String version) {
+        return version.endsWith(SNAPSHOT_VERSION) || version.endsWith(LATEST_VERSION);
     }
 
-    public static String normalizedName( Artifact artifact )
-    {
-        if ( artifact.getFile() == null )
-        {
+    public static String normalizedName(Artifact artifact) {
+        if (artifact.getFile() == null) {
             return null;
         }
 
-        StringBuilder filename = new StringBuilder( artifact.getArtifactId() );
+        StringBuilder filename = new StringBuilder(artifact.getArtifactId());
 
-        if ( artifact.hasClassifier() )
-        {
-            filename.append( "-" ).append( artifact.getClassifier() );
+        if (artifact.hasClassifier()) {
+            filename.append("-").append(artifact.getClassifier());
         }
 
         final ArtifactHandler artifactHandler = artifact.getArtifactHandler();
-        if ( artifactHandler != null && StringUtils.isNotBlank( artifactHandler.getExtension() ) )
-        {
-            filename.append( "." ).append( artifactHandler.getExtension() );
+        if (artifactHandler != null && StringUtils.isNotBlank(artifactHandler.getExtension())) {
+            filename.append(".").append(artifactHandler.getExtension());
         }
         return filename.toString();
     }
 
-    public static String mojoExecutionKey( MojoExecution mojo )
-    {
-        return StringUtils.join( Arrays.asList(
-                StringUtils.defaultIfEmpty( mojo.getExecutionId(), "emptyExecId" ),
-                StringUtils.defaultIfEmpty( mojo.getGoal(), "emptyGoal" ),
-                StringUtils.defaultIfEmpty( mojo.getLifecyclePhase(), "emptyLifecyclePhase" ),
-                StringUtils.defaultIfEmpty( mojo.getArtifactId(), "emptyArtifactId" ),
-                StringUtils.defaultIfEmpty( mojo.getGroupId(), "emptyGroupId" ) ), ":" );
+    public static String mojoExecutionKey(MojoExecution mojo) {
+        return StringUtils.join(
+                Arrays.asList(
+                        StringUtils.defaultIfEmpty(mojo.getExecutionId(), "emptyExecId"),
+                        StringUtils.defaultIfEmpty(mojo.getGoal(), "emptyGoal"),
+                        StringUtils.defaultIfEmpty(mojo.getLifecyclePhase(), "emptyLifecyclePhase"),
+                        StringUtils.defaultIfEmpty(mojo.getArtifactId(), "emptyArtifactId"),
+                        StringUtils.defaultIfEmpty(mojo.getGroupId(), "emptyGroupId")),
+                ":");
     }
 
-    public static Path getMultimoduleRoot( MavenSession session )
-    {
+    public static Path getMultimoduleRoot(MavenSession session) {
         return session.getRequest().getMultiModuleProjectDirectory().toPath();
     }
 
-    public static Scm readGitInfo( MavenSession session ) throws IOException
-    {
+    public static Scm readGitInfo(MavenSession session) throws IOException {
         final Scm scmCandidate = new Scm();
-        final Path gitDir = getMultimoduleRoot( session ).resolve( ".git" );
-        if ( Files.isDirectory( gitDir ) )
-        {
-            final Path headFile = gitDir.resolve( "HEAD" );
-            if ( Files.exists( headFile ) )
-            {
-                String headRef = readFirstLine( headFile, "<missing branch>" );
-                if ( headRef.startsWith( "ref: " ) )
-                {
-                    String branch = trim( removeStart( headRef, "ref: " ) );
-                    scmCandidate.setSourceBranch( branch );
-                    final Path refPath = gitDir.resolve( branch );
-                    if ( Files.exists( refPath ) )
-                    {
-                        String revision = readFirstLine( refPath, "<missing revision>" );
-                        scmCandidate.setRevision( trim( revision ) );
+        final Path gitDir = getMultimoduleRoot(session).resolve(".git");
+        if (Files.isDirectory(gitDir)) {
+            final Path headFile = gitDir.resolve("HEAD");
+            if (Files.exists(headFile)) {
+                String headRef = readFirstLine(headFile, "<missing branch>");
+                if (headRef.startsWith("ref: ")) {
+                    String branch = trim(removeStart(headRef, "ref: "));
+                    scmCandidate.setSourceBranch(branch);
+                    final Path refPath = gitDir.resolve(branch);
+                    if (Files.exists(refPath)) {
+                        String revision = readFirstLine(refPath, "<missing revision>");
+                        scmCandidate.setRevision(trim(revision));
                     }
-                }
-                else
-                {
-                    scmCandidate.setSourceBranch( headRef );
-                    scmCandidate.setRevision( headRef );
+                } else {
+                    scmCandidate.setSourceBranch(headRef);
+                    scmCandidate.setRevision(headRef);
                 }
             }
         }
         return scmCandidate;
     }
 
-    private static String readFirstLine( Path path, String defaultValue ) throws IOException
-    {
-        return Files.lines( path, StandardCharsets.UTF_8 ).findFirst().orElse( defaultValue );
+    private static String readFirstLine(Path path, String defaultValue) throws IOException {
+        return Files.lines(path, StandardCharsets.UTF_8).findFirst().orElse(defaultValue);
     }
 
-    public static <T> T getLast( List<T> list )
-    {
+    public static <T> T getLast(List<T> list) {
         int size = list.size();
-        if ( size > 0 )
-        {
-            return list.get( size - 1 );
+        if (size > 0) {
+            return list.get(size - 1);
         }
         throw new NoSuchElementException();
     }
 
-    public static <T> T getOrCreate( MavenSession session, Object key, Supplier<T> supplier )
-    {
+    public static <T> T getOrCreate(MavenSession session, Object key, Supplier<T> supplier) {
         SessionData data = session.getRepositorySession().getData();
-        while ( true )
-        {
-            T t = ( T ) data.get( key );
-            if ( t == null )
-            {
+        while (true) {
+            T t = (T) data.get(key);
+            if (t == null) {
                 t = supplier.get();
-                if ( data.set( key, null, t ) )
-                {
+                if (data.set(key, null, t)) {
                     continue;
                 }
             }
@@ -173,79 +152,62 @@ public class CacheUtils
         }
     }
 
-    public static boolean isArchive( File file )
-    {
+    public static boolean isArchive(File file) {
         String fileName = file.getName();
-        if ( !file.isFile() || file.isHidden() )
-        {
+        if (!file.isFile() || file.isHidden()) {
             return false;
         }
-        return StringUtils.endsWithAny( fileName, ".jar", ".zip", ".war", ".ear" );
+        return StringUtils.endsWithAny(fileName, ".jar", ".zip", ".war", ".ear");
     }
 
-    public static void zip( Path dir, Path zip ) throws IOException
-    {
-        try ( ZipOutputStream zipOutputStream = new ZipOutputStream( Files.newOutputStream( zip ) ) )
-        {
-            Files.walkFileTree( dir, new SimpleFileVisitor<Path>()
-            {
+    public static void zip(Path dir, Path zip) throws IOException {
+        try (ZipOutputStream zipOutputStream = new ZipOutputStream(Files.newOutputStream(zip))) {
+            Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
 
                 @Override
-                public FileVisitResult visitFile( Path path, BasicFileAttributes basicFileAttributes )
-                        throws IOException
-                {
-                    final ZipEntry zipEntry = new ZipEntry( dir.relativize( path ).toString() );
-                    zipOutputStream.putNextEntry( zipEntry );
-                    Files.copy( path, zipOutputStream );
+                public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes)
+                        throws IOException {
+                    final ZipEntry zipEntry = new ZipEntry(dir.relativize(path).toString());
+                    zipOutputStream.putNextEntry(zipEntry);
+                    Files.copy(path, zipOutputStream);
                     zipOutputStream.closeEntry();
                     return FileVisitResult.CONTINUE;
                 }
-            } );
+            });
         }
     }
 
-    public static void unzip( Path zip, Path out ) throws IOException
-    {
-        try ( ZipInputStream zis = new ZipInputStream( Files.newInputStream( zip ) ) )
-        {
+    public static void unzip(Path zip, Path out) throws IOException {
+        try (ZipInputStream zis = new ZipInputStream(Files.newInputStream(zip))) {
             ZipEntry entry = zis.getNextEntry();
-            while ( entry != null )
-            {
-                Path file = out.resolve( entry.getName() );
-                if ( !file.normalize().startsWith( out.normalize() ) )
-                {
-                    throw new RuntimeException( "Bad zip entry" );
+            while (entry != null) {
+                Path file = out.resolve(entry.getName());
+                if (!file.normalize().startsWith(out.normalize())) {
+                    throw new RuntimeException("Bad zip entry");
                 }
-                if ( entry.isDirectory() )
-                {
-                    Files.createDirectory( file );
-                }
-                else
-                {
+                if (entry.isDirectory()) {
+                    Files.createDirectory(file);
+                } else {
                     Path parent = file.getParent();
-                    Files.createDirectories( parent );
-                    Files.copy( zis, file );
+                    Files.createDirectories(parent);
+                    Files.copy(zis, file);
                 }
-                Files.setLastModifiedTime( file, FileTime.fromMillis( entry.getTime() ) );
+                Files.setLastModifiedTime(file, FileTime.fromMillis(entry.getTime()));
                 entry = zis.getNextEntry();
             }
         }
     }
 
-    public static <T> void debugPrintCollection( Logger logger, Collection<T> values, String heading,
-            String elementCaption )
-    {
-        if ( logger.isDebugEnabled() && values != null && !values.isEmpty() )
-        {
+    public static <T> void debugPrintCollection(
+            Logger logger, Collection<T> values, String heading, String elementCaption) {
+        if (logger.isDebugEnabled() && values != null && !values.isEmpty()) {
             final int size = values.size();
             int i = 0;
-            logger.debug( "{} (total {})", heading, size );
-            for ( T value : values )
-            {
+            logger.debug("{} (total {})", heading, size);
+            for (T value : values) {
                 i++;
-                logger.debug( "{} {} of {} : {}", elementCaption, i, size, value );
+                logger.debug("{} {} of {} : {}", elementCaption, i, size, value);
             }
         }
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/ChainedListener.java b/src/main/java/org/apache/maven/buildcache/ChainedListener.java
index 248566c..34fd2fa 100644
--- a/src/main/java/org/apache/maven/buildcache/ChainedListener.java
+++ b/src/main/java/org/apache/maven/buildcache/ChainedListener.java
@@ -19,144 +19,124 @@
 package org.apache.maven.buildcache;
 
 import java.util.concurrent.CopyOnWriteArrayList;
+
 import org.apache.maven.execution.AbstractExecutionListener;
 import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.ExecutionListener;
 
-class ChainedListener extends AbstractExecutionListener
-{
+class ChainedListener extends AbstractExecutionListener {
 
     private final ExecutionListener delegate;
 
     private final CopyOnWriteArrayList<ExecutionListener> chainedListeners = new CopyOnWriteArrayList<>();
 
-    ChainedListener( ExecutionListener delegate )
-    {
+    ChainedListener(ExecutionListener delegate) {
         this.delegate = delegate;
     }
 
-    public boolean chainListener( ExecutionListener listener )
-    {
-        return chainedListeners.addIfAbsent( listener );
+    public boolean chainListener(ExecutionListener listener) {
+        return chainedListeners.addIfAbsent(listener);
     }
 
     @Override
-    public void projectDiscoveryStarted( ExecutionEvent event )
-    {
-        delegate.projectDiscoveryStarted( event );
-        chainedListeners.forEach( listener -> listener.projectDiscoveryStarted( event ) );
+    public void projectDiscoveryStarted(ExecutionEvent event) {
+        delegate.projectDiscoveryStarted(event);
+        chainedListeners.forEach(listener -> listener.projectDiscoveryStarted(event));
     }
 
     @Override
-    public void sessionStarted( ExecutionEvent event )
-    {
-        delegate.sessionStarted( event );
-        chainedListeners.forEach( listener -> listener.sessionStarted( event ) );
+    public void sessionStarted(ExecutionEvent event) {
+        delegate.sessionStarted(event);
+        chainedListeners.forEach(listener -> listener.sessionStarted(event));
     }
 
     @Override
-    public void sessionEnded( ExecutionEvent event )
-    {
-        delegate.sessionEnded( event );
-        chainedListeners.forEach( listener -> listener.sessionEnded( event ) );
+    public void sessionEnded(ExecutionEvent event) {
+        delegate.sessionEnded(event);
+        chainedListeners.forEach(listener -> listener.sessionEnded(event));
     }
 
     @Override
-    public void projectSkipped( ExecutionEvent event )
-    {
-        delegate.projectSkipped( event );
-        chainedListeners.forEach( listener -> listener.projectSkipped( event ) );
+    public void projectSkipped(ExecutionEvent event) {
+        delegate.projectSkipped(event);
+        chainedListeners.forEach(listener -> listener.projectSkipped(event));
     }
 
     @Override
-    public void projectStarted( ExecutionEvent event )
-    {
-        delegate.projectStarted( event );
-        chainedListeners.forEach( listener -> listener.projectStarted( event ) );
+    public void projectStarted(ExecutionEvent event) {
+        delegate.projectStarted(event);
+        chainedListeners.forEach(listener -> listener.projectStarted(event));
     }
 
     @Override
-    public void projectSucceeded( ExecutionEvent event )
-    {
-        delegate.projectSucceeded( event );
-        chainedListeners.forEach( listener -> listener.projectSucceeded( event ) );
+    public void projectSucceeded(ExecutionEvent event) {
+        delegate.projectSucceeded(event);
+        chainedListeners.forEach(listener -> listener.projectSucceeded(event));
     }
 
     @Override
-    public void projectFailed( ExecutionEvent event )
-    {
-        delegate.projectFailed( event );
-        chainedListeners.forEach( listener -> listener.projectFailed( event ) );
+    public void projectFailed(ExecutionEvent event) {
+        delegate.projectFailed(event);
+        chainedListeners.forEach(listener -> listener.projectFailed(event));
     }
 
     @Override
-    public void forkStarted( ExecutionEvent event )
-    {
-        delegate.forkStarted( event );
-        chainedListeners.forEach( listener -> listener.forkStarted( event ) );
+    public void forkStarted(ExecutionEvent event) {
+        delegate.forkStarted(event);
+        chainedListeners.forEach(listener -> listener.forkStarted(event));
     }
 
     @Override
-    public void forkSucceeded( ExecutionEvent event )
-    {
-        delegate.forkSucceeded( event );
-        chainedListeners.forEach( listener -> listener.forkSucceeded( event ) );
+    public void forkSucceeded(ExecutionEvent event) {
+        delegate.forkSucceeded(event);
+        chainedListeners.forEach(listener -> listener.forkSucceeded(event));
     }
 
     @Override
-    public void forkFailed( ExecutionEvent event )
-    {
-        delegate.forkFailed( event );
-        chainedListeners.forEach( listener -> listener.forkFailed( event ) );
+    public void forkFailed(ExecutionEvent event) {
+        delegate.forkFailed(event);
+        chainedListeners.forEach(listener -> listener.forkFailed(event));
     }
 
     @Override
-    public void mojoSkipped( ExecutionEvent event )
-    {
-        delegate.mojoSkipped( event );
-        chainedListeners.forEach( listener -> listener.mojoSkipped( event ) );
+    public void mojoSkipped(ExecutionEvent event) {
+        delegate.mojoSkipped(event);
+        chainedListeners.forEach(listener -> listener.mojoSkipped(event));
     }
 
     @Override
-    public void mojoStarted( ExecutionEvent event )
-    {
-        delegate.mojoStarted( event );
-        chainedListeners.forEach( listener -> listener.mojoStarted( event ) );
+    public void mojoStarted(ExecutionEvent event) {
+        delegate.mojoStarted(event);
+        chainedListeners.forEach(listener -> listener.mojoStarted(event));
     }
 
     @Override
-    public void mojoSucceeded( ExecutionEvent event )
-    {
-        delegate.mojoSucceeded( event );
-        chainedListeners.forEach( listener -> listener.mojoSucceeded( event ) );
+    public void mojoSucceeded(ExecutionEvent event) {
+        delegate.mojoSucceeded(event);
+        chainedListeners.forEach(listener -> listener.mojoSucceeded(event));
     }
 
     @Override
-    public void mojoFailed( ExecutionEvent event )
-    {
-        delegate.mojoFailed( event );
-        chainedListeners.forEach( listener -> listener.mojoFailed( event ) );
+    public void mojoFailed(ExecutionEvent event) {
+        delegate.mojoFailed(event);
+        chainedListeners.forEach(listener -> listener.mojoFailed(event));
     }
 
     @Override
-    public void forkedProjectStarted( ExecutionEvent event )
-    {
-        delegate.forkedProjectStarted( event );
-        chainedListeners.forEach( listener -> listener.forkedProjectStarted( event ) );
+    public void forkedProjectStarted(ExecutionEvent event) {
+        delegate.forkedProjectStarted(event);
+        chainedListeners.forEach(listener -> listener.forkedProjectStarted(event));
     }
 
     @Override
-    public void forkedProjectSucceeded( ExecutionEvent event )
-    {
-        delegate.forkedProjectSucceeded( event );
-        chainedListeners.forEach( listener -> listener.forkedProjectSucceeded( event ) );
+    public void forkedProjectSucceeded(ExecutionEvent event) {
+        delegate.forkedProjectSucceeded(event);
+        chainedListeners.forEach(listener -> listener.forkedProjectSucceeded(event));
     }
 
     @Override
-    public void forkedProjectFailed( ExecutionEvent event )
-    {
-        delegate.forkedProjectFailed( event );
-        chainedListeners.forEach( listener -> listener.forkedProjectFailed( event ) );
+    public void forkedProjectFailed(ExecutionEvent event) {
+        delegate.forkedProjectFailed(event);
+        chainedListeners.forEach(listener -> listener.forkedProjectFailed(event));
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/DefaultMultiModuleSupport.java b/src/main/java/org/apache/maven/buildcache/DefaultMultiModuleSupport.java
index e40924c..7693b3d 100644
--- a/src/main/java/org/apache/maven/buildcache/DefaultMultiModuleSupport.java
+++ b/src/main/java/org/apache/maven/buildcache/DefaultMultiModuleSupport.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,6 +18,9 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -30,8 +33,7 @@ import java.util.Set;
 import java.util.TreeSet;
 import java.util.function.Function;
 import java.util.stream.Collectors;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.maven.SessionScoped;
 import org.apache.maven.buildcache.checksum.KeyUtils;
 import org.apache.maven.buildcache.xml.CacheConfig;
@@ -49,10 +51,9 @@ import org.slf4j.LoggerFactory;
 
 @SessionScoped
 @Named
-public class DefaultMultiModuleSupport implements MultiModuleSupport
-{
+public class DefaultMultiModuleSupport implements MultiModuleSupport {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( DefaultMultiModuleSupport.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultMultiModuleSupport.class);
 
     private final ProjectBuilder projectBuilder;
     private final CacheConfig cacheConfig;
@@ -63,156 +64,126 @@ public class DefaultMultiModuleSupport implements MultiModuleSupport
     private volatile Map<String, MavenProject> sessionProjectMap;
 
     @Inject
-    public DefaultMultiModuleSupport( ProjectBuilder projectBuilder,
-            CacheConfig cacheConfig,
-            MavenSession session )
-    {
+    public DefaultMultiModuleSupport(ProjectBuilder projectBuilder, CacheConfig cacheConfig, MavenSession session) {
         this.projectBuilder = projectBuilder;
         this.cacheConfig = cacheConfig;
         this.session = session;
     }
 
     @Override
-    public boolean isPartOfSession( String groupId, String artifactId, String version )
-    {
-        return getProjectMap( session )
-                .containsKey( KeyUtils.getProjectKey( groupId, artifactId, version ) );
+    public boolean isPartOfSession(String groupId, String artifactId, String version) {
+        return getProjectMap(session).containsKey(KeyUtils.getProjectKey(groupId, artifactId, version));
     }
 
     @Override
-    public Optional<MavenProject> tryToResolveProject( String groupId, String artifactId, String version )
-    {
-        return Optional.ofNullable( getMultiModuleProjectsMap()
-                .get( KeyUtils.getProjectKey( groupId, artifactId, version ) ) );
+    public Optional<MavenProject> tryToResolveProject(String groupId, String artifactId, String version) {
+        return Optional.ofNullable(
+                getMultiModuleProjectsMap().get(KeyUtils.getProjectKey(groupId, artifactId, version)));
     }
 
     @Override
-    public boolean isPartOfMultiModule( String groupId, String artifactId, String version )
-    {
-        String projectKey = KeyUtils.getProjectKey( groupId, artifactId, version );
-        return getProjectMap( session ).containsKey( projectKey )
-                || getMultiModuleProjectsMap().containsKey( projectKey );
+    public boolean isPartOfMultiModule(String groupId, String artifactId, String version) {
+        String projectKey = KeyUtils.getProjectKey(groupId, artifactId, version);
+        return getProjectMap(session).containsKey(projectKey)
+                || getMultiModuleProjectsMap().containsKey(projectKey);
     }
 
-    private Map<String, MavenProject> getProjectMap( MavenSession session )
-    {
-        if ( sessionProjectMap != null )
-        {
+    private Map<String, MavenProject> getProjectMap(MavenSession session) {
+        if (sessionProjectMap != null) {
             return sessionProjectMap;
         }
-        sessionProjectMap = session.getProjects().stream().collect( Collectors.toMap(
-                KeyUtils::getProjectKey,
-                Function.identity() ) );
+        sessionProjectMap =
+                session.getProjects().stream().collect(Collectors.toMap(KeyUtils::getProjectKey, Function.identity()));
         return sessionProjectMap;
     }
 
-    private Map<String, MavenProject> getMultiModuleProjectsMap()
-    {
-        if ( projectMap != null )
-        {
+    private Map<String, MavenProject> getMultiModuleProjectsMap() {
+        if (projectMap != null) {
             return projectMap;
         }
-        return getMultiModuleProjectsMapInner( session );
+        return getMultiModuleProjectsMapInner(session);
     }
 
-    private synchronized Map<String, MavenProject> getMultiModuleProjectsMapInner( MavenSession session )
-    {
-        if ( projectMap != null )
-        {
+    private synchronized Map<String, MavenProject> getMultiModuleProjectsMapInner(MavenSession session) {
+        if (projectMap != null) {
             return projectMap;
         }
-        buildModel( session );
+        buildModel(session);
         return projectMap;
     }
 
-    private synchronized void buildModel( MavenSession session )
-    {
-        if ( built )
-        {
+    private synchronized void buildModel(MavenSession session) {
+        if (built) {
             return;
         }
 
-        Optional<Discovery> multiModuleDiscovery = Optional.ofNullable( cacheConfig.getMultiModule() )
-                .map( MultiModule::getDiscovery );
+        Optional<Discovery> multiModuleDiscovery =
+                Optional.ofNullable(cacheConfig.getMultiModule()).map(MultiModule::getDiscovery);
 
-        //no discovery configuration, use only projects in session
-        if ( !multiModuleDiscovery.isPresent() )
-        {
-            projectMap = buildProjectMap( session.getProjects() );
+        // no discovery configuration, use only projects in session
+        if (!multiModuleDiscovery.isPresent()) {
+            projectMap = buildProjectMap(session.getProjects());
             return;
         }
 
         Set<String> scanProfiles = new TreeSet<>(
-                multiModuleDiscovery
-                        .map( Discovery::getScanProfiles )
-                        .orElse( Collections.emptyList() ) );
+                multiModuleDiscovery.map(Discovery::getScanProfiles).orElse(Collections.emptyList()));
         MavenProject currentProject = session.getCurrentProject();
-        File multiModulePomFile = getMultiModulePomFile( session );
+        File multiModulePomFile = getMultiModulePomFile(session);
 
         ProjectBuildingRequest projectBuildingRequest = currentProject.getProjectBuildingRequest();
-        boolean profilesMatched = projectBuildingRequest.getActiveProfileIds().containsAll( scanProfiles );
+        boolean profilesMatched = projectBuildingRequest.getActiveProfileIds().containsAll(scanProfiles);
 
-        //we are building from root with the same profiles, no need to re-scan the whole multi-module project
-        if ( currentProject.getFile().getAbsolutePath().equals( multiModulePomFile.getAbsolutePath() )
-                && profilesMatched )
-        {
-            projectMap = buildProjectMap( session.getProjects() );
+        // we are building from root with the same profiles, no need to re-scan the whole multi-module project
+        if (currentProject.getFile().getAbsolutePath().equals(multiModulePomFile.getAbsolutePath())
+                && profilesMatched) {
+            projectMap = buildProjectMap(session.getProjects());
             return;
         }
 
         long t0 = System.currentTimeMillis();
 
-        ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest( projectBuildingRequest );
-        //clear properties because after first build request some properties could be set to profiles
-        //these properties could change effective pom when we try to rebuild whole multi module project again
-        //for example the first model build process do not resolve ${os.detected.classifier}
-        //but once build completed this property is set to profile
-        //if we try to rebuild model for the whole project here string interpolator replaces this value
-        //and effective pom could be different (depending on OS) if this property is used in pom.xml
-        buildingRequest.setProfiles(
-                buildingRequest.getProfiles().stream()
-                        .peek( it -> it.setProperties( new Properties() ) )
-                        .collect( Collectors.toList() ) );
-        if ( !profilesMatched )
-        {
-            Set<String> profiles = new LinkedHashSet<>( buildingRequest.getActiveProfileIds() );
-            //remove duplicates
-            profiles.addAll( scanProfiles );
-            buildingRequest.setActiveProfileIds( new ArrayList<>( profiles ) );
-        }
-        try
-        {
-            List<ProjectBuildingResult> buildingResults = projectBuilder.build(
-                    Collections.singletonList( multiModulePomFile ),
-                    true,
-                    buildingRequest );
-            LOGGER.info( "Multi module project model calculated [activeProfiles={}, time={} ms ",
-                    buildingRequest.getActiveProfileIds(), System.currentTimeMillis() - t0 );
-
-            List<MavenProject> projectList = buildingResults.stream().map( ProjectBuildingResult::getProject )
-                    .collect( Collectors.toList() );
-            projectMap = buildProjectMap( projectList );
-
-        }
-        catch ( ProjectBuildingException e )
-        {
-            LOGGER.error( "Unable to build model", e );
+        ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(projectBuildingRequest);
+        // clear properties because after first build request some properties could be set to profiles
+        // these properties could change effective pom when we try to rebuild whole multi module project again
+        // for example the first model build process do not resolve ${os.detected.classifier}
+        // but once build completed this property is set to profile
+        // if we try to rebuild model for the whole project here string interpolator replaces this value
+        // and effective pom could be different (depending on OS) if this property is used in pom.xml
+        buildingRequest.setProfiles(buildingRequest.getProfiles().stream()
+                .peek(it -> it.setProperties(new Properties()))
+                .collect(Collectors.toList()));
+        if (!profilesMatched) {
+            Set<String> profiles = new LinkedHashSet<>(buildingRequest.getActiveProfileIds());
+            // remove duplicates
+            profiles.addAll(scanProfiles);
+            buildingRequest.setActiveProfileIds(new ArrayList<>(profiles));
         }
-        finally
-        {
+        try {
+            List<ProjectBuildingResult> buildingResults =
+                    projectBuilder.build(Collections.singletonList(multiModulePomFile), true, buildingRequest);
+            LOGGER.info(
+                    "Multi module project model calculated [activeProfiles={}, time={} ms ",
+                    buildingRequest.getActiveProfileIds(),
+                    System.currentTimeMillis() - t0);
+
+            List<MavenProject> projectList = buildingResults.stream()
+                    .map(ProjectBuildingResult::getProject)
+                    .collect(Collectors.toList());
+            projectMap = buildProjectMap(projectList);
+
+        } catch (ProjectBuildingException e) {
+            LOGGER.error("Unable to build model", e);
+        } finally {
             built = true;
         }
     }
 
-    private Map<String, MavenProject> buildProjectMap( List<MavenProject> projectList )
-    {
-        return projectList.stream().collect( Collectors.toMap(
-                KeyUtils::getProjectKey,
-                Function.identity() ) );
+    private Map<String, MavenProject> buildProjectMap(List<MavenProject> projectList) {
+        return projectList.stream().collect(Collectors.toMap(KeyUtils::getProjectKey, Function.identity()));
     }
 
-    private static File getMultiModulePomFile( MavenSession session )
-    {
-        return CacheUtils.getMultimoduleRoot( session ).resolve( "pom.xml" ).toFile();
+    private static File getMultiModulePomFile(MavenSession session) {
+        return CacheUtils.getMultimoduleRoot(session).resolve("pom.xml").toFile();
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/DefaultNormalizedModelProvider.java b/src/main/java/org/apache/maven/buildcache/DefaultNormalizedModelProvider.java
index 35df7f1..128572a 100644
--- a/src/main/java/org/apache/maven/buildcache/DefaultNormalizedModelProvider.java
+++ b/src/main/java/org/apache/maven/buildcache/DefaultNormalizedModelProvider.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,14 +18,16 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.stream.Collectors;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.maven.SessionScoped;
 import org.apache.maven.buildcache.xml.CacheConfig;
 import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
@@ -40,145 +42,125 @@ import org.slf4j.LoggerFactory;
 
 @SessionScoped
 @Named
-public class DefaultNormalizedModelProvider implements NormalizedModelProvider
-{
+public class DefaultNormalizedModelProvider implements NormalizedModelProvider {
 
     private static final String NORMALIZED_VERSION = "cache-extension-version";
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( DefaultNormalizedModelProvider.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultNormalizedModelProvider.class);
 
     private final CacheConfig cacheConfig;
     private final MultiModuleSupport multiModuleSupport;
     private final ConcurrentMap<String, Model> modelCache = new ConcurrentHashMap<>();
 
     @Inject
-    public DefaultNormalizedModelProvider( MultiModuleSupport multiModuleSupport, CacheConfig cacheConfig )
-    {
+    public DefaultNormalizedModelProvider(MultiModuleSupport multiModuleSupport, CacheConfig cacheConfig) {
         this.multiModuleSupport = multiModuleSupport;
         this.cacheConfig = cacheConfig;
     }
 
     @Override
-    public Model normalizedModel( MavenProject project )
-    {
-        MavenProject validatedProject = Objects.requireNonNull( project, "project" );
-        return modelCache.computeIfAbsent( BuilderCommon.getKey( validatedProject ),
-                k -> normalizedModelInner( validatedProject ) );
+    public Model normalizedModel(MavenProject project) {
+        MavenProject validatedProject = Objects.requireNonNull(project, "project");
+        return modelCache.computeIfAbsent(
+                BuilderCommon.getKey(validatedProject), k -> normalizedModelInner(validatedProject));
     }
 
-    private Model normalizedModelInner( MavenProject project )
-    {
-        //prefer project from multimodule than reactor because effective pom of reactor project
-        //could be built with maven local/remote dependencies but not with artifacts from cache
-        MavenProject projectToNormalize = multiModuleSupport.tryToResolveProject(
-                project.getGroupId(),
-                project.getArtifactId(),
-                project.getVersion() )
-                .orElse( project );
+    private Model normalizedModelInner(MavenProject project) {
+        // prefer project from multimodule than reactor because effective pom of reactor project
+        // could be built with maven local/remote dependencies but not with artifacts from cache
+        MavenProject projectToNormalize = multiModuleSupport
+                .tryToResolveProject(project.getGroupId(), project.getArtifactId(), project.getVersion())
+                .orElse(project);
         Model prototype = projectToNormalize.getModel();
 
-        //TODO validate status of the model - it should be in resolved state
+        // TODO validate status of the model - it should be in resolved state
         Model resultModel = new Model();
 
-        resultModel.setGroupId( prototype.getGroupId() );
-        resultModel.setArtifactId( prototype.getArtifactId() );
-        //does not make sense to add project version to calculate hash
-        resultModel.setVersion( NORMALIZED_VERSION );
-        resultModel.setModules( prototype.getModules() );
+        resultModel.setGroupId(prototype.getGroupId());
+        resultModel.setArtifactId(prototype.getArtifactId());
+        // does not make sense to add project version to calculate hash
+        resultModel.setVersion(NORMALIZED_VERSION);
+        resultModel.setModules(prototype.getModules());
 
-        resultModel.setDependencies( normalizeDependencies( prototype.getDependencies() ) );
+        resultModel.setDependencies(normalizeDependencies(prototype.getDependencies()));
 
         org.apache.maven.model.Build protoBuild = prototype.getBuild();
-        if ( protoBuild == null )
-        {
+        if (protoBuild == null) {
             return resultModel;
         }
 
         Build build = new Build();
         List<Plugin> plugins = prototype.getBuild().getPlugins();
-        build.setPlugins( normalizePlugins( plugins ) );
-        resultModel.setBuild( build );
+        build.setPlugins(normalizePlugins(plugins));
+        resultModel.setBuild(build);
         return resultModel;
     }
 
-    private List<Dependency> normalizeDependencies( Collection<Dependency> source )
-    {
-        return source.stream().map( it ->
-        {
-            if ( !multiModuleSupport.isPartOfMultiModule( it.getGroupId(), it.getArtifactId(), it.getVersion() ) )
-            {
-                return it;
-            }
-            Dependency cloned = it.clone();
-            cloned.setVersion( NORMALIZED_VERSION );
-            return cloned;
-        } ).sorted( DefaultNormalizedModelProvider::compareDependencies ).collect( Collectors.toList() );
+    private List<Dependency> normalizeDependencies(Collection<Dependency> source) {
+        return source.stream()
+                .map(it -> {
+                    if (!multiModuleSupport.isPartOfMultiModule(it.getGroupId(), it.getArtifactId(), it.getVersion())) {
+                        return it;
+                    }
+                    Dependency cloned = it.clone();
+                    cloned.setVersion(NORMALIZED_VERSION);
+                    return cloned;
+                })
+                .sorted(DefaultNormalizedModelProvider::compareDependencies)
+                .collect(Collectors.toList());
     }
 
-    private List<Plugin> normalizePlugins( List<Plugin> plugins )
-    {
-        if ( plugins.isEmpty() )
-        {
+    private List<Plugin> normalizePlugins(List<Plugin> plugins) {
+        if (plugins.isEmpty()) {
             return plugins;
         }
 
-        return plugins.stream().map(
-                plugin ->
-                {
+        return plugins.stream()
+                .map(plugin -> {
                     Plugin copy = plugin.clone();
-                    List<String> excludeProperties = cacheConfig.getEffectivePomExcludeProperties( copy );
-                    if ( !excludeProperties.isEmpty() )
-                    {
-                        CacheUtils.debugPrintCollection( LOGGER, excludeProperties,
-                                String.format( "List of excluded properties for %s", copy.getArtifactId() ),
-                                "Excluded property" );
-                        removeBlacklistedAttributes( copy.getConfiguration(), excludeProperties );
-                        for ( PluginExecution execution : copy.getExecutions() )
-                        {
-                            removeBlacklistedAttributes( execution.getConfiguration(), excludeProperties );
+                    List<String> excludeProperties = cacheConfig.getEffectivePomExcludeProperties(copy);
+                    if (!excludeProperties.isEmpty()) {
+                        CacheUtils.debugPrintCollection(
+                                LOGGER,
+                                excludeProperties,
+                                String.format("List of excluded properties for %s", copy.getArtifactId()),
+                                "Excluded property");
+                        removeBlacklistedAttributes(copy.getConfiguration(), excludeProperties);
+                        for (PluginExecution execution : copy.getExecutions()) {
+                            removeBlacklistedAttributes(execution.getConfiguration(), excludeProperties);
                         }
                     }
 
-                    copy.setDependencies(
-                            normalizeDependencies(
-                                    copy.getDependencies()
-                                            .stream()
-                                            .sorted( DefaultNormalizedModelProvider::compareDependencies )
-                                            .collect( Collectors.toList() ) ) );
-                    if ( multiModuleSupport.isPartOfMultiModule(
-                            copy.getGroupId(),
-                            copy.getArtifactId(),
-                            copy.getVersion() ) )
-                    {
-                        copy.setVersion( NORMALIZED_VERSION );
+                    copy.setDependencies(normalizeDependencies(copy.getDependencies().stream()
+                            .sorted(DefaultNormalizedModelProvider::compareDependencies)
+                            .collect(Collectors.toList())));
+                    if (multiModuleSupport.isPartOfMultiModule(
+                            copy.getGroupId(), copy.getArtifactId(), copy.getVersion())) {
+                        copy.setVersion(NORMALIZED_VERSION);
                     }
                     return copy;
-                } ).collect( Collectors.toList() );
+                })
+                .collect(Collectors.toList());
     }
 
-    private void removeBlacklistedAttributes( Object node, List<String> excludeProperties )
-    {
-        if ( node == null )
-        {
+    private void removeBlacklistedAttributes(Object node, List<String> excludeProperties) {
+        if (node == null) {
             return;
         }
 
-        Object[] children = Xpp3DomUtils.getChildren( node );
+        Object[] children = Xpp3DomUtils.getChildren(node);
         int indexToRemove = 0;
-        for ( Object child : children )
-        {
-            if ( excludeProperties.contains( Xpp3DomUtils.getName( child ) ) )
-            {
-                Xpp3DomUtils.removeChild( node, indexToRemove );
+        for (Object child : children) {
+            if (excludeProperties.contains(Xpp3DomUtils.getName(child))) {
+                Xpp3DomUtils.removeChild(node, indexToRemove);
                 continue;
             }
             indexToRemove++;
-            removeBlacklistedAttributes( child, excludeProperties );
+            removeBlacklistedAttributes(child, excludeProperties);
         }
     }
 
-    private static int compareDependencies( Dependency d1, Dependency d2 )
-    {
-        return d1.getArtifactId().compareTo( d2.getArtifactId() );
+    private static int compareDependencies(Dependency d1, Dependency d2) {
+        return d1.getArtifactId().compareTo(d2.getArtifactId());
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/DefaultPluginScanConfig.java b/src/main/java/org/apache/maven/buildcache/DefaultPluginScanConfig.java
index 08b0d46..e266386 100644
--- a/src/main/java/org/apache/maven/buildcache/DefaultPluginScanConfig.java
+++ b/src/main/java/org/apache/maven/buildcache/DefaultPluginScanConfig.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -19,43 +19,38 @@
 package org.apache.maven.buildcache;
 
 import javax.annotation.Nonnull;
+
 import org.apache.maven.buildcache.xml.config.DirScanConfig;
 
 /**
  * DefaultPluginScanConfig
  */
-public class DefaultPluginScanConfig implements PluginScanConfig
-{
+public class DefaultPluginScanConfig implements PluginScanConfig {
 
     @Override
-    public boolean isSkip()
-    {
+    public boolean isSkip() {
         return false;
     }
 
     @Override
-    public boolean accept( String propertyName )
-    {
+    public boolean accept(String propertyName) {
         return true;
     }
 
     @Override
     @Nonnull
-    public PluginScanConfig mergeWith( PluginScanConfig overrideSource )
-    {
+    public PluginScanConfig mergeWith(PluginScanConfig overrideSource) {
         return overrideSource;
     }
 
     @Nonnull
     @Override
-    public ScanConfigProperties getTagScanProperties( String tagName )
-    {
-        return new ScanConfigProperties( true, "*" );
+    public ScanConfigProperties getTagScanProperties(String tagName) {
+        return new ScanConfigProperties(true, "*");
     }
 
     @Override
-    public DirScanConfig dto()
-    {
+    public DirScanConfig dto() {
         return null;
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/DefaultProjectInputCalculator.java b/src/main/java/org/apache/maven/buildcache/DefaultProjectInputCalculator.java
index c775cfd..30bd052 100644
--- a/src/main/java/org/apache/maven/buildcache/DefaultProjectInputCalculator.java
+++ b/src/main/java/org/apache/maven/buildcache/DefaultProjectInputCalculator.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,12 +18,14 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.maven.SessionScoped;
 import org.apache.maven.buildcache.checksum.MavenProjectInput;
 import org.apache.maven.buildcache.xml.CacheConfig;
@@ -37,10 +39,9 @@ import org.slf4j.LoggerFactory;
 
 @SessionScoped
 @Named
-public class DefaultProjectInputCalculator implements ProjectInputCalculator
-{
+public class DefaultProjectInputCalculator implements ProjectInputCalculator {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( DefaultProjectInputCalculator.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultProjectInputCalculator.class);
 
     private final MavenSession mavenSession;
     private final RemoteCacheRepository remoteCache;
@@ -51,17 +52,16 @@ public class DefaultProjectInputCalculator implements ProjectInputCalculator
 
     private final ConcurrentMap<String, ProjectsInputInfo> checkSumMap = new ConcurrentHashMap<>();
 
-    private static final ThreadLocal<Set<String>> CURRENTLY_CALCULATING = ThreadLocal.withInitial(
-            LinkedHashSet::new );
+    private static final ThreadLocal<Set<String>> CURRENTLY_CALCULATING = ThreadLocal.withInitial(LinkedHashSet::new);
 
     @Inject
-    public DefaultProjectInputCalculator( MavenSession mavenSession,
+    public DefaultProjectInputCalculator(
+            MavenSession mavenSession,
             RemoteCacheRepository remoteCache,
             CacheConfig cacheConfig,
             RepositorySystem repoSystem,
             NormalizedModelProvider rawModelProvider,
-            MultiModuleSupport multiModuleSupport )
-    {
+            MultiModuleSupport multiModuleSupport) {
         this.mavenSession = mavenSession;
         this.remoteCache = remoteCache;
         this.cacheConfig = cacheConfig;
@@ -71,39 +71,32 @@ public class DefaultProjectInputCalculator implements ProjectInputCalculator
     }
 
     @Override
-    public ProjectsInputInfo calculateInput( MavenProject project )
-    {
-        LOGGER.info( "Going to calculate checksum for project [groupId=" + project.getGroupId()
-                + ", artifactId=" + project.getArtifactId() + "]" );
+    public ProjectsInputInfo calculateInput(MavenProject project) {
+        LOGGER.info("Going to calculate checksum for project [groupId=" + project.getGroupId() + ", artifactId="
+                + project.getArtifactId() + "]");
 
-        String key = BuilderCommon.getKey( project );
-        //NOTE: Do not use ConcurrentHashMap.computeIfAbsent() here because of recursive calls
-        //this could lead to runtime exception - IllegalStateException("Recursive update")
-        //in jdk 8 the result of attempt to modify items with the same hash code could lead to infinite loop
-        ProjectsInputInfo projectsInputInfo = checkSumMap.get( key );
-        if ( projectsInputInfo != null )
-        {
+        String key = BuilderCommon.getKey(project);
+        // NOTE: Do not use ConcurrentHashMap.computeIfAbsent() here because of recursive calls
+        // this could lead to runtime exception - IllegalStateException("Recursive update")
+        // in jdk 8 the result of attempt to modify items with the same hash code could lead to infinite loop
+        ProjectsInputInfo projectsInputInfo = checkSumMap.get(key);
+        if (projectsInputInfo != null) {
             return projectsInputInfo;
         }
-        projectsInputInfo = calculateInputInternal( key, project );
-        checkSumMap.put( key, projectsInputInfo );
+        projectsInputInfo = calculateInputInternal(key, project);
+        checkSumMap.put(key, projectsInputInfo);
         return projectsInputInfo;
-
     }
 
-    private ProjectsInputInfo calculateInputInternal( String key,
-            MavenProject project )
-    {
+    private ProjectsInputInfo calculateInputInternal(String key, MavenProject project) {
         Set<String> projectsSet = CURRENTLY_CALCULATING.get();
 
-        if ( !projectsSet.add( key ) )
-        {
-            throw new IllegalStateException( "Checksum for project is already calculating. "
+        if (!projectsSet.add(key)) {
+            throw new IllegalStateException("Checksum for project is already calculating. "
                     + "Is there a cyclic dependencies? [project=" + key
-                    + ", setOfCalculatingProjects=" + projectsSet + "]" );
+                    + ", setOfCalculatingProjects=" + projectsSet + "]");
         }
-        try
-        {
+        try {
             final MavenProjectInput input = new MavenProjectInput(
                     project,
                     normalizedModelProvider,
@@ -112,16 +105,12 @@ public class DefaultProjectInputCalculator implements ProjectInputCalculator
                     mavenSession,
                     cacheConfig,
                     repoSystem,
-                    remoteCache );
+                    remoteCache);
             return input.calculateChecksum();
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Failed to calculate checksums for " + project.getArtifactId(), e );
-        }
-        finally
-        {
-            projectsSet.remove( key );
+        } catch (Exception e) {
+            throw new RuntimeException("Failed to calculate checksums for " + project.getArtifactId(), e);
+        } finally {
+            projectsSet.remove(key);
         }
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/DefaultRestoredArtifactHandler.java b/src/main/java/org/apache/maven/buildcache/DefaultRestoredArtifactHandler.java
index 564fc0e..0742a30 100644
--- a/src/main/java/org/apache/maven/buildcache/DefaultRestoredArtifactHandler.java
+++ b/src/main/java/org/apache/maven/buildcache/DefaultRestoredArtifactHandler.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,6 +18,10 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -31,9 +35,7 @@ import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
+
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.maven.buildcache.xml.CacheConfig;
@@ -43,51 +45,48 @@ import org.slf4j.LoggerFactory;
 
 @Singleton
 @Named
-public class DefaultRestoredArtifactHandler implements RestoredArtifactHandler
-{
+public class DefaultRestoredArtifactHandler implements RestoredArtifactHandler {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( DefaultRestoredArtifactHandler.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultRestoredArtifactHandler.class);
     private static final String DIR_NAME = "cache-build-tmp";
 
     private final boolean adjustMetaInfVersion;
 
     @Inject
-    public DefaultRestoredArtifactHandler( CacheConfig cacheConfig )
-    {
+    public DefaultRestoredArtifactHandler(CacheConfig cacheConfig) {
         this.adjustMetaInfVersion = cacheConfig.adjustMetaInfVersion();
     }
 
     @Override
-    public Path adjustArchiveArtifactVersion( MavenProject project, String originalArtifactVersion, Path artifactFile )
-            throws IOException
-    {
-        if ( !adjustMetaInfVersion )
-        {
-            //option is disabled in cache configuration, return file as is
+    public Path adjustArchiveArtifactVersion(MavenProject project, String originalArtifactVersion, Path artifactFile)
+            throws IOException {
+        if (!adjustMetaInfVersion) {
+            // option is disabled in cache configuration, return file as is
             return artifactFile;
         }
 
         File file = artifactFile.toFile();
-        if ( project.getVersion().equals( originalArtifactVersion ) || !CacheUtils.isArchive( file ) )
-        {
-            //versions of artifact and building project are the same or this is not an archive, return file as is
+        if (project.getVersion().equals(originalArtifactVersion) || !CacheUtils.isArchive(file)) {
+            // versions of artifact and building project are the same or this is not an archive, return file as is
             return artifactFile;
         }
 
-        File tempDirName = Paths.get( project.getBuild().getDirectory() )
+        File tempDirName = Paths.get(project.getBuild().getDirectory())
                 .normalize()
-                .resolve( DIR_NAME )
+                .resolve(DIR_NAME)
                 .toFile();
-        if ( tempDirName.mkdirs() )
-        {
-            LOGGER.debug( "Temporary directory to restore artifact was created [artifactFile={}, "
-                    + "originalVersion={}, tempDir={}]",
-                    artifactFile, originalArtifactVersion, tempDirName );
+        if (tempDirName.mkdirs()) {
+            LOGGER.debug(
+                    "Temporary directory to restore artifact was created [artifactFile={}, "
+                            + "originalVersion={}, tempDir={}]",
+                    artifactFile,
+                    originalArtifactVersion,
+                    tempDirName);
         }
 
         String currentVersion = project.getVersion();
-        File tmpJarFile = File.createTempFile( artifactFile.toFile().getName(),
-                '.' + FilenameUtils.getExtension( file.getName() ), tempDirName );
+        File tmpJarFile = File.createTempFile(
+                artifactFile.toFile().getName(), '.' + FilenameUtils.getExtension(file.getName()), tempDirName);
         tmpJarFile.deleteOnExit();
         String originalImplVersion = Attributes.Name.IMPLEMENTATION_VERSION + ": " + originalArtifactVersion;
         String implVersion = Attributes.Name.IMPLEMENTATION_VERSION + ": " + currentVersion;
@@ -95,50 +94,41 @@ public class DefaultRestoredArtifactHandler implements RestoredArtifactHandler
         String commonXmlVersion = "<version>" + currentVersion + "</version>";
         String originalPomPropsVersion = "version=" + originalArtifactVersion;
         String pomPropsVersion = "version=" + currentVersion;
-        try ( JarFile jarFile = new JarFile( artifactFile.toFile() ) )
-        {
-            try ( JarOutputStream jos = new JarOutputStream(
-                    new BufferedOutputStream( new FileOutputStream( tmpJarFile ) ) ) )
-            {
-                //Copy original jar file to the temporary one.
+        try (JarFile jarFile = new JarFile(artifactFile.toFile())) {
+            try (JarOutputStream jos =
+                    new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpJarFile)))) {
+                // Copy original jar file to the temporary one.
                 Enumeration<JarEntry> jarEntries = jarFile.entries();
                 byte[] buffer = new byte[1024];
-                while ( jarEntries.hasMoreElements() )
-                {
+                while (jarEntries.hasMoreElements()) {
                     JarEntry entry = jarEntries.nextElement();
                     String entryName = entry.getName();
 
-                    if ( entryName.startsWith( "META-INF/maven" )
-                            && ( entryName.endsWith( "plugin.xml" ) || entryName.endsWith( "plugin-help.xml" ) ) )
-                    {
-                        replaceEntry( jarFile, entry, commonXmlOriginalVersion, commonXmlVersion, jos );
+                    if (entryName.startsWith("META-INF/maven")
+                            && (entryName.endsWith("plugin.xml") || entryName.endsWith("plugin-help.xml"))) {
+                        replaceEntry(jarFile, entry, commonXmlOriginalVersion, commonXmlVersion, jos);
                         continue;
                     }
 
-                    if ( entryName.endsWith( "pom.xml" ) )
-                    {
-                        replaceEntry( jarFile, entry, commonXmlOriginalVersion, commonXmlVersion, jos );
+                    if (entryName.endsWith("pom.xml")) {
+                        replaceEntry(jarFile, entry, commonXmlOriginalVersion, commonXmlVersion, jos);
                         continue;
                     }
 
-                    if ( entryName.endsWith( "pom.properties" ) )
-                    {
-                        replaceEntry( jarFile, entry, originalPomPropsVersion, pomPropsVersion, jos );
+                    if (entryName.endsWith("pom.properties")) {
+                        replaceEntry(jarFile, entry, originalPomPropsVersion, pomPropsVersion, jos);
                         continue;
                     }
 
-                    if ( JarFile.MANIFEST_NAME.equals( entryName ) )
-                    {
-                        replaceEntry( jarFile, entry, originalImplVersion, implVersion, jos );
+                    if (JarFile.MANIFEST_NAME.equals(entryName)) {
+                        replaceEntry(jarFile, entry, originalImplVersion, implVersion, jos);
                         continue;
                     }
-                    jos.putNextEntry( entry );
-                    try ( InputStream entryInputStream = jarFile.getInputStream( entry ) )
-                    {
+                    jos.putNextEntry(entry);
+                    try (InputStream entryInputStream = jarFile.getInputStream(entry)) {
                         int bytesRead;
-                        while ( ( bytesRead = entryInputStream.read( buffer ) ) != -1 )
-                        {
-                            jos.write( buffer, 0, bytesRead );
+                        while ((bytesRead = entryInputStream.read(buffer)) != -1) {
+                            jos.write(buffer, 0, bytesRead);
                         }
                     }
                 }
@@ -147,16 +137,15 @@ public class DefaultRestoredArtifactHandler implements RestoredArtifactHandler
         return tmpJarFile.toPath();
     }
 
-    private static void replaceEntry( JarFile jarFile, JarEntry entry,
-            String toReplace, String replacement, JarOutputStream jos ) throws IOException
-    {
-        String fullManifest = IOUtils.toString( jarFile.getInputStream( entry ), StandardCharsets.UTF_8.name() );
-        String modified = fullManifest.replaceAll( toReplace, replacement );
+    private static void replaceEntry(
+            JarFile jarFile, JarEntry entry, String toReplace, String replacement, JarOutputStream jos)
+            throws IOException {
+        String fullManifest = IOUtils.toString(jarFile.getInputStream(entry), StandardCharsets.UTF_8.name());
+        String modified = fullManifest.replaceAll(toReplace, replacement);
 
-        byte[] bytes = modified.getBytes( StandardCharsets.UTF_8 );
-        JarEntry newEntry = new JarEntry( entry.getName() );
-        jos.putNextEntry( newEntry );
-        jos.write( bytes );
+        byte[] bytes = modified.getBytes(StandardCharsets.UTF_8);
+        JarEntry newEntry = new JarEntry(entry.getName());
+        jos.putNextEntry(newEntry);
+        jos.write(bytes);
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/LifecyclePhasesHelper.java b/src/main/java/org/apache/maven/buildcache/LifecyclePhasesHelper.java
index 975ee04..33d8a3e 100644
--- a/src/main/java/org/apache/maven/buildcache/LifecyclePhasesHelper.java
+++ b/src/main/java/org/apache/maven/buildcache/LifecyclePhasesHelper.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,16 +18,18 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.maven.SessionScoped;
 import org.apache.maven.buildcache.xml.Build;
 import org.apache.maven.execution.AbstractExecutionListener;
@@ -43,10 +45,9 @@ import org.slf4j.LoggerFactory;
 
 @SessionScoped
 @Named
-public class LifecyclePhasesHelper extends AbstractExecutionListener
-{
+public class LifecyclePhasesHelper extends AbstractExecutionListener {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( LifecyclePhasesHelper.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(LifecyclePhasesHelper.class);
 
     private final MavenSession session;
     private final DefaultLifecycles defaultLifecycles;
@@ -56,103 +57,95 @@ public class LifecyclePhasesHelper extends AbstractExecutionListener
     private final ConcurrentMap<MavenProject, MojoExecution> forkedProjectToOrigin = new ConcurrentHashMap<>();
 
     @Inject
-    public LifecyclePhasesHelper( MavenSession session,
-            DefaultLifecycles defaultLifecycles,
-            @Named( "clean" ) Lifecycle cleanLifecycle )
-    {
+    public LifecyclePhasesHelper(
+            MavenSession session, DefaultLifecycles defaultLifecycles, @Named("clean") Lifecycle cleanLifecycle) {
         this.session = session;
-        this.defaultLifecycles = Objects.requireNonNull( defaultLifecycles );
+        this.defaultLifecycles = Objects.requireNonNull(defaultLifecycles);
         this.phases = defaultLifecycles.getLifeCycles().stream()
-                .flatMap( lf -> lf.getPhases().stream() )
-                .collect( Collectors.toList() );
-        this.lastCleanPhase = CacheUtils.getLast( cleanLifecycle.getPhases() );
+                .flatMap(lf -> lf.getPhases().stream())
+                .collect(Collectors.toList());
+        this.lastCleanPhase = CacheUtils.getLast(cleanLifecycle.getPhases());
     }
 
     @PostConstruct
-    public void init()
-    {
+    public void init() {
         MavenExecutionRequest request = session.getRequest();
-        ChainedListener lifecycleListener = new ChainedListener( request.getExecutionListener() );
-        lifecycleListener.chainListener( this );
-        request.setExecutionListener( lifecycleListener );
+        ChainedListener lifecycleListener = new ChainedListener(request.getExecutionListener());
+        lifecycleListener.chainListener(this);
+        request.setExecutionListener(lifecycleListener);
     }
 
     @Override
-    public void forkedProjectStarted( ExecutionEvent event )
-    {
-        LOGGER.debug( "Started forked project. Project: {}, instance: {}, originating mojo: {}", event.getProject(),
-                System.identityHashCode( event.getProject() ), event.getMojoExecution() );
-        forkedProjectToOrigin.put( event.getProject(), event.getMojoExecution() );
+    public void forkedProjectStarted(ExecutionEvent event) {
+        LOGGER.debug(
+                "Started forked project. Project: {}, instance: {}, originating mojo: {}",
+                event.getProject(),
+                System.identityHashCode(event.getProject()),
+                event.getMojoExecution());
+        forkedProjectToOrigin.put(event.getProject(), event.getMojoExecution());
     }
 
     @Override
-    public void forkedProjectSucceeded( ExecutionEvent event )
-    {
-        LOGGER.debug( "Finished forked project. Project: {}, instance: {}", event.getProject(),
-                System.identityHashCode( event.getProject() ) );
-        forkedProjectToOrigin.remove( event.getProject(), event.getMojoExecution() );
+    public void forkedProjectSucceeded(ExecutionEvent event) {
+        LOGGER.debug(
+                "Finished forked project. Project: {}, instance: {}",
+                event.getProject(),
+                System.identityHashCode(event.getProject()));
+        forkedProjectToOrigin.remove(event.getProject(), event.getMojoExecution());
     }
 
     @Override
-    public void forkedProjectFailed( ExecutionEvent event )
-    {
-        LOGGER.debug( "Finished forked project. Project: {}, instance: {}", event.getProject(),
-                System.identityHashCode( event.getProject() ) );
-        forkedProjectToOrigin.remove( event.getProject(), event.getMojoExecution() );
+    public void forkedProjectFailed(ExecutionEvent event) {
+        LOGGER.debug(
+                "Finished forked project. Project: {}, instance: {}",
+                event.getProject(),
+                System.identityHashCode(event.getProject()));
+        forkedProjectToOrigin.remove(event.getProject(), event.getMojoExecution());
     }
 
     @Nonnull
-    public String resolveHighestLifecyclePhase( MavenProject project, List<MojoExecution> mojoExecutions )
-    {
-        return resolveMojoExecutionLifecyclePhase( project, CacheUtils.getLast( mojoExecutions ) );
+    public String resolveHighestLifecyclePhase(MavenProject project, List<MojoExecution> mojoExecutions) {
+        return resolveMojoExecutionLifecyclePhase(project, CacheUtils.getLast(mojoExecutions));
     }
 
     /**
      * Check if the given phase is later than the clean lifecycle.
      */
-    public boolean isLaterPhaseThanClean( String phase )
-    {
-        return isLaterPhase( phase, lastCleanPhase );
+    public boolean isLaterPhaseThanClean(String phase) {
+        return isLaterPhase(phase, lastCleanPhase);
     }
 
-    public boolean isLaterPhaseThanBuild( String phase, Build build )
-    {
-        return isLaterPhase( phase, build.getHighestCompletedGoal() );
+    public boolean isLaterPhaseThanBuild(String phase, Build build) {
+        return isLaterPhase(phase, build.getHighestCompletedGoal());
     }
 
     /**
      * Check if the given phase is later than the other in maven lifecycle.
      * Example: isLaterPhase("install", "clean") returns true;
      */
-    public boolean isLaterPhase( String phase, String other )
-    {
-        if ( !phases.contains( phase ) )
-        {
-            throw new IllegalArgumentException( "Unsupported phase: " + phase );
+    public boolean isLaterPhase(String phase, String other) {
+        if (!phases.contains(phase)) {
+            throw new IllegalArgumentException("Unsupported phase: " + phase);
         }
-        if ( !phases.contains( other ) )
-        {
-            throw new IllegalArgumentException( "Unsupported phase: " + other );
+        if (!phases.contains(other)) {
+            throw new IllegalArgumentException("Unsupported phase: " + other);
         }
 
-        return phases.indexOf( phase ) > phases.indexOf( other );
+        return phases.indexOf(phase) > phases.indexOf(other);
     }
 
     /**
      * Computes the list of mojos executions in the clean phase
      */
-    public List<MojoExecution> getCleanSegment( MavenProject project, List<MojoExecution> mojoExecutions )
-    {
-        List<MojoExecution> list = new ArrayList<>( mojoExecutions.size() );
-        for ( MojoExecution mojoExecution : mojoExecutions )
-        {
-            String lifecyclePhase = resolveMojoExecutionLifecyclePhase( project, mojoExecution );
-
-            if ( isLaterPhaseThanClean( lifecyclePhase ) )
-            {
+    public List<MojoExecution> getCleanSegment(MavenProject project, List<MojoExecution> mojoExecutions) {
+        List<MojoExecution> list = new ArrayList<>(mojoExecutions.size());
+        for (MojoExecution mojoExecution : mojoExecutions) {
+            String lifecyclePhase = resolveMojoExecutionLifecyclePhase(project, mojoExecution);
+
+            if (isLaterPhaseThanClean(lifecyclePhase)) {
                 break;
             }
-            list.add( mojoExecution );
+            list.add(mojoExecution);
         }
         return list;
     }
@@ -164,24 +157,20 @@ public class LifecyclePhasesHelper extends AbstractExecutionListener
      * @param  mojoExecution - mojo to resolve lifecycle for
      * @return               phase
      */
-    private String resolveMojoExecutionLifecyclePhase( MavenProject project, MojoExecution mojoExecution )
-    {
+    private String resolveMojoExecutionLifecyclePhase(MavenProject project, MojoExecution mojoExecution) {
 
-        MojoExecution forkOrigin = forkedProjectToOrigin.get( project );
+        MojoExecution forkOrigin = forkedProjectToOrigin.get(project);
 
         // if forked, take originating mojo as a lifecycle phase source
-        if ( forkOrigin == null )
-        {
+        if (forkOrigin == null) {
             return mojoExecution.getLifecyclePhase();
-        }
-        else
-        {
-            if ( LOGGER.isDebugEnabled() )
-            {
-                LOGGER.debug( "Mojo execution {} is forked, returning phase {} from originating mojo {}",
-                        CacheUtils.mojoExecutionKey( mojoExecution ),
+        } else {
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug(
+                        "Mojo execution {} is forked, returning phase {} from originating mojo {}",
+                        CacheUtils.mojoExecutionKey(mojoExecution),
                         forkOrigin.getLifecyclePhase(),
-                        CacheUtils.mojoExecutionKey( forkOrigin ) );
+                        CacheUtils.mojoExecutionKey(forkOrigin));
             }
             return forkOrigin.getLifecyclePhase();
         }
@@ -190,23 +179,19 @@ public class LifecyclePhasesHelper extends AbstractExecutionListener
     /**
      * Computes the list of mojos executions that are cached.
      */
-    public List<MojoExecution> getCachedSegment( MavenProject project, List<MojoExecution> mojoExecutions, Build build )
-    {
-        List<MojoExecution> list = new ArrayList<>( mojoExecutions.size() );
-        for ( MojoExecution mojoExecution : mojoExecutions )
-        {
+    public List<MojoExecution> getCachedSegment(MavenProject project, List<MojoExecution> mojoExecutions, Build build) {
+        List<MojoExecution> list = new ArrayList<>(mojoExecutions.size());
+        for (MojoExecution mojoExecution : mojoExecutions) {
             // if forked, take originating mojo as a lifecycle phase source
-            String lifecyclePhase = resolveMojoExecutionLifecyclePhase( project, mojoExecution );
+            String lifecyclePhase = resolveMojoExecutionLifecyclePhase(project, mojoExecution);
 
-            if ( !isLaterPhaseThanClean( lifecyclePhase ) )
-            {
+            if (!isLaterPhaseThanClean(lifecyclePhase)) {
                 continue;
             }
-            if ( isLaterPhaseThanBuild( lifecyclePhase, build ) )
-            {
+            if (isLaterPhaseThanBuild(lifecyclePhase, build)) {
                 break;
             }
-            list.add( mojoExecution );
+            list.add(mojoExecution);
         }
         return list;
     }
@@ -214,22 +199,18 @@ public class LifecyclePhasesHelper extends AbstractExecutionListener
     /**
      * Computes the list of mojos executions that will have to be executed after cache restoration.
      */
-    public List<MojoExecution> getPostCachedSegment( MavenProject project, List<MojoExecution> mojoExecutions,
-            Build build )
-    {
-        List<MojoExecution> list = new ArrayList<>( mojoExecutions.size() );
-        for ( MojoExecution mojoExecution : mojoExecutions )
-        {
+    public List<MojoExecution> getPostCachedSegment(
+            MavenProject project, List<MojoExecution> mojoExecutions, Build build) {
+        List<MojoExecution> list = new ArrayList<>(mojoExecutions.size());
+        for (MojoExecution mojoExecution : mojoExecutions) {
 
             // if forked, take originating mojo as a lifecycle phase source
-            String lifecyclePhase = resolveMojoExecutionLifecyclePhase( project, mojoExecution );
+            String lifecyclePhase = resolveMojoExecutionLifecyclePhase(project, mojoExecution);
 
-            if ( isLaterPhaseThanBuild( lifecyclePhase, build ) )
-            {
-                list.add( mojoExecution );
+            if (isLaterPhaseThanBuild(lifecyclePhase, build)) {
+                list.add(mojoExecution);
             }
         }
         return list;
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/LocalCacheRepository.java b/src/main/java/org/apache/maven/buildcache/LocalCacheRepository.java
index e164edb..3117455 100644
--- a/src/main/java/org/apache/maven/buildcache/LocalCacheRepository.java
+++ b/src/main/java/org/apache/maven/buildcache/LocalCacheRepository.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,10 +18,12 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+
 import org.apache.maven.buildcache.xml.Build;
 import org.apache.maven.buildcache.xml.CacheSource;
 import org.apache.maven.buildcache.xml.build.Artifact;
@@ -31,18 +33,17 @@ import org.apache.maven.model.Dependency;
 /**
  * Local cache repository.
  */
-public interface LocalCacheRepository extends CacheRepository
-{
+public interface LocalCacheRepository extends CacheRepository {
 
-    void beforeSave( CacheContext environment ) throws IOException;
+    void beforeSave(CacheContext environment) throws IOException;
 
-    Path getArtifactFile( CacheContext context, CacheSource source, Artifact artifact ) throws IOException;
+    Path getArtifactFile(CacheContext context, CacheSource source, Artifact artifact) throws IOException;
 
-    void clearCache( CacheContext context );
+    void clearCache(CacheContext context);
 
     @Nonnull
-    Optional<Build> findBestMatchingBuild( MavenSession session, Dependency dependency ) throws IOException;
+    Optional<Build> findBestMatchingBuild(MavenSession session, Dependency dependency) throws IOException;
 
     @Nonnull
-    Optional<Build> findLocalBuild( CacheContext context ) throws IOException;
+    Optional<Build> findLocalBuild(CacheContext context) throws IOException;
 }
diff --git a/src/main/java/org/apache/maven/buildcache/LocalCacheRepositoryImpl.java b/src/main/java/org/apache/maven/buildcache/LocalCacheRepositoryImpl.java
index abbb41d..1df9b8c 100644
--- a/src/main/java/org/apache/maven/buildcache/LocalCacheRepositoryImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/LocalCacheRepositoryImpl.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,6 +18,10 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.DirectoryStream;
@@ -39,9 +43,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.maven.SessionScoped;
@@ -73,18 +75,17 @@ import static org.apache.maven.buildcache.checksum.MavenProjectInput.CACHE_IMPLE
  */
 @SessionScoped
 @Named
-@SuppressWarnings( "unused" )
-public class LocalCacheRepositoryImpl implements LocalCacheRepository
-{
+@SuppressWarnings("unused")
+public class LocalCacheRepositoryImpl implements LocalCacheRepository {
 
     private static final String BUILDINFO_XML = "buildinfo.xml";
     private static final String LOOKUPINFO_XML = "lookupinfo.xml";
-    private static final long ONE_HOUR_MILLIS = HOURS.toMillis( 1 );
-    private static final long ONE_MINUTE_MILLIS = MINUTES.toMillis( 1 );
-    private static final long ONE_DAY_MILLIS = DAYS.toMillis( 1 );
+    private static final long ONE_HOUR_MILLIS = HOURS.toMillis(1);
+    private static final long ONE_MINUTE_MILLIS = MINUTES.toMillis(1);
+    private static final long ONE_DAY_MILLIS = DAYS.toMillis(1);
     private static final String EMPTY = "";
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( LocalCacheRepositoryImpl.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(LocalCacheRepositoryImpl.class);
 
     private final RemoteCacheRepository remoteRepository;
     private final XmlService xmlService;
@@ -93,10 +94,7 @@ public class LocalCacheRepositoryImpl implements LocalCacheRepository
 
     @Inject
     public LocalCacheRepositoryImpl(
-            RemoteCacheRepository remoteRepository,
-            XmlService xmlService,
-            CacheConfig cacheConfig )
-    {
+            RemoteCacheRepository remoteRepository, XmlService xmlService, CacheConfig cacheConfig) {
         this.remoteRepository = remoteRepository;
         this.xmlService = xmlService;
         this.cacheConfig = cacheConfig;
@@ -104,22 +102,18 @@ public class LocalCacheRepositoryImpl implements LocalCacheRepository
 
     @Nonnull
     @Override
-    public Optional<Build> findLocalBuild( CacheContext context ) throws IOException
-    {
-        Path localBuildInfoPath = localBuildPath( context, BUILDINFO_XML, false );
-        LOGGER.debug( "Checking local build info: {}", localBuildInfoPath );
-        if ( Files.exists( localBuildInfoPath ) )
-        {
-            LOGGER.info( "Local build found by checksum {}", context.getInputInfo().getChecksum() );
-            try
-            {
-                org.apache.maven.buildcache.xml.build.Build dto = xmlService.loadBuild( localBuildInfoPath.toFile() );
-                return Optional.of( new Build( dto, CacheSource.LOCAL ) );
-            }
-            catch ( Exception e )
-            {
-                LOGGER.info( "Local build info is not valid, deleting: {}", localBuildInfoPath, e );
-                Files.delete( localBuildInfoPath );
+    public Optional<Build> findLocalBuild(CacheContext context) throws IOException {
+        Path localBuildInfoPath = localBuildPath(context, BUILDINFO_XML, false);
+        LOGGER.debug("Checking local build info: {}", localBuildInfoPath);
+        if (Files.exists(localBuildInfoPath)) {
+            LOGGER.info(
+                    "Local build found by checksum {}", context.getInputInfo().getChecksum());
+            try {
+                org.apache.maven.buildcache.xml.build.Build dto = xmlService.loadBuild(localBuildInfoPath.toFile());
+                return Optional.of(new Build(dto, CacheSource.LOCAL));
+            } catch (Exception e) {
+                LOGGER.info("Local build info is not valid, deleting: {}", localBuildInfoPath, e);
+                Files.delete(localBuildInfoPath);
             }
         }
         return Optional.empty();
@@ -127,253 +121,199 @@ public class LocalCacheRepositoryImpl implements LocalCacheRepository
 
     @Nonnull
     @Override
-    public Optional<Build> findBuild( CacheContext context ) throws IOException
-    {
-        Path buildInfoPath = remoteBuildPath( context, BUILDINFO_XML );
-        LOGGER.debug( "Checking if build is already downloaded: {}", buildInfoPath );
-
-        if ( Files.exists( buildInfoPath ) )
-        {
-            LOGGER.info( "Downloaded build found by checksum {}", context.getInputInfo().getChecksum() );
-            try
-            {
-                org.apache.maven.buildcache.xml.build.Build dto = xmlService.loadBuild( buildInfoPath.toFile() );
-                return Optional.of( new Build( dto, CacheSource.REMOTE ) );
-            }
-            catch ( Exception e )
-            {
-                LOGGER.info( "Downloaded build info is not valid, deleting: {}", buildInfoPath, e );
-                Files.delete( buildInfoPath );
+    public Optional<Build> findBuild(CacheContext context) throws IOException {
+        Path buildInfoPath = remoteBuildPath(context, BUILDINFO_XML);
+        LOGGER.debug("Checking if build is already downloaded: {}", buildInfoPath);
+
+        if (Files.exists(buildInfoPath)) {
+            LOGGER.info(
+                    "Downloaded build found by checksum {}",
+                    context.getInputInfo().getChecksum());
+            try {
+                org.apache.maven.buildcache.xml.build.Build dto = xmlService.loadBuild(buildInfoPath.toFile());
+                return Optional.of(new Build(dto, CacheSource.REMOTE));
+            } catch (Exception e) {
+                LOGGER.info("Downloaded build info is not valid, deleting: {}", buildInfoPath, e);
+                Files.delete(buildInfoPath);
             }
         }
 
-        if ( !cacheConfig.isRemoteCacheEnabled() )
-        {
+        if (!cacheConfig.isRemoteCacheEnabled()) {
             return Optional.empty();
         }
 
-        try
-        {
-            Path lookupInfoPath = remoteBuildPath( context, LOOKUPINFO_XML );
-            if ( Files.exists( lookupInfoPath ) )
-            {
-                final BasicFileAttributes fileAttributes = Files.readAttributes( lookupInfoPath,
-                        BasicFileAttributes.class );
+        try {
+            Path lookupInfoPath = remoteBuildPath(context, LOOKUPINFO_XML);
+            if (Files.exists(lookupInfoPath)) {
+                final BasicFileAttributes fileAttributes =
+                        Files.readAttributes(lookupInfoPath, BasicFileAttributes.class);
                 final long lastModified = fileAttributes.lastModifiedTime().toMillis();
                 final long created = fileAttributes.creationTime().toMillis();
                 final long now = System.currentTimeMillis();
                 //  throttle remote cache calls, maven like
-                if ( now < created + ONE_HOUR_MILLIS && now < lastModified + ONE_MINUTE_MILLIS )
-                { // fresh file, allow lookup every minute
-                    LOGGER.info( "Skipping remote lookup, last unsuccessful lookup less than 1m ago." );
+                if (now < created + ONE_HOUR_MILLIS
+                        && now < lastModified + ONE_MINUTE_MILLIS) { // fresh file, allow lookup every minute
+                    LOGGER.info("Skipping remote lookup, last unsuccessful lookup less than 1m ago.");
                     return Optional.empty();
-                }
-                else if ( now < created + ONE_DAY_MILLIS && now < lastModified + ONE_HOUR_MILLIS )
-                { // less than 1 day file, allow 1 per hour lookup
-                    LOGGER.info( "Skipping remote lookup, last unsuccessful lookup less than 1h ago." );
+                } else if (now < created + ONE_DAY_MILLIS
+                        && now < lastModified + ONE_HOUR_MILLIS) { // less than 1 day file, allow 1 per hour lookup
+                    LOGGER.info("Skipping remote lookup, last unsuccessful lookup less than 1h ago.");
                     return Optional.empty();
-                }
-                else if ( now > created + ONE_DAY_MILLIS && now < lastModified + ONE_DAY_MILLIS )
-                { // more than 1 day file, allow 1 per day lookup
-                    LOGGER.info( "Skipping remote lookup, last unsuccessful lookup less than 1d ago." );
+                } else if (now > created + ONE_DAY_MILLIS
+                        && now < lastModified + ONE_DAY_MILLIS) { // more than 1 day file, allow 1 per day lookup
+                    LOGGER.info("Skipping remote lookup, last unsuccessful lookup less than 1d ago.");
                     return Optional.empty();
                 }
             }
 
-            final Optional<Build> build = remoteRepository.findBuild( context );
-            if ( build.isPresent() )
-            {
-                LOGGER.info( "Build info downloaded from remote repo, saving to: {}", buildInfoPath );
-                Files.createDirectories( buildInfoPath.getParent() );
-                Files.write( buildInfoPath, xmlService.toBytes( build.get().getDto() ), CREATE_NEW );
-            }
-            else
-            {
-                FileUtils.touch( lookupInfoPath.toFile() );
+            final Optional<Build> build = remoteRepository.findBuild(context);
+            if (build.isPresent()) {
+                LOGGER.info("Build info downloaded from remote repo, saving to: {}", buildInfoPath);
+                Files.createDirectories(buildInfoPath.getParent());
+                Files.write(buildInfoPath, xmlService.toBytes(build.get().getDto()), CREATE_NEW);
+            } else {
+                FileUtils.touch(lookupInfoPath.toFile());
             }
             return build;
-        }
-        catch ( Exception e )
-        {
-            LOGGER.error( "Remote build info is not valid, cached data is not compatible", e );
+        } catch (Exception e) {
+            LOGGER.error("Remote build info is not valid, cached data is not compatible", e);
             return Optional.empty();
         }
     }
 
     @Override
-    public void clearCache( CacheContext context )
-    {
-        try
-        {
-            final Path buildCacheDir = buildCacheDir( context );
+    public void clearCache(CacheContext context) {
+        try {
+            final Path buildCacheDir = buildCacheDir(context);
             Path artifactCacheDir = buildCacheDir.getParent();
 
-            if ( !Files.exists( artifactCacheDir ) )
-            {
+            if (!Files.exists(artifactCacheDir)) {
                 return;
             }
 
             List<Path> cacheDirs = new ArrayList<>();
-            try ( DirectoryStream<Path> paths = Files.newDirectoryStream( artifactCacheDir ) )
-            {
-                for ( Path dir : paths )
-                {
-                    if ( Files.isDirectory( dir ) )
-                    {
-                        cacheDirs.add( dir );
+            try (DirectoryStream<Path> paths = Files.newDirectoryStream(artifactCacheDir)) {
+                for (Path dir : paths) {
+                    if (Files.isDirectory(dir)) {
+                        cacheDirs.add(dir);
                     }
                 }
             }
             int maxLocalBuildsCached = cacheConfig.getMaxLocalBuildsCached() - 1;
-            if ( cacheDirs.size() > maxLocalBuildsCached )
-            {
-                cacheDirs.sort( Comparator.comparing( LocalCacheRepositoryImpl::lastModifiedTime ) );
-                for ( Path dir : cacheDirs.subList( 0, cacheDirs.size() - maxLocalBuildsCached ) )
-                {
-                    FileUtils.deleteDirectory( dir.toFile() );
+            if (cacheDirs.size() > maxLocalBuildsCached) {
+                cacheDirs.sort(Comparator.comparing(LocalCacheRepositoryImpl::lastModifiedTime));
+                for (Path dir : cacheDirs.subList(0, cacheDirs.size() - maxLocalBuildsCached)) {
+                    FileUtils.deleteDirectory(dir.toFile());
                 }
             }
-            final Path path = localBuildDir( context );
-            if ( Files.exists( path ) )
-            {
-                FileUtils.deleteDirectory( path.toFile() );
+            final Path path = localBuildDir(context);
+            if (Files.exists(path)) {
+                FileUtils.deleteDirectory(path.toFile());
             }
-        }
-        catch ( IOException e )
-        {
+        } catch (IOException e) {
             final String artifactId = context.getProject().getArtifactId();
             throw new RuntimeException(
                     "Failed to cleanup local cache of " + artifactId + " on build failure, it might be inconsistent",
-                    e );
+                    e);
         }
     }
 
     @Nonnull
     @Override
-    public Optional<Build> findBestMatchingBuild(
-            MavenSession session, Dependency dependency )
-    {
-        return bestBuildCache.computeIfAbsent( Pair.of( session, dependency ), this::findBestMatchingBuildImpl );
+    public Optional<Build> findBestMatchingBuild(MavenSession session, Dependency dependency) {
+        return bestBuildCache.computeIfAbsent(Pair.of(session, dependency), this::findBestMatchingBuildImpl);
     }
 
     @Nonnull
-    private Optional<Build> findBestMatchingBuildImpl(
-            Pair<MavenSession, Dependency> dependencySession )
-    {
-        try
-        {
+    private Optional<Build> findBestMatchingBuildImpl(Pair<MavenSession, Dependency> dependencySession) {
+        try {
             final MavenSession session = dependencySession.getLeft();
             final Dependency dependency = dependencySession.getRight();
 
-            final Path artifactCacheDir = artifactCacheDir( session, dependency.getGroupId(),
-                    dependency.getArtifactId() );
+            final Path artifactCacheDir =
+                    artifactCacheDir(session, dependency.getGroupId(), dependency.getArtifactId());
 
             final Map<Pair<String, String>, Collection<Pair<Build, Path>>> filesByVersion = new HashMap<>();
 
-            Files.walkFileTree( artifactCacheDir, new SimpleFileVisitor<Path>()
-            {
+            Files.walkFileTree(artifactCacheDir, new SimpleFileVisitor<Path>() {
 
                 @Override
-                public FileVisitResult visitFile( Path path, BasicFileAttributes basicFileAttributes )
-                {
+                public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttributes) {
                     final File file = path.toFile();
-                    if ( file.getName().equals( BUILDINFO_XML ) )
-                    {
-                        try
-                        {
-                            final org.apache.maven.buildcache.xml.build.Build dto = xmlService.loadBuild( file );
-                            final Pair<Build, Path> buildInfoAndFile = Pair.of( new Build( dto, CacheSource.LOCAL ),
-                                    path );
+                    if (file.getName().equals(BUILDINFO_XML)) {
+                        try {
+                            final org.apache.maven.buildcache.xml.build.Build dto = xmlService.loadBuild(file);
+                            final Pair<Build, Path> buildInfoAndFile = Pair.of(new Build(dto, CacheSource.LOCAL), path);
                             final String cachedVersion = dto.getArtifact().getVersion();
-                            final String cachedBranch = getScmRef( dto.getScm() );
-                            add( filesByVersion, Pair.of( cachedVersion, cachedBranch ), buildInfoAndFile );
-                            if ( isNotBlank( cachedBranch ) )
-                            {
-                                add( filesByVersion, Pair.of( EMPTY, cachedBranch ), buildInfoAndFile );
+                            final String cachedBranch = getScmRef(dto.getScm());
+                            add(filesByVersion, Pair.of(cachedVersion, cachedBranch), buildInfoAndFile);
+                            if (isNotBlank(cachedBranch)) {
+                                add(filesByVersion, Pair.of(EMPTY, cachedBranch), buildInfoAndFile);
                             }
-                            if ( isNotBlank( cachedVersion ) )
-                            {
-                                add( filesByVersion, Pair.of( cachedVersion, EMPTY ), buildInfoAndFile );
+                            if (isNotBlank(cachedVersion)) {
+                                add(filesByVersion, Pair.of(cachedVersion, EMPTY), buildInfoAndFile);
                             }
-                        }
-                        catch ( Exception e )
-                        {
+                        } catch (Exception e) {
                             // version is unusable nothing we can do here
-                            LOGGER.info( "Build info is not compatible to current maven "
-                                    + "implementation: {}", file, e );
+                            LOGGER.info(
+                                    "Build info is not compatible to current maven " + "implementation: {}", file, e);
                         }
                     }
                     return FileVisitResult.CONTINUE;
                 }
-            } );
+            });
 
-            if ( filesByVersion.isEmpty() )
-            {
+            if (filesByVersion.isEmpty()) {
                 return Optional.empty();
             }
 
-            final String currentRef = getScmRef( CacheUtils.readGitInfo( session ) );
+            final String currentRef = getScmRef(CacheUtils.readGitInfo(session));
             // first lets try by branch and version
             Collection<Pair<Build, Path>> bestMatched = new LinkedList<>();
-            if ( isNotBlank( currentRef ) )
-            {
-                bestMatched = filesByVersion.get( Pair.of( dependency.getVersion(), currentRef ) );
+            if (isNotBlank(currentRef)) {
+                bestMatched = filesByVersion.get(Pair.of(dependency.getVersion(), currentRef));
             }
-            if ( bestMatched.isEmpty() )
-            {
+            if (bestMatched.isEmpty()) {
                 // then by version
-                bestMatched = filesByVersion.get( Pair.of( dependency.getVersion(), EMPTY ) );
+                bestMatched = filesByVersion.get(Pair.of(dependency.getVersion(), EMPTY));
             }
-            if ( bestMatched.isEmpty() && isNotBlank( currentRef ) )
-            {
+            if (bestMatched.isEmpty() && isNotBlank(currentRef)) {
                 // then by branch
-                bestMatched = filesByVersion.get( Pair.of( EMPTY, currentRef ) );
+                bestMatched = filesByVersion.get(Pair.of(EMPTY, currentRef));
             }
-            if ( bestMatched.isEmpty() )
-            {
+            if (bestMatched.isEmpty()) {
                 // ok lets take all
                 bestMatched = filesByVersion.values().stream()
-                        .flatMap( Collection::stream ).collect( Collectors.toList() );
+                        .flatMap(Collection::stream)
+                        .collect(Collectors.toList());
             }
 
             return bestMatched.stream()
-                    .max( Comparator.comparing( p -> lastModifiedTime( p.getRight() ) ) )
-                    .map( Pair::getLeft );
-        }
-        catch ( IOException e )
-        {
-            LOGGER.info( "Cannot find dependency in cache", e );
+                    .max(Comparator.comparing(p -> lastModifiedTime(p.getRight())))
+                    .map(Pair::getLeft);
+        } catch (IOException e) {
+            LOGGER.info("Cannot find dependency in cache", e);
             return Optional.empty();
         }
     }
 
-    private String getScmRef( Scm scm )
-    {
-        if ( scm != null )
-        {
+    private String getScmRef(Scm scm) {
+        if (scm != null) {
             return scm.getSourceBranch() != null ? scm.getSourceBranch() : scm.getRevision();
-        }
-        else
-        {
+        } else {
             return EMPTY;
         }
     }
 
     @Override
-    public Path getArtifactFile( CacheContext context, CacheSource source, Artifact artifact ) throws IOException
-    {
-        if ( source == CacheSource.LOCAL )
-        {
-            return localBuildPath( context, artifact.getFileName(), false );
-        }
-        else
-        {
-            Path cachePath = remoteBuildPath( context, artifact.getFileName() );
-            if ( !Files.exists( cachePath ) && cacheConfig.isRemoteCacheEnabled() )
-            {
-                if ( !remoteRepository.getArtifactContent( context, artifact, cachePath ) )
-                {
-                    Files.deleteIfExists( cachePath );
+    public Path getArtifactFile(CacheContext context, CacheSource source, Artifact artifact) throws IOException {
+        if (source == CacheSource.LOCAL) {
+            return localBuildPath(context, artifact.getFileName(), false);
+        } else {
+            Path cachePath = remoteBuildPath(context, artifact.getFileName());
+            if (!Files.exists(cachePath) && cacheConfig.isRemoteCacheEnabled()) {
+                if (!remoteRepository.getArtifactContent(context, artifact, cachePath)) {
+                    Files.deleteIfExists(cachePath);
                 }
             }
             return cachePath;
@@ -381,120 +321,100 @@ public class LocalCacheRepositoryImpl implements LocalCacheRepository
     }
 
     @Override
-    public void beforeSave( CacheContext environment )
-    {
-        clearCache( environment );
+    public void beforeSave(CacheContext environment) {
+        clearCache(environment);
     }
 
     @Override
-    public void saveBuildInfo( CacheResult cacheResult, Build build )
-            throws IOException
-    {
-        final Path path = localBuildPath( cacheResult.getContext(), BUILDINFO_XML, true );
-        Files.write( path, xmlService.toBytes( build.getDto() ), TRUNCATE_EXISTING, CREATE );
-        if ( cacheConfig.isRemoteCacheEnabled() && cacheConfig.isSaveToRemote() && !cacheResult.isFinal() )
-        {
-            remoteRepository.saveBuildInfo( cacheResult, build );
+    public void saveBuildInfo(CacheResult cacheResult, Build build) throws IOException {
+        final Path path = localBuildPath(cacheResult.getContext(), BUILDINFO_XML, true);
+        Files.write(path, xmlService.toBytes(build.getDto()), TRUNCATE_EXISTING, CREATE);
+        if (cacheConfig.isRemoteCacheEnabled() && cacheConfig.isSaveToRemote() && !cacheResult.isFinal()) {
+            remoteRepository.saveBuildInfo(cacheResult, build);
         }
     }
 
     @Override
-    public void saveCacheReport( String buildId, MavenSession session, CacheReport cacheReport ) throws IOException
-    {
-        Path path = getMultimoduleRoot( session ).resolve( "target" ).resolve( "maven-incremental" );
-        Files.createDirectories( path );
-        Files.write( path.resolve( "cache-report." + buildId + ".xml" ), xmlService.toBytes( cacheReport ),
-                TRUNCATE_EXISTING, CREATE );
-        if ( cacheConfig.isRemoteCacheEnabled() && cacheConfig.isSaveToRemote() )
-        {
-            LOGGER.info( "Saving cache report on build completion" );
-            remoteRepository.saveCacheReport( buildId, session, cacheReport );
+    public void saveCacheReport(String buildId, MavenSession session, CacheReport cacheReport) throws IOException {
+        Path path = getMultimoduleRoot(session).resolve("target").resolve("maven-incremental");
+        Files.createDirectories(path);
+        Files.write(
+                path.resolve("cache-report." + buildId + ".xml"),
+                xmlService.toBytes(cacheReport),
+                TRUNCATE_EXISTING,
+                CREATE);
+        if (cacheConfig.isRemoteCacheEnabled() && cacheConfig.isSaveToRemote()) {
+            LOGGER.info("Saving cache report on build completion");
+            remoteRepository.saveCacheReport(buildId, session, cacheReport);
         }
     }
 
     @Override
-    public void saveArtifactFile( CacheResult cacheResult, org.apache.maven.artifact.Artifact artifact )
-            throws IOException
-    {
+    public void saveArtifactFile(CacheResult cacheResult, org.apache.maven.artifact.Artifact artifact)
+            throws IOException {
         // safe artifacts to cache
         File artifactFile = artifact.getFile();
-        Path cachePath = localBuildPath( cacheResult.getContext(), CacheUtils.normalizedName( artifact ), true );
-        Files.copy( artifactFile.toPath(), cachePath, StandardCopyOption.REPLACE_EXISTING );
-        if ( cacheConfig.isRemoteCacheEnabled() && cacheConfig.isSaveToRemote() && !cacheResult.isFinal() )
-        {
-            remoteRepository.saveArtifactFile( cacheResult, artifact );
+        Path cachePath = localBuildPath(cacheResult.getContext(), CacheUtils.normalizedName(artifact), true);
+        Files.copy(artifactFile.toPath(), cachePath, StandardCopyOption.REPLACE_EXISTING);
+        if (cacheConfig.isRemoteCacheEnabled() && cacheConfig.isSaveToRemote() && !cacheResult.isFinal()) {
+            remoteRepository.saveArtifactFile(cacheResult, artifact);
         }
     }
 
-    private Path buildCacheDir( CacheContext context ) throws IOException
-    {
+    private Path buildCacheDir(CacheContext context) throws IOException {
         final MavenProject project = context.getProject();
-        final Path artifactCacheDir = artifactCacheDir( context.getSession(), project.getGroupId(),
-                project.getArtifactId() );
-        return artifactCacheDir.resolve( context.getInputInfo().getChecksum() );
+        final Path artifactCacheDir =
+                artifactCacheDir(context.getSession(), project.getGroupId(), project.getArtifactId());
+        return artifactCacheDir.resolve(context.getInputInfo().getChecksum());
     }
 
-    private Path artifactCacheDir( MavenSession session, String groupId, String artifactId ) throws IOException
-    {
-        final Path vga = Paths.get( CACHE_IMPLEMENTATION_VERSION, groupId, artifactId );
-        final Path path = baseDir( session ).resolve( vga );
-        Files.createDirectories( path );
+    private Path artifactCacheDir(MavenSession session, String groupId, String artifactId) throws IOException {
+        final Path vga = Paths.get(CACHE_IMPLEMENTATION_VERSION, groupId, artifactId);
+        final Path path = baseDir(session).resolve(vga);
+        Files.createDirectories(path);
         return path;
     }
 
-    private Path baseDir( MavenSession session )
-    {
+    private Path baseDir(MavenSession session) {
         String loc = cacheConfig.getLocalRepositoryLocation();
-        if ( loc != null )
-        {
-            return Paths.get( loc );
-        }
-        else
-        {
-            return Paths.get( session.getLocalRepository().getBasedir() ).getParent().resolve( "build-cache" );
+        if (loc != null) {
+            return Paths.get(loc);
+        } else {
+            return Paths.get(session.getLocalRepository().getBasedir())
+                    .getParent()
+                    .resolve("build-cache");
         }
     }
 
-    private Path remoteBuildPath( CacheContext context, String filename ) throws IOException
-    {
-        return remoteBuildDir( context ).resolve( filename );
+    private Path remoteBuildPath(CacheContext context, String filename) throws IOException {
+        return remoteBuildDir(context).resolve(filename);
     }
 
-    private Path localBuildPath( CacheContext context, String filename, boolean createDir ) throws IOException
-    {
-        final Path localBuildDir = localBuildDir( context );
-        if ( createDir )
-        {
-            Files.createDirectories( localBuildDir );
+    private Path localBuildPath(CacheContext context, String filename, boolean createDir) throws IOException {
+        final Path localBuildDir = localBuildDir(context);
+        if (createDir) {
+            Files.createDirectories(localBuildDir);
         }
-        return localBuildDir.resolve( filename );
+        return localBuildDir.resolve(filename);
     }
 
-    private Path remoteBuildDir( CacheContext context ) throws IOException
-    {
-        return buildCacheDir( context ).resolve( cacheConfig.getId() );
+    private Path remoteBuildDir(CacheContext context) throws IOException {
+        return buildCacheDir(context).resolve(cacheConfig.getId());
     }
 
-    private Path localBuildDir( CacheContext context ) throws IOException
-    {
-        return buildCacheDir( context ).resolve( "local" );
+    private Path localBuildDir(CacheContext context) throws IOException {
+        return buildCacheDir(context).resolve("local");
     }
 
-    private static FileTime lastModifiedTime( Path p )
-    {
-        try
-        {
-            return Files.getLastModifiedTime( p );
-        }
-        catch ( IOException e )
-        {
-            return FileTime.fromMillis( 0 );
+    private static FileTime lastModifiedTime(Path p) {
+        try {
+            return Files.getLastModifiedTime(p);
+        } catch (IOException e) {
+            return FileTime.fromMillis(0);
         }
     }
 
-    private static <K, V> void add( Map<K, Collection<V>> map, K key, V value )
-    {
-        map.computeIfAbsent( key, k -> new ArrayList<>() ).add( value );
+    private static <K, V> void add(Map<K, Collection<V>> map, K key, V value) {
+        map.computeIfAbsent(key, k -> new ArrayList<>()).add(value);
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/MojoParametersListener.java b/src/main/java/org/apache/maven/buildcache/MojoParametersListener.java
index dd0b39b..663b46c 100644
--- a/src/main/java/org/apache/maven/buildcache/MojoParametersListener.java
+++ b/src/main/java/org/apache/maven/buildcache/MojoParametersListener.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,11 +18,13 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import javax.inject.Named;
-import javax.inject.Singleton;
+
 import org.apache.maven.execution.MojoExecutionEvent;
 import org.apache.maven.execution.MojoExecutionListener;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -35,53 +37,48 @@ import org.slf4j.LoggerFactory;
  */
 @Singleton
 @Named
-public class MojoParametersListener implements MojoExecutionListener
-{
+public class MojoParametersListener implements MojoExecutionListener {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( MojoParametersListener.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(MojoParametersListener.class);
 
-    @SuppressWarnings( "checkstyle:LineLength" )
-    private final ConcurrentMap<MavenProject, Map<String, MojoExecutionEvent>> projectExecutions = new ConcurrentHashMap<>();
+    @SuppressWarnings("checkstyle:LineLength")
+    private final ConcurrentMap<MavenProject, Map<String, MojoExecutionEvent>> projectExecutions =
+            new ConcurrentHashMap<>();
 
     @Override
-    public void beforeMojoExecution( MojoExecutionEvent event )
-    {
-        final String executionKey = CacheUtils.mojoExecutionKey( event.getExecution() );
-        LOGGER.debug( "Starting mojo execution: {}, class: {}", executionKey, event.getMojo().getClass() );
+    public void beforeMojoExecution(MojoExecutionEvent event) {
+        final String executionKey = CacheUtils.mojoExecutionKey(event.getExecution());
+        LOGGER.debug(
+                "Starting mojo execution: {}, class: {}",
+                executionKey,
+                event.getMojo().getClass());
         final MavenProject project = event.getProject();
-        Map<String, MojoExecutionEvent> projectEvents = projectExecutions.get( project );
-        if ( projectEvents == null )
-        {
+        Map<String, MojoExecutionEvent> projectEvents = projectExecutions.get(project);
+        if (projectEvents == null) {
             Map<String, MojoExecutionEvent> candidate = new ConcurrentHashMap<>();
-            projectEvents = projectExecutions.putIfAbsent( project, candidate );
-            if ( projectEvents == null )
-            {
+            projectEvents = projectExecutions.putIfAbsent(project, candidate);
+            if (projectEvents == null) {
                 projectEvents = candidate;
             }
         }
-        projectEvents.put( executionKey, event );
+        projectEvents.put(executionKey, event);
     }
 
     @Override
-    public void afterMojoExecutionSuccess( MojoExecutionEvent event ) throws MojoExecutionException
-    {
+    public void afterMojoExecutionSuccess(MojoExecutionEvent event) throws MojoExecutionException {
         // do nothing
     }
 
     @Override
-    public void afterExecutionFailure( MojoExecutionEvent event )
-    {
-        //do nothing
+    public void afterExecutionFailure(MojoExecutionEvent event) {
+        // do nothing
     }
 
-    public Map<String, MojoExecutionEvent> getProjectExecutions( MavenProject project )
-    {
-        return projectExecutions.get( project );
+    public Map<String, MojoExecutionEvent> getProjectExecutions(MavenProject project) {
+        return projectExecutions.get(project);
     }
 
-    public void remove( MavenProject project )
-    {
-        projectExecutions.remove( project );
+    public void remove(MavenProject project) {
+        projectExecutions.remove(project);
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/MultiModuleSupport.java b/src/main/java/org/apache/maven/buildcache/MultiModuleSupport.java
index b90512c..0265226 100644
--- a/src/main/java/org/apache/maven/buildcache/MultiModuleSupport.java
+++ b/src/main/java/org/apache/maven/buildcache/MultiModuleSupport.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -19,15 +19,14 @@
 package org.apache.maven.buildcache;
 
 import java.util.Optional;
-import org.apache.maven.project.MavenProject;
 
-public interface MultiModuleSupport
-{
+import org.apache.maven.project.MavenProject;
 
-    Optional<MavenProject> tryToResolveProject( String groupId, String artifactId, String version );
+public interface MultiModuleSupport {
 
-    boolean isPartOfMultiModule( String groupId, String artifactId, String version );
+    Optional<MavenProject> tryToResolveProject(String groupId, String artifactId, String version);
 
-    boolean isPartOfSession( String groupId, String artifactId, String version );
+    boolean isPartOfMultiModule(String groupId, String artifactId, String version);
 
+    boolean isPartOfSession(String groupId, String artifactId, String version);
 }
diff --git a/src/main/java/org/apache/maven/buildcache/NormalizedModelProvider.java b/src/main/java/org/apache/maven/buildcache/NormalizedModelProvider.java
index b72d998..d81c26a 100644
--- a/src/main/java/org/apache/maven/buildcache/NormalizedModelProvider.java
+++ b/src/main/java/org/apache/maven/buildcache/NormalizedModelProvider.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -27,13 +27,11 @@ import org.apache.maven.project.MavenProject;
  * only project version for example build 1 : 1.0-SNAPSHOT, build 2 : 2.0-SNAPSHOT in this case 2nd build could be
  * completely restored from cache.
  */
-public interface NormalizedModelProvider
-{
+public interface NormalizedModelProvider {
 
     /**
      * @param  project - the project which model will be calculated for
      * @return         normalized model for project
      */
-    Model normalizedModel( MavenProject project );
-
+    Model normalizedModel(MavenProject project);
 }
diff --git a/src/main/java/org/apache/maven/buildcache/PluginScanConfig.java b/src/main/java/org/apache/maven/buildcache/PluginScanConfig.java
index a238803..80e94ab 100644
--- a/src/main/java/org/apache/maven/buildcache/PluginScanConfig.java
+++ b/src/main/java/org/apache/maven/buildcache/PluginScanConfig.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -19,22 +19,22 @@
 package org.apache.maven.buildcache;
 
 import javax.annotation.Nonnull;
+
 import org.apache.maven.buildcache.xml.config.DirScanConfig;
 
 /**
  * PluginScanConfig
  */
-public interface PluginScanConfig
-{
+public interface PluginScanConfig {
 
     boolean isSkip();
 
-    boolean accept( String propertyName );
+    boolean accept(String propertyName);
 
-    PluginScanConfig mergeWith( PluginScanConfig overrideSource );
+    PluginScanConfig mergeWith(PluginScanConfig overrideSource);
 
     @Nonnull
-    ScanConfigProperties getTagScanProperties( String tagName );
+    ScanConfigProperties getTagScanProperties(String tagName);
 
     DirScanConfig dto();
 }
diff --git a/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java b/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java
index a311f21..9f59dc5 100644
--- a/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,8 +18,10 @@
  */
 package org.apache.maven.buildcache;
 
-import java.util.List;
 import javax.annotation.Nonnull;
+
+import java.util.List;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.buildcache.xml.config.DirScanConfig;
 import org.apache.maven.buildcache.xml.config.TagExclude;
@@ -28,43 +30,35 @@ import org.apache.maven.buildcache.xml.config.TagScanConfig;
 /**
  * PluginScanConfigImpl
  */
-public class PluginScanConfigImpl implements PluginScanConfig
-{
+public class PluginScanConfigImpl implements PluginScanConfig {
 
     private final DirScanConfig dto;
 
-    public PluginScanConfigImpl( DirScanConfig scanConfig )
-    {
+    public PluginScanConfigImpl(DirScanConfig scanConfig) {
         this.dto = scanConfig;
     }
 
     @Override
-    public boolean isSkip()
-    {
-        return StringUtils.equals( dto.getMode(), "skip" );
+    public boolean isSkip() {
+        return StringUtils.equals(dto.getMode(), "skip");
     }
 
     @Override
-    public boolean accept( String tagName )
-    {
+    public boolean accept(String tagName) {
         // include or exclude is a choice element, could be only obe property set
 
         //noinspection ConstantConditions
         final List<TagScanConfig> includes = dto.getIncludes();
-        if ( !includes.isEmpty() )
-        {
-            return findTagScanProperties( tagName ) != null;
+        if (!includes.isEmpty()) {
+            return findTagScanProperties(tagName) != null;
         }
 
-        return !contains( dto.getExcludes(), tagName );
+        return !contains(dto.getExcludes(), tagName);
     }
 
-    private boolean contains( List<TagExclude> excludes, String tagName )
-    {
-        for ( TagExclude exclude : excludes )
-        {
-            if ( StringUtils.equals( exclude.getTagName(), tagName ) )
-            {
+    private boolean contains(List<TagExclude> excludes, String tagName) {
+        for (TagExclude exclude : excludes) {
+            if (StringUtils.equals(exclude.getTagName(), tagName)) {
                 return true;
             }
         }
@@ -73,85 +67,69 @@ public class PluginScanConfigImpl implements PluginScanConfig
 
     @Nonnull
     @Override
-    public PluginScanConfig mergeWith( final PluginScanConfig overrideConfig )
-    {
-        if ( dto == null )
-        {
+    public PluginScanConfig mergeWith(final PluginScanConfig overrideConfig) {
+        if (dto == null) {
             return overrideConfig;
         }
 
         final DirScanConfig override = overrideConfig.dto();
-        if ( override == null )
-        {
+        if (override == null) {
             return this;
         }
 
-        if ( override.isIgnoreParent() )
-        {
+        if (override.isIgnoreParent()) {
             return overrideConfig;
         }
 
         DirScanConfig merged = new DirScanConfig();
-        if ( override.getMode() != null )
-        {
-            merged.setMode( override.getMode() );
-        }
-        else
-        {
-            merged.setMode( dto.getMode() );
+        if (override.getMode() != null) {
+            merged.setMode(override.getMode());
+        } else {
+            merged.setMode(dto.getMode());
         }
 
-        merged.getExcludes().addAll( dto.getExcludes() );
-        merged.getExcludes().addAll( override.getExcludes() );
+        merged.getExcludes().addAll(dto.getExcludes());
+        merged.getExcludes().addAll(override.getExcludes());
 
-        merged.getIncludes().addAll( dto.getIncludes() );
-        merged.getIncludes().addAll( override.getIncludes() );
+        merged.getIncludes().addAll(dto.getIncludes());
+        merged.getIncludes().addAll(override.getIncludes());
 
-        return new PluginScanConfigImpl( merged );
+        return new PluginScanConfigImpl(merged);
     }
 
     @Nonnull
-    public ScanConfigProperties getTagScanProperties( String tagName )
-    {
-        ScanConfigProperties scanProperties = findTagScanProperties( tagName );
+    public ScanConfigProperties getTagScanProperties(String tagName) {
+        ScanConfigProperties scanProperties = findTagScanProperties(tagName);
         return scanProperties != null ? scanProperties : defaultScanConfig();
     }
 
     @Override
-    public DirScanConfig dto()
-    {
+    public DirScanConfig dto() {
         return dto;
     }
 
-    private ScanConfigProperties findTagScanProperties( String tagName )
-    {
-        ScanConfigProperties scanConfigProperties = findConfigByName( tagName, dto.getIncludes() );
-        if ( scanConfigProperties == null )
-        {
-            scanConfigProperties = findConfigByName( tagName, dto.getTagScanConfigs() );
+    private ScanConfigProperties findTagScanProperties(String tagName) {
+        ScanConfigProperties scanConfigProperties = findConfigByName(tagName, dto.getIncludes());
+        if (scanConfigProperties == null) {
+            scanConfigProperties = findConfigByName(tagName, dto.getTagScanConfigs());
         }
         return scanConfigProperties;
     }
 
-    private ScanConfigProperties findConfigByName( String tagName, List<TagScanConfig> configs )
-    {
-        if ( configs == null )
-        {
+    private ScanConfigProperties findConfigByName(String tagName, List<TagScanConfig> configs) {
+        if (configs == null) {
             return null;
         }
 
-        for ( TagScanConfig config : configs )
-        {
-            if ( StringUtils.equals( tagName, config.getTagName() ) )
-            {
-                return new ScanConfigProperties( config.isRecursive(), config.getGlob() );
+        for (TagScanConfig config : configs) {
+            if (StringUtils.equals(tagName, config.getTagName())) {
+                return new ScanConfigProperties(config.isRecursive(), config.getGlob());
             }
         }
         return null;
     }
 
-    private static ScanConfigProperties defaultScanConfig()
-    {
-        return new ScanConfigProperties( true, null );
+    private static ScanConfigProperties defaultScanConfig() {
+        return new ScanConfigProperties(true, null);
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/ProjectInputCalculator.java b/src/main/java/org/apache/maven/buildcache/ProjectInputCalculator.java
index 4552210..c7a3602 100644
--- a/src/main/java/org/apache/maven/buildcache/ProjectInputCalculator.java
+++ b/src/main/java/org/apache/maven/buildcache/ProjectInputCalculator.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -24,9 +24,7 @@ import org.apache.maven.project.MavenProject;
 /**
  *
  */
-public interface ProjectInputCalculator
-{
-
-    ProjectsInputInfo calculateInput( MavenProject project );
+public interface ProjectInputCalculator {
 
+    ProjectsInputInfo calculateInput(MavenProject project);
 }
diff --git a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepository.java b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepository.java
index 2615803..b2fafc5 100644
--- a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepository.java
+++ b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepository.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,10 +18,12 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+
 import org.apache.maven.buildcache.xml.Build;
 import org.apache.maven.buildcache.xml.build.Artifact;
 import org.apache.maven.project.MavenProject;
@@ -29,8 +31,7 @@ import org.apache.maven.project.MavenProject;
 /**
  * Remote cache repository.
  */
-public interface RemoteCacheRepository extends CacheRepository
-{
+public interface RemoteCacheRepository extends CacheRepository {
 
     String BUILDINFO_XML = "buildinfo.xml";
     String CACHE_REPORT_XML = "build-cache-report.xml";
@@ -40,11 +41,11 @@ public interface RemoteCacheRepository extends CacheRepository
      * Returns <code>true</code> if success, <code>false</code> if the artifact does not exists
      * and throws an <code>IOException</code> if a problem occurs.
      */
-    boolean getArtifactContent( CacheContext context, Artifact artifact, Path target ) throws IOException;
+    boolean getArtifactContent(CacheContext context, Artifact artifact, Path target) throws IOException;
 
     @Nonnull
-    String getResourceUrl( CacheContext context, String filename );
+    String getResourceUrl(CacheContext context, String filename);
 
     @Nonnull
-    Optional<Build> findBaselineBuild( MavenProject project );
+    Optional<Build> findBaselineBuild(MavenProject project);
 }
diff --git a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java
index c058757..9a39723 100644
--- a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,6 +18,10 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+import javax.inject.Named;
+
 import java.io.Closeable;
 import java.io.File;
 import java.io.IOException;
@@ -27,9 +31,7 @@ import java.nio.file.Path;
 import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicReference;
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
-import javax.inject.Named;
+
 import org.apache.maven.SessionScoped;
 import org.apache.maven.buildcache.checksum.MavenProjectInput;
 import org.apache.maven.buildcache.xml.Build;
@@ -56,11 +58,10 @@ import org.slf4j.LoggerFactory;
  * Remote cache repository implementation.
  */
 @SessionScoped
-@Named( "resolver" )
-public class RemoteCacheRepositoryImpl implements RemoteCacheRepository, Closeable
-{
+@Named("resolver")
+public class RemoteCacheRepositoryImpl implements RemoteCacheRepository, Closeable {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( RemoteCacheRepositoryImpl.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(RemoteCacheRepositoryImpl.class);
 
     private final XmlService xmlService;
     private final CacheConfig cacheConfig;
@@ -71,83 +72,71 @@ public class RemoteCacheRepositoryImpl implements RemoteCacheRepository, Closeab
             XmlService xmlService,
             CacheConfig cacheConfig,
             MavenSession mavenSession,
-            TransporterProvider transporterProvider )
-            throws Exception
-    {
+            TransporterProvider transporterProvider)
+            throws Exception {
         this.xmlService = xmlService;
         this.cacheConfig = cacheConfig;
-        if ( cacheConfig.isRemoteCacheEnabled() )
-        {
+        if (cacheConfig.isRemoteCacheEnabled()) {
             RepositorySystemSession session = mavenSession.getRepositorySession();
-            RemoteRepository repo = new RemoteRepository.Builder(
-                    cacheConfig.getId(), "cache", cacheConfig.getUrl() ).build();
-            RemoteRepository mirror = session.getMirrorSelector().getMirror( repo );
+            RemoteRepository repo =
+                    new RemoteRepository.Builder(cacheConfig.getId(), "cache", cacheConfig.getUrl()).build();
+            RemoteRepository mirror = session.getMirrorSelector().getMirror(repo);
             RemoteRepository repoOrMirror = mirror != null ? mirror : repo;
-            Proxy proxy = session.getProxySelector().getProxy( repoOrMirror );
-            Authentication auth = session.getAuthenticationSelector().getAuthentication( repoOrMirror );
-            RemoteRepository repository = new RemoteRepository.Builder( repoOrMirror )
-                    .setProxy( proxy )
-                    .setAuthentication( auth )
+            Proxy proxy = session.getProxySelector().getProxy(repoOrMirror);
+            Authentication auth = session.getAuthenticationSelector().getAuthentication(repoOrMirror);
+            RemoteRepository repository = new RemoteRepository.Builder(repoOrMirror)
+                    .setProxy(proxy)
+                    .setAuthentication(auth)
                     .build();
-            this.transporter = transporterProvider.newTransporter( session, repository );
-        }
-        else
-        {
+            this.transporter = transporterProvider.newTransporter(session, repository);
+        } else {
             this.transporter = null;
         }
     }
 
     @Override
-    public void close() throws IOException
-    {
-        if ( transporter != null )
-        {
+    public void close() throws IOException {
+        if (transporter != null) {
             transporter.close();
         }
     }
 
     @Nonnull
     @Override
-    public Optional<Build> findBuild( CacheContext context ) throws IOException
-    {
-        final String resourceUrl = getResourceUrl( context, BUILDINFO_XML );
-        return getResourceContent( resourceUrl )
-                .map( content -> new Build( xmlService.loadBuild( content ), CacheSource.REMOTE ) );
+    public Optional<Build> findBuild(CacheContext context) throws IOException {
+        final String resourceUrl = getResourceUrl(context, BUILDINFO_XML);
+        return getResourceContent(resourceUrl)
+                .map(content -> new Build(xmlService.loadBuild(content), CacheSource.REMOTE));
     }
 
     @Nonnull
     @Override
-    public boolean getArtifactContent( CacheContext context, Artifact artifact, Path target ) throws IOException
-    {
-        return getResourceContent( getResourceUrl( context, artifact.getFileName() ), target );
+    public boolean getArtifactContent(CacheContext context, Artifact artifact, Path target) throws IOException {
+        return getResourceContent(getResourceUrl(context, artifact.getFileName()), target);
     }
 
     @Override
-    public void saveBuildInfo( CacheResult cacheResult, Build build )
-            throws IOException
-    {
-        final String resourceUrl = getResourceUrl( cacheResult.getContext(), BUILDINFO_XML );
-        putToRemoteCache( xmlService.toBytes( build.getDto() ), resourceUrl );
+    public void saveBuildInfo(CacheResult cacheResult, Build build) throws IOException {
+        final String resourceUrl = getResourceUrl(cacheResult.getContext(), BUILDINFO_XML);
+        putToRemoteCache(xmlService.toBytes(build.getDto()), resourceUrl);
     }
 
     @Override
-    public void saveCacheReport( String buildId, MavenSession session, CacheReport cacheReport ) throws IOException
-    {
+    public void saveCacheReport(String buildId, MavenSession session, CacheReport cacheReport) throws IOException {
         MavenProject rootProject = session.getTopLevelProject();
         final String resourceUrl = MavenProjectInput.CACHE_IMPLEMENTATION_VERSION
                 + "/" + rootProject.getGroupId()
                 + "/" + rootProject.getArtifactId()
                 + "/" + buildId
                 + "/" + CACHE_REPORT_XML;
-        putToRemoteCache( xmlService.toBytes( cacheReport ), resourceUrl );
+        putToRemoteCache(xmlService.toBytes(cacheReport), resourceUrl);
     }
 
     @Override
-    public void saveArtifactFile( CacheResult cacheResult,
-            org.apache.maven.artifact.Artifact artifact ) throws IOException
-    {
-        final String resourceUrl = getResourceUrl( cacheResult.getContext(), CacheUtils.normalizedName( artifact ) );
-        putToRemoteCache( artifact.getFile(), resourceUrl );
+    public void saveArtifactFile(CacheResult cacheResult, org.apache.maven.artifact.Artifact artifact)
+            throws IOException {
+        final String resourceUrl = getResourceUrl(cacheResult.getContext(), CacheUtils.normalizedName(artifact));
+        putToRemoteCache(artifact.getFile(), resourceUrl);
     }
 
     /**
@@ -156,85 +145,68 @@ public class RemoteCacheRepositoryImpl implements RemoteCacheRepository, Closeab
      * @return null or content
      */
     @Nonnull
-    public Optional<byte[]> getResourceContent( String url ) throws IOException
-    {
-        try
-        {
-            LOGGER.info( "Downloading {}", getFullUrl( url ) );
-            GetTask task = new GetTask( new URI( url ) );
-            transporter.get( task );
-            return Optional.of( task.getDataBytes() );
-        }
-        catch ( Exception e )
-        {
-            LOGGER.info( "Cannot download {}", getFullUrl( url ), e );
+    public Optional<byte[]> getResourceContent(String url) throws IOException {
+        try {
+            LOGGER.info("Downloading {}", getFullUrl(url));
+            GetTask task = new GetTask(new URI(url));
+            transporter.get(task);
+            return Optional.of(task.getDataBytes());
+        } catch (Exception e) {
+            LOGGER.info("Cannot download {}", getFullUrl(url), e);
             return Optional.empty();
         }
     }
 
-    public boolean getResourceContent( String url, Path target ) throws IOException
-    {
-        try
-        {
-            LOGGER.info( "Downloading {}", getFullUrl( url ) );
-            GetTask task = new GetTask( new URI( url ) ).setDataFile( target.toFile() );
-            transporter.get( task );
+    public boolean getResourceContent(String url, Path target) throws IOException {
+        try {
+            LOGGER.info("Downloading {}", getFullUrl(url));
+            GetTask task = new GetTask(new URI(url)).setDataFile(target.toFile());
+            transporter.get(task);
             return true;
-        }
-        catch ( Exception e )
-        {
-            LOGGER.info( "Cannot download {}: {}", getFullUrl( url ), e.toString() );
+        } catch (Exception e) {
+            LOGGER.info("Cannot download {}: {}", getFullUrl(url), e.toString());
             return false;
         }
     }
 
     @Nonnull
     @Override
-    public String getResourceUrl( CacheContext context, String filename )
-    {
-        return getResourceUrl( filename, context.getProject().getGroupId(), context.getProject().getArtifactId(),
-                context.getInputInfo().getChecksum() );
+    public String getResourceUrl(CacheContext context, String filename) {
+        return getResourceUrl(
+                filename,
+                context.getProject().getGroupId(),
+                context.getProject().getArtifactId(),
+                context.getInputInfo().getChecksum());
     }
 
-    private String getResourceUrl( String filename, String groupId, String artifactId, String checksum )
-    {
-        return MavenProjectInput.CACHE_IMPLEMENTATION_VERSION + "/" + groupId + "/"
-                + artifactId + "/" + checksum + "/" + filename;
+    private String getResourceUrl(String filename, String groupId, String artifactId, String checksum) {
+        return MavenProjectInput.CACHE_IMPLEMENTATION_VERSION + "/" + groupId + "/" + artifactId + "/" + checksum + "/"
+                + filename;
     }
 
-    private void putToRemoteCache( byte[] bytes, String url ) throws IOException
-    {
-        Path tmp = Files.createTempFile( "mbce-", ".tmp" );
-        try
-        {
-            Files.write( tmp, bytes );
-            PutTask put = new PutTask( new URI( url ) );
-            put.setDataFile( tmp.toFile() );
-            transporter.put( put );
-            LOGGER.info( "Saved to remote cache {}", getFullUrl( url ) );
-        }
-        catch ( Exception e )
-        {
-            LOGGER.info( "Unable to save to remote cache {}", getFullUrl( url ), e );
-        }
-        finally
-        {
-            Files.deleteIfExists( tmp );
+    private void putToRemoteCache(byte[] bytes, String url) throws IOException {
+        Path tmp = Files.createTempFile("mbce-", ".tmp");
+        try {
+            Files.write(tmp, bytes);
+            PutTask put = new PutTask(new URI(url));
+            put.setDataFile(tmp.toFile());
+            transporter.put(put);
+            LOGGER.info("Saved to remote cache {}", getFullUrl(url));
+        } catch (Exception e) {
+            LOGGER.info("Unable to save to remote cache {}", getFullUrl(url), e);
+        } finally {
+            Files.deleteIfExists(tmp);
         }
     }
 
-    private void putToRemoteCache( File file, String url ) throws IOException
-    {
-        try
-        {
-            PutTask put = new PutTask( new URI( url ) );
-            put.setDataFile( file );
-            transporter.put( put );
-            LOGGER.info( "Saved to remote cache {}", getFullUrl( url ) );
-        }
-        catch ( Exception e )
-        {
-            LOGGER.info( "Unable to save to remote cache {}", getFullUrl( url ), e );
+    private void putToRemoteCache(File file, String url) throws IOException {
+        try {
+            PutTask put = new PutTask(new URI(url));
+            put.setDataFile(file);
+            transporter.put(put);
+            LOGGER.info("Saved to remote cache {}", getFullUrl(url));
+        } catch (Exception e) {
+            LOGGER.info("Unable to save to remote cache {}", getFullUrl(url), e);
         }
     }
 
@@ -242,78 +214,62 @@ public class RemoteCacheRepositoryImpl implements RemoteCacheRepository, Closeab
 
     @Nonnull
     @Override
-    public Optional<Build> findBaselineBuild( MavenProject project )
-    {
-        Optional<List<ProjectReport>> cachedProjectsHolder = findCacheInfo()
-                .map( CacheReport::getProjects );
+    public Optional<Build> findBaselineBuild(MavenProject project) {
+        Optional<List<ProjectReport>> cachedProjectsHolder = findCacheInfo().map(CacheReport::getProjects);
 
-        if ( !cachedProjectsHolder.isPresent() )
-        {
+        if (!cachedProjectsHolder.isPresent()) {
             return Optional.empty();
         }
 
         final List<ProjectReport> projects = cachedProjectsHolder.get();
         final Optional<ProjectReport> projectReportHolder = projects.stream()
-                .filter( p -> project.getArtifactId().equals( p.getArtifactId() )
-                        && project.getGroupId().equals( p.getGroupId() ) )
+                .filter(p -> project.getArtifactId().equals(p.getArtifactId())
+                        && project.getGroupId().equals(p.getGroupId()))
                 .findFirst();
 
-        if ( !projectReportHolder.isPresent() )
-        {
+        if (!projectReportHolder.isPresent()) {
             return Optional.empty();
         }
 
         final ProjectReport projectReport = projectReportHolder.get();
 
         String url;
-        if ( projectReport.getUrl() != null )
-        {
+        if (projectReport.getUrl() != null) {
             url = projectReport.getUrl();
-            LOGGER.info( "Retrieving baseline buildinfo: {}", url );
-        }
-        else
-        {
-            url = getResourceUrl( BUILDINFO_XML, project.getGroupId(),
-                    project.getArtifactId(), projectReport.getChecksum() );
-            LOGGER.info( "Baseline project record doesn't have url, trying default location {}", url );
+            LOGGER.info("Retrieving baseline buildinfo: {}", url);
+        } else {
+            url = getResourceUrl(
+                    BUILDINFO_XML, project.getGroupId(), project.getArtifactId(), projectReport.getChecksum());
+            LOGGER.info("Baseline project record doesn't have url, trying default location {}", url);
         }
 
-        try
-        {
-            return getResourceContent( url )
-                    .map( content -> new Build( xmlService.loadBuild( content ), CacheSource.REMOTE ) );
-        }
-        catch ( Exception e )
-        {
-            LOGGER.warn( "Error restoring baseline build at url: {}, skipping diff", url, e );
+        try {
+            return getResourceContent(url).map(content -> new Build(xmlService.loadBuild(content), CacheSource.REMOTE));
+        } catch (Exception e) {
+            LOGGER.warn("Error restoring baseline build at url: {}, skipping diff", url, e);
             return Optional.empty();
         }
     }
 
-    private Optional<CacheReport> findCacheInfo()
-    {
-        Optional<CacheReport> report = Optional.ofNullable( cacheReportSupplier.get() );
-        if ( !report.isPresent() )
-        {
-            try
-            {
-                LOGGER.info( "Downloading baseline cache report from: {}", cacheConfig.getBaselineCacheUrl() );
-                report = getResourceContent( cacheConfig.getBaselineCacheUrl() ).map( xmlService::loadCacheReport );
-            }
-            catch ( Exception e )
-            {
-                LOGGER.error( "Error downloading baseline report from: {}, skipping diff.",
-                        cacheConfig.getBaselineCacheUrl(), e );
+    private Optional<CacheReport> findCacheInfo() {
+        Optional<CacheReport> report = Optional.ofNullable(cacheReportSupplier.get());
+        if (!report.isPresent()) {
+            try {
+                LOGGER.info("Downloading baseline cache report from: {}", cacheConfig.getBaselineCacheUrl());
+                report = getResourceContent(cacheConfig.getBaselineCacheUrl()).map(xmlService::loadCacheReport);
+            } catch (Exception e) {
+                LOGGER.error(
+                        "Error downloading baseline report from: {}, skipping diff.",
+                        cacheConfig.getBaselineCacheUrl(),
+                        e);
                 report = Optional.empty();
             }
-            cacheReportSupplier.compareAndSet( null, report.orElse( null ) );
+            cacheReportSupplier.compareAndSet(null, report.orElse(null));
         }
         return report;
     }
 
-    private String getFullUrl( String url )
-    {
+    private String getFullUrl(String url) {
         return cacheConfig.getUrl() + "/" + url;
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryNoOp.java b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryNoOp.java
index a1bc8cc..3808696 100644
--- a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryNoOp.java
+++ b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryNoOp.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,11 +18,13 @@
  */
 package org.apache.maven.buildcache;
 
+import javax.annotation.Nonnull;
+import javax.inject.Named;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.Optional;
-import javax.annotation.Nonnull;
-import javax.inject.Named;
+
 import org.apache.maven.SessionScoped;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.buildcache.xml.Build;
@@ -31,53 +33,40 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.project.MavenProject;
 
 @SessionScoped
-@Named( "noop" )
-public class RemoteCacheRepositoryNoOp implements RemoteCacheRepository
-{
+@Named("noop")
+public class RemoteCacheRepositoryNoOp implements RemoteCacheRepository {
 
     @Nonnull
     @Override
-    public Optional<Build> findBuild( CacheContext context ) throws IOException
-    {
+    public Optional<Build> findBuild(CacheContext context) throws IOException {
         return Optional.empty();
     }
 
     @Override
-    public void saveBuildInfo( CacheResult cacheResult, Build build ) throws IOException
-    {
-
-    }
+    public void saveBuildInfo(CacheResult cacheResult, Build build) throws IOException {}
 
     @Override
-    public void saveArtifactFile( CacheResult cacheResult, Artifact artifact ) throws IOException
-    {
-
-    }
+    public void saveArtifactFile(CacheResult cacheResult, Artifact artifact) throws IOException {}
 
     @Override
-    public void saveCacheReport( String buildId, MavenSession session, CacheReport cacheReport ) throws IOException
-    {
-
-    }
+    public void saveCacheReport(String buildId, MavenSession session, CacheReport cacheReport) throws IOException {}
 
     @Override
-    public boolean getArtifactContent( CacheContext context, org.apache.maven.buildcache.xml.build.Artifact artifact,
-            Path target ) throws IOException
-    {
+    public boolean getArtifactContent(
+            CacheContext context, org.apache.maven.buildcache.xml.build.Artifact artifact, Path target)
+            throws IOException {
         return false;
     }
 
     @Nonnull
     @Override
-    public String getResourceUrl( CacheContext context, String filename )
-    {
+    public String getResourceUrl(CacheContext context, String filename) {
         return null;
     }
 
     @Nonnull
     @Override
-    public Optional<Build> findBaselineBuild( MavenProject project )
-    {
+    public Optional<Build> findBaselineBuild(MavenProject project) {
         return Optional.empty();
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryProvider.java b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryProvider.java
index 9682ae8..1dac0a0 100644
--- a/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryProvider.java
+++ b/src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryProvider.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -23,6 +23,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import javax.inject.Provider;
 import javax.inject.Singleton;
+
 import org.apache.maven.buildcache.xml.CacheConfig;
 import org.apache.maven.buildcache.xml.CacheState;
 import org.codehaus.plexus.PlexusContainer;
@@ -32,29 +33,24 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
  * Remote cache repository.
  */
 @Singleton
-@Named( "#factory#" )
-@Priority( 10 )
-public class RemoteCacheRepositoryProvider implements Provider<RemoteCacheRepository>
-{
+@Named("#factory#")
+@Priority(10)
+public class RemoteCacheRepositoryProvider implements Provider<RemoteCacheRepository> {
 
     private final RemoteCacheRepository repository;
 
     @Inject
-    public RemoteCacheRepositoryProvider( CacheConfig config, PlexusContainer container )
-            throws ComponentLookupException
-    {
+    public RemoteCacheRepositoryProvider(CacheConfig config, PlexusContainer container)
+            throws ComponentLookupException {
         String hint = "noop";
-        if ( config.initialize() == CacheState.INITIALIZED )
-        {
+        if (config.initialize() == CacheState.INITIALIZED) {
             hint = config.getTransport();
         }
 
-        repository = container.lookup( RemoteCacheRepository.class, hint );
+        repository = container.lookup(RemoteCacheRepository.class, hint);
     }
 
-    public RemoteCacheRepository get()
-    {
+    public RemoteCacheRepository get() {
         return repository;
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/RestoreStatus.java b/src/main/java/org/apache/maven/buildcache/RestoreStatus.java
index 50de5e7..8855aa8 100644
--- a/src/main/java/org/apache/maven/buildcache/RestoreStatus.java
+++ b/src/main/java/org/apache/maven/buildcache/RestoreStatus.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -21,8 +21,7 @@ package org.apache.maven.buildcache;
 /**
  * RestoreStatus
  */
-public enum RestoreStatus
-{
+public enum RestoreStatus {
     EMPTY,
     FAILURE,
     PARTIAL,
diff --git a/src/main/java/org/apache/maven/buildcache/RestoredArtifactHandler.java b/src/main/java/org/apache/maven/buildcache/RestoredArtifactHandler.java
index e22b63c..8158c75 100644
--- a/src/main/java/org/apache/maven/buildcache/RestoredArtifactHandler.java
+++ b/src/main/java/org/apache/maven/buildcache/RestoredArtifactHandler.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -20,15 +20,15 @@ package org.apache.maven.buildcache;
 
 import java.io.IOException;
 import java.nio.file.Path;
+
 import org.apache.maven.project.MavenProject;
 
-public interface RestoredArtifactHandler
-{
+public interface RestoredArtifactHandler {
 
-    //we might store in cache artifact which was build with previous version
-    //1.0-SNAPSHOT is kept in cache but real version of project is 2.0
-    //for pom packaging this is done automatically by maven but for jar and other there might be
-    //sensitive metadata with previous version. Versions mismatch could lead errors
-    Path adjustArchiveArtifactVersion( MavenProject project, String originalArtifactVersion, Path artifactFile )
+    // we might store in cache artifact which was build with previous version
+    // 1.0-SNAPSHOT is kept in cache but real version of project is 2.0
+    // for pom packaging this is done automatically by maven but for jar and other there might be
+    // sensitive metadata with previous version. Versions mismatch could lead errors
+    Path adjustArchiveArtifactVersion(MavenProject project, String originalArtifactVersion, Path artifactFile)
             throws IOException;
 }
diff --git a/src/main/java/org/apache/maven/buildcache/ScanConfigProperties.java b/src/main/java/org/apache/maven/buildcache/ScanConfigProperties.java
index 67afb49..d7d07a1 100644
--- a/src/main/java/org/apache/maven/buildcache/ScanConfigProperties.java
+++ b/src/main/java/org/apache/maven/buildcache/ScanConfigProperties.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -21,25 +21,21 @@ package org.apache.maven.buildcache;
 /**
  * ScanConfigProperties
  */
-public class ScanConfigProperties
-{
+public class ScanConfigProperties {
 
     private final boolean recursive;
     private final String glob;
 
-    public ScanConfigProperties( boolean recursive, String glob )
-    {
+    public ScanConfigProperties(boolean recursive, String glob) {
         this.recursive = recursive;
         this.glob = glob;
     }
 
-    public boolean isRecursive()
-    {
+    public boolean isRecursive() {
         return recursive;
     }
 
-    public String getGlob()
-    {
+    public String getGlob() {
         return glob;
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/Xpp3DomUtils.java b/src/main/java/org/apache/maven/buildcache/Xpp3DomUtils.java
index c4c389c..69efd63 100644
--- a/src/main/java/org/apache/maven/buildcache/Xpp3DomUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/Xpp3DomUtils.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -25,66 +25,46 @@ package org.apache.maven.buildcache;
  * extension uses both the XPP3 classes and other utility classes. We thus rely on
  * reflection for all access to plugin configuration.
  */
-public class Xpp3DomUtils
-{
+public class Xpp3DomUtils {
 
-    public static Object[] getChildren( Object node )
-    {
-        try
-        {
-            return ( Object[] ) node.getClass().getMethod( "getChildren" ).invoke( node );
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Error invoking Xpp3Dom.getChildren", e );
+    public static Object[] getChildren(Object node) {
+        try {
+            return (Object[]) node.getClass().getMethod("getChildren").invoke(node);
+        } catch (Exception e) {
+            throw new RuntimeException("Error invoking Xpp3Dom.getChildren", e);
         }
     }
 
-    public static String getName( Object node )
-    {
-        try
-        {
-            return ( String ) node.getClass().getMethod( "getName" ).invoke( node );
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Error invoking Xpp3Dom.getName", e );
+    public static String getName(Object node) {
+        try {
+            return (String) node.getClass().getMethod("getName").invoke(node);
+        } catch (Exception e) {
+            throw new RuntimeException("Error invoking Xpp3Dom.getName", e);
         }
     }
 
-    public static String getValue( Object node )
-    {
-        try
-        {
-            return ( String ) node.getClass().getMethod( "getValue" ).invoke( node );
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Error invoking Xpp3Dom.getValue", e );
+    public static String getValue(Object node) {
+        try {
+            return (String) node.getClass().getMethod("getValue").invoke(node);
+        } catch (Exception e) {
+            throw new RuntimeException("Error invoking Xpp3Dom.getValue", e);
         }
     }
 
-    public static void removeChild( Object node, int index )
-    {
-        try
-        {
-            node.getClass().getMethod( "removeChild", int.class ).invoke( node, index );
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Error invoking Xpp3Dom.removeChild", e );
+    public static void removeChild(Object node, int index) {
+        try {
+            node.getClass().getMethod("removeChild", int.class).invoke(node, index);
+        } catch (Exception e) {
+            throw new RuntimeException("Error invoking Xpp3Dom.removeChild", e);
         }
     }
 
-    public static String getAttribute( Object node, String attribute )
-    {
-        try
-        {
-            return ( String ) node.getClass().getMethod( "getAttribute", String.class ).invoke( node, attribute );
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Error invoking Xpp3Dom.getAttribute", e );
+    public static String getAttribute(Object node, String attribute) {
+        try {
+            return (String)
+                    node.getClass().getMethod("getAttribute", String.class).invoke(node, attribute);
+        } catch (Exception e) {
+            throw new RuntimeException("Error invoking Xpp3Dom.getAttribute", e);
         }
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/artifact/RestoredArtifact.java b/src/main/java/org/apache/maven/buildcache/artifact/RestoredArtifact.java
index 198ac2a..7727ee2 100644
--- a/src/main/java/org/apache/maven/buildcache/artifact/RestoredArtifact.java
+++ b/src/main/java/org/apache/maven/buildcache/artifact/RestoredArtifact.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -23,6 +23,7 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.RunnableFuture;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.InvalidArtifactRTException;
@@ -36,73 +37,78 @@ import static java.util.Objects.requireNonNull;
  * Overrides default file behavior with async file holder to restore files from cache lazy. Similar to {@link
  * org.apache.maven.project.artifact.AttachedArtifact}
  */
-public class RestoredArtifact extends DefaultArtifact
-{
+public class RestoredArtifact extends DefaultArtifact {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( RestoredArtifact.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(RestoredArtifact.class);
 
     private volatile Future<File> fileFuture;
 
-    public RestoredArtifact( Artifact parent, Future<File> fileFuture, String type, String classifier,
-            ArtifactHandler handler )
-    {
-        super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
-                classifier, handler, parent.isOptional() );
-        this.fileFuture = requireNonNull( fileFuture, "fileFuture == null" );
+    public RestoredArtifact(
+            Artifact parent, Future<File> fileFuture, String type, String classifier, ArtifactHandler handler) {
+        super(
+                parent.getGroupId(),
+                parent.getArtifactId(),
+                parent.getVersionRange(),
+                parent.getScope(),
+                type,
+                classifier,
+                handler,
+                parent.isOptional());
+        this.fileFuture = requireNonNull(fileFuture, "fileFuture == null");
     }
 
     /**
      * Returns file using caller thread to download it if necessary
      */
     @Override
-    public File getFile()
-    {
+    public File getFile() {
 
-        if ( !fileFuture.isDone() )
-        {
-            if ( fileFuture instanceof RunnableFuture )
-            {
-                try
-                {
-                    LOGGER.trace( "Artifact file {} is not yet retrieved, downloading directly",
-                            getDependencyConflictId() );
-                    ( ( RunnableFuture<?> ) fileFuture ).run();
-                }
-                catch ( RuntimeException e )
-                {
-                    throw new InvalidArtifactRTException( getGroupId(), getArtifactId(),
-                            getVersion(), getType(),
-                            "Error retrieving artifact file", e );
+        if (!fileFuture.isDone()) {
+            if (fileFuture instanceof RunnableFuture) {
+                try {
+                    LOGGER.trace(
+                            "Artifact file {} is not yet retrieved, downloading directly", getDependencyConflictId());
+                    ((RunnableFuture<?>) fileFuture).run();
+                } catch (RuntimeException e) {
+                    throw new InvalidArtifactRTException(
+                            getGroupId(),
+                            getArtifactId(),
+                            getVersion(),
+                            getType(),
+                            "Error retrieving artifact file",
+                            e);
                 }
-            }
-            else
-            {
-                LOGGER.trace( "Artifact file {} is not yet retrieved, waiting for download to complete",
-                        getDependencyConflictId() );
+            } else {
+                LOGGER.trace(
+                        "Artifact file {} is not yet retrieved, waiting for download to complete",
+                        getDependencyConflictId());
             }
         }
 
-        try
-        {
+        try {
             return fileFuture.get();
-        }
-        catch ( InterruptedException e )
-        {
+        } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
-            throw new InvalidArtifactRTException( getGroupId(), getArtifactId(),
-                    getVersion(), getType(), "Interrupted while retrieving artifact file", e );
-        }
-        catch ( ExecutionException e )
-        {
-            throw new InvalidArtifactRTException( getGroupId(), getArtifactId(),
-                    getVersion(), getType(), "Error retrieving artifact file",
-                    e.getCause() );
+            throw new InvalidArtifactRTException(
+                    getGroupId(),
+                    getArtifactId(),
+                    getVersion(),
+                    getType(),
+                    "Interrupted while retrieving artifact file",
+                    e);
+        } catch (ExecutionException e) {
+            throw new InvalidArtifactRTException(
+                    getGroupId(),
+                    getArtifactId(),
+                    getVersion(),
+                    getType(),
+                    "Error retrieving artifact file",
+                    e.getCause());
         }
     }
 
     @Override
-    public void setFile( File destination )
-    {
-        this.fileFuture = CompletableFuture.completedFuture( destination );
+    public void setFile(File destination) {
+        this.fileFuture = CompletableFuture.completedFuture(destination);
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/DependencyNotResolvedException.java b/src/main/java/org/apache/maven/buildcache/checksum/DependencyNotResolvedException.java
index e3b00f2..08ce775 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/DependencyNotResolvedException.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/DependencyNotResolvedException.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -21,11 +21,9 @@ package org.apache.maven.buildcache.checksum;
 /**
  * DependencyNotResolvedException
  */
-public class DependencyNotResolvedException extends RuntimeException
-{
+public class DependencyNotResolvedException extends RuntimeException {
 
-    public DependencyNotResolvedException( String message )
-    {
-        super( message );
+    public DependencyNotResolvedException(String message) {
+        super(message);
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java b/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java
index 9f54259..da0f3f2 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -24,6 +24,7 @@ import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
+
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.buildcache.hash.HashChecksum;
@@ -41,82 +42,73 @@ import static org.apache.commons.lang3.StringUtils.startsWithAny;
 /**
  * DigestUtils
  */
-public class DigestUtils
-{
+public class DigestUtils {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( DigestUtils.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(DigestUtils.class);
 
-    private static final ThreadLocal<UniversalDetector> ENCODING_DETECTOR = ThreadLocal
-            .withInitial( () -> new UniversalDetector( null ) );
+    private static final ThreadLocal<UniversalDetector> ENCODING_DETECTOR =
+            ThreadLocal.withInitial(() -> new UniversalDetector(null));
 
-    public static DigestItem pom( HashChecksum checksum, String effectivePom )
-    {
-        return item( "pom", effectivePom, checksum.update( effectivePom.getBytes( UTF_8 ) ) );
+    public static DigestItem pom(HashChecksum checksum, String effectivePom) {
+        return item("pom", effectivePom, checksum.update(effectivePom.getBytes(UTF_8)));
     }
 
-    public static DigestItem file( HashChecksum checksum, Path basedir, Path file ) throws IOException
-    {
-        byte[] content = Files.readAllBytes( file );
-        String normalized = normalize( basedir, file );
-        DigestItem item = item( "file", normalized, checksum.update( content ) );
-        try
-        {
-            populateContentDetails( file, content, item );
-        }
-        catch ( IOException ignore )
-        {
-            LOGGER.debug( "Failed to compute digest for file {}", normalized, ignore );
+    public static DigestItem file(HashChecksum checksum, Path basedir, Path file) throws IOException {
+        byte[] content = Files.readAllBytes(file);
+        String normalized = normalize(basedir, file);
+        DigestItem item = item("file", normalized, checksum.update(content));
+        try {
+            populateContentDetails(file, content, item);
+        } catch (IOException ignore) {
+            LOGGER.debug("Failed to compute digest for file {}", normalized, ignore);
         }
         return item;
     }
 
-    private static void populateContentDetails( Path file, byte[] content, DigestItem item ) throws IOException
-    {
-        String contentType = Files.probeContentType( file );
-        if ( contentType != null )
-        {
-            item.setContent( contentType );
+    private static void populateContentDetails(Path file, byte[] content, DigestItem item) throws IOException {
+        String contentType = Files.probeContentType(file);
+        if (contentType != null) {
+            item.setContent(contentType);
         }
-        final boolean binary = isBinary( contentType );
-        item.setIsText( isText( contentType ) ? "yes" : binary ? "no" : "unknown" );
-        if ( !binary )
-        { // probing application/ files as well though might be binary
+        final boolean binary = isBinary(contentType);
+        item.setIsText(isText(contentType) ? "yes" : binary ? "no" : "unknown");
+        if (!binary) { // probing application/ files as well though might be binary
             UniversalDetector detector = ENCODING_DETECTOR.get();
             detector.reset();
-            detector.handleData( content, 0, Math.min( content.length, 16 * 1024 ) );
+            detector.handleData(content, 0, Math.min(content.length, 16 * 1024));
             detector.dataEnd();
             String detectedCharset = detector.getDetectedCharset();
             Charset charset = UTF_8;
-            if ( detectedCharset != null )
-            {
-                item.setCharset( detectedCharset );
-                charset = Charset.forName( detectedCharset );
+            if (detectedCharset != null) {
+                item.setCharset(detectedCharset);
+                charset = Charset.forName(detectedCharset);
             }
-            CharBuffer charBuffer = charset.decode( ByteBuffer.wrap( content ) );
-            String lineSeparator = detectLineSeparator( charBuffer );
-            item.setEol( StringUtils.defaultString( lineSeparator, "unknown" ) );
+            CharBuffer charBuffer = charset.decode(ByteBuffer.wrap(content));
+            String lineSeparator = detectLineSeparator(charBuffer);
+            item.setEol(StringUtils.defaultString(lineSeparator, "unknown"));
         }
     }
 
-    // TODO add support for .gitattributes to statically configure file type before falling back to probe based content checks
-    private static boolean isText( String contentType )
-    {
-        return startsWith( contentType, "text/" )
-                || containsAny( contentType, "+json", "+xml" ) // common mime type suffixes
-                || equalsAny( contentType, // some common text types
+    // TODO add support for .gitattributes to statically configure file type before falling back to probe based content
+    // checks
+    private static boolean isText(String contentType) {
+        return startsWith(contentType, "text/")
+                || containsAny(contentType, "+json", "+xml") // common mime type suffixes
+                || equalsAny(
+                        contentType, // some common text types
                         "application/json",
                         "application/rtf",
                         "application/x-sh",
                         "application/xml",
                         "application/javascript",
-                        "application/sql" );
+                        "application/sql");
     }
 
-    private static boolean isBinary( String contentType )
-    {
-        return startsWithAny( contentType, "image/", "audio/", "video/", "font/" )
-                || containsAny( contentType, "+zip", "+gzip" )
-                || equalsAny( contentType,
+    private static boolean isBinary(String contentType) {
+        return startsWithAny(contentType, "image/", "audio/", "video/", "font/")
+                || containsAny(contentType, "+zip", "+gzip")
+                || equalsAny(
+                        contentType,
                         "application/octet-stream",
                         "application/java-archive",
                         "application/x-bzip",
@@ -127,56 +119,44 @@ public class DigestUtils
                         "application/msword",
                         "application/vnd.ms-excel",
                         "application/vnd.ms-powerpoint",
-                        "application/pdf" );
+                        "application/pdf");
     }
 
-    public static DigestItem dependency( HashChecksum checksum, String key, String hash )
-    {
-        return item( "dependency", key, checksum.update( hash ) );
+    public static DigestItem dependency(HashChecksum checksum, String key, String hash) {
+        return item("dependency", key, checksum.update(hash));
     }
 
-    private static String normalize( Path basedirPath, Path file )
-    {
-        return FilenameUtils.separatorsToUnix( relativize( basedirPath, file ).toString() );
+    private static String normalize(Path basedirPath, Path file) {
+        return FilenameUtils.separatorsToUnix(relativize(basedirPath, file).toString());
     }
 
-    private static Path relativize( Path basedirPath, Path file )
-    {
-        try
-        {
-            return basedirPath.relativize( file );
-        }
-        catch ( Exception ignore )
-        {
+    private static Path relativize(Path basedirPath, Path file) {
+        try {
+            return basedirPath.relativize(file);
+        } catch (Exception ignore) {
             return file;
         }
     }
 
-    private static DigestItem item( String type, String reference, String hash )
-    {
+    private static DigestItem item(String type, String reference, String hash) {
         final DigestItem item = new DigestItem();
-        item.setType( type );
-        item.setValue( reference );
-        item.setHash( hash );
+        item.setType(type);
+        item.setValue(reference);
+        item.setHash(hash);
         return item;
     }
 
-    private DigestUtils()
-    {
-    }
+    private DigestUtils() {}
 
-    public static String detectLineSeparator( CharSequence text )
-    {
+    public static String detectLineSeparator(CharSequence text) {
         // first line break only
-        int index = StringUtils.indexOfAny( text, "\n\r" );
-        if ( index == -1 || index >= text.length() )
-        {
+        int index = StringUtils.indexOfAny(text, "\n\r");
+        if (index == -1 || index >= text.length()) {
             return null;
         }
-        char ch = text.charAt( index );
-        if ( ch == '\r' )
-        {
-            return index + 1 < text.length() && text.charAt( index + 1 ) == '\n' ? "CRLF" : "CR";
+        char ch = text.charAt(index);
+        if (ch == '\r') {
+            return index + 1 < text.length() && text.charAt(index + 1) == '\n' ? "CRLF" : "CR";
         }
         return ch == '\n' ? "LF" : null;
     }
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/KeyUtils.java b/src/main/java/org/apache/maven/buildcache/checksum/KeyUtils.java
index ce790d2..98e34fb 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/KeyUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/KeyUtils.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -25,76 +25,67 @@ import org.apache.maven.project.MavenProject;
 /**
  * KeyUtils
  */
-public class KeyUtils
-{
+public class KeyUtils {
 
     private static final String SEPARATOR = ":";
 
-    public static String getProjectKey( MavenProject project )
-    {
-        return getProjectKey( project.getGroupId(), project.getArtifactId(), project.getVersion() );
+    public static String getProjectKey(MavenProject project) {
+        return getProjectKey(project.getGroupId(), project.getArtifactId(), project.getVersion());
     }
 
-    public static String getProjectKey( String groupId, String artifactId, String version )
-    {
-        return StringUtils.joinWith( SEPARATOR, groupId, artifactId, version );
+    public static String getProjectKey(String groupId, String artifactId, String version) {
+        return StringUtils.joinWith(SEPARATOR, groupId, artifactId, version);
     }
 
-    public static String getVersionlessProjectKey( MavenProject project )
-    {
-        return StringUtils.joinWith( SEPARATOR, project.getGroupId(), project.getArtifactId() );
+    public static String getVersionlessProjectKey(MavenProject project) {
+        return StringUtils.joinWith(SEPARATOR, project.getGroupId(), project.getArtifactId());
     }
 
-    public static String getArtifactKey( Artifact artifact )
-    {
-        return getArtifactKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
-                artifact.getClassifier(), artifact.getVersion() );
+    public static String getArtifactKey(Artifact artifact) {
+        return getArtifactKey(
+                artifact.getGroupId(),
+                artifact.getArtifactId(),
+                artifact.getType(),
+                artifact.getClassifier(),
+                artifact.getVersion());
     }
 
-    public static String getVersionlessArtifactKey( org.apache.maven.artifact.Artifact artifact )
-    {
-        return getVersionlessArtifactKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
-                artifact.getClassifier() );
+    public static String getVersionlessArtifactKey(org.apache.maven.artifact.Artifact artifact) {
+        return getVersionlessArtifactKey(
+                artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getClassifier());
     }
 
     /**
      * Computes the key for the given artifact, using the given type instead of the one defined in the artifact.
      */
-    public static String getArtifactKey( Artifact artifact, String type )
-    {
-        return getArtifactKey( artifact.getGroupId(), artifact.getArtifactId(), type,
-                artifact.getClassifier(), artifact.getVersion() );
+    public static String getArtifactKey(Artifact artifact, String type) {
+        return getArtifactKey(
+                artifact.getGroupId(), artifact.getArtifactId(), type, artifact.getClassifier(), artifact.getVersion());
     }
 
-    public static String getArtifactKey( org.apache.maven.artifact.Artifact artifact )
-    {
-        return getArtifactKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
-                artifact.getClassifier(), artifact.getVersion() );
+    public static String getArtifactKey(org.apache.maven.artifact.Artifact artifact) {
+        return getArtifactKey(
+                artifact.getGroupId(),
+                artifact.getArtifactId(),
+                artifact.getType(),
+                artifact.getClassifier(),
+                artifact.getVersion());
     }
 
-    public static String getArtifactKey( String groupId, String artifactId, String type,
-            String classifier, String version )
-    {
-        if ( classifier != null )
-        {
-            return StringUtils.joinWith( SEPARATOR, groupId, artifactId, type, classifier, version );
-        }
-        else
-        {
-            return StringUtils.joinWith( SEPARATOR, groupId, artifactId, type, version );
+    public static String getArtifactKey(
+            String groupId, String artifactId, String type, String classifier, String version) {
+        if (classifier != null) {
+            return StringUtils.joinWith(SEPARATOR, groupId, artifactId, type, classifier, version);
+        } else {
+            return StringUtils.joinWith(SEPARATOR, groupId, artifactId, type, version);
         }
     }
 
-    public static String getVersionlessArtifactKey( String groupId, String artifactId, String type,
-            String classifier )
-    {
-        if ( classifier != null )
-        {
-            return StringUtils.joinWith( SEPARATOR, groupId, artifactId, type, classifier );
-        }
-        else
-        {
-            return StringUtils.joinWith( SEPARATOR, groupId, artifactId, type );
+    public static String getVersionlessArtifactKey(String groupId, String artifactId, String type, String classifier) {
+        if (classifier != null) {
+            return StringUtils.joinWith(SEPARATOR, groupId, artifactId, type, classifier);
+        } else {
+            return StringUtils.joinWith(SEPARATOR, groupId, artifactId, type);
         }
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java b/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java
index 33ff8bd..fcaabf7 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -18,6 +18,8 @@
  */
 package org.apache.maven.buildcache.checksum;
 
+import javax.annotation.Nonnull;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
@@ -44,7 +46,7 @@ import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.function.Predicate;
-import javax.annotation.Nonnull;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
@@ -94,8 +96,7 @@ import static org.apache.maven.buildcache.xml.CacheConfigImpl.RESTORE_GENERATED_
 /**
  * MavenProjectInput
  */
-public class MavenProjectInput
-{
+public class MavenProjectInput {
 
     /**
      * Version of hashing algorithm implementation. It is recommended to change to simplify remote cache maintenance
@@ -126,7 +127,7 @@ public class MavenProjectInput
      */
     private static final String CACHE_PROCESS_PLUGINS = "maven.build.cache.processPlugins";
 
-    private static final Logger LOGGER = LoggerFactory.getLogger( MavenProjectInput.class );
+    private static final Logger LOGGER = LoggerFactory.getLogger(MavenProjectInput.class);
 
     private final MavenProject project;
     private final MavenSession session;
@@ -143,16 +144,16 @@ public class MavenProjectInput
     private final boolean processPlugins;
     private final String tmpDir;
 
-    @SuppressWarnings( "checkstyle:parameternumber" )
-    public MavenProjectInput( MavenProject project,
+    @SuppressWarnings("checkstyle:parameternumber")
+    public MavenProjectInput(
+            MavenProject project,
             NormalizedModelProvider normalizedModelProvider,
             MultiModuleSupport multiModuleSupport,
             ProjectInputCalculator projectInputCalculator,
             MavenSession session,
             CacheConfig config,
             RepositorySystem repoSystem,
-            RemoteCacheRepository remoteCache )
-    {
+            RemoteCacheRepository remoteCache) {
         this.project = project;
         this.normalizedModelProvider = normalizedModelProvider;
         this.multiModuleSupport = multiModuleSupport;
@@ -163,170 +164,161 @@ public class MavenProjectInput
         this.repoSystem = repoSystem;
         this.remoteCache = remoteCache;
         Properties properties = project.getProperties();
-        this.dirGlob = properties.getProperty( CACHE_INPUT_GLOB_NAME, config.getDefaultGlob() );
-        this.processPlugins = Boolean.parseBoolean(
-                properties.getProperty( CACHE_PROCESS_PLUGINS, config.isProcessPlugins() ) );
-        this.tmpDir = System.getProperty( "java.io.tmpdir" );
+        this.dirGlob = properties.getProperty(CACHE_INPUT_GLOB_NAME, config.getDefaultGlob());
+        this.processPlugins =
+                Boolean.parseBoolean(properties.getProperty(CACHE_PROCESS_PLUGINS, config.isProcessPlugins()));
+        this.tmpDir = System.getProperty("java.io.tmpdir");
 
         org.apache.maven.model.Build build = project.getBuild();
-        filteredOutPaths = new ArrayList<>( Arrays.asList( normalizedPath( build.getDirectory() ), // target by default
-                normalizedPath( build.getOutputDirectory() ), normalizedPath( build.getTestOutputDirectory() ) ) );
+        filteredOutPaths = new ArrayList<>(Arrays.asList(
+                normalizedPath(build.getDirectory()), // target by default
+                normalizedPath(build.getOutputDirectory()),
+                normalizedPath(build.getTestOutputDirectory())));
 
         List<Exclude> excludes = config.getGlobalExcludePaths();
-        for ( Exclude excludePath : excludes )
-        {
-            filteredOutPaths.add( Paths.get( excludePath.getValue() ) );
-        }
-
-        for ( String propertyName : properties.stringPropertyNames() )
-        {
-            if ( propertyName.startsWith( CACHE_EXCLUDE_NAME ) )
-            {
-                String propertyValue = properties.getProperty( propertyName );
-                Path path = Paths.get( propertyValue );
-                filteredOutPaths.add( path );
-                if ( LOGGER.isDebugEnabled() )
-                {
-                    LOGGER.debug( "Adding an excludePath from property '{}', values is '{}', path is '{}' ",
-                            propertyName, propertyValue, path );
+        for (Exclude excludePath : excludes) {
+            filteredOutPaths.add(Paths.get(excludePath.getValue()));
+        }
+
+        for (String propertyName : properties.stringPropertyNames()) {
+            if (propertyName.startsWith(CACHE_EXCLUDE_NAME)) {
+                String propertyValue = properties.getProperty(propertyName);
+                Path path = Paths.get(propertyValue);
+                filteredOutPaths.add(path);
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug(
+                            "Adding an excludePath from property '{}', values is '{}', path is '{}' ",
+                            propertyName,
+                            propertyValue,
+                            path);
                 }
             }
         }
-        CacheUtils.debugPrintCollection( LOGGER, filteredOutPaths,
+        CacheUtils.debugPrintCollection(
+                LOGGER,
+                filteredOutPaths,
                 "List of excluded paths (checked either by fileName or by startsWith prefix)",
-                "Path entry" );
+                "Path entry");
 
         this.fileComparator = new PathIgnoringCaseComparator();
     }
 
-    public ProjectsInputInfo calculateChecksum() throws IOException
-    {
+    public ProjectsInputInfo calculateChecksum() throws IOException {
         final long t0 = System.currentTimeMillis();
 
-        final String effectivePom = getEffectivePom( normalizedModelProvider.normalizedModel( project ) );
-        final SortedSet<Path> inputFiles = isPom( project ) ? Collections.emptySortedSet() : getInputFiles();
+        final String effectivePom = getEffectivePom(normalizedModelProvider.normalizedModel(project));
+        final SortedSet<Path> inputFiles = isPom(project) ? Collections.emptySortedSet() : getInputFiles();
         final SortedMap<String, String> dependenciesChecksum = getMutableDependencies();
 
         final long t1 = System.currentTimeMillis();
 
         // hash items: effective pom + input files + dependencies
         final int count = 1 + inputFiles.size() + dependenciesChecksum.size();
-        final List<DigestItem> items = new ArrayList<>( count );
-        final HashChecksum checksum = config.getHashFactory().createChecksum( count );
+        final List<DigestItem> items = new ArrayList<>(count);
+        final HashChecksum checksum = config.getHashFactory().createChecksum(count);
 
         Optional<ProjectsInputInfo> baselineHolder = Optional.empty();
-        if ( config.isBaselineDiffEnabled() )
-        {
-            baselineHolder = remoteCache.findBaselineBuild( project ).map( b -> b.getDto().getProjectsInputInfo() );
+        if (config.isBaselineDiffEnabled()) {
+            baselineHolder =
+                    remoteCache.findBaselineBuild(project).map(b -> b.getDto().getProjectsInputInfo());
         }
 
-        DigestItem effectivePomChecksum = DigestUtils.pom( checksum, effectivePom );
-        items.add( effectivePomChecksum );
+        DigestItem effectivePomChecksum = DigestUtils.pom(checksum, effectivePom);
+        items.add(effectivePomChecksum);
         final boolean compareWithBaseline = config.isBaselineDiffEnabled() && baselineHolder.isPresent();
-        if ( compareWithBaseline )
-        {
-            checkEffectivePomMatch( baselineHolder.get(), effectivePomChecksum );
+        if (compareWithBaseline) {
+            checkEffectivePomMatch(baselineHolder.get(), effectivePomChecksum);
         }
 
         boolean sourcesMatched = true;
-        for ( Path file : inputFiles )
-        {
-            DigestItem fileDigest = DigestUtils.file( checksum, baseDirPath, file );
-            items.add( fileDigest );
-            if ( compareWithBaseline )
-            {
-                sourcesMatched &= checkItemMatchesBaseline( baselineHolder.get(), fileDigest );
+        for (Path file : inputFiles) {
+            DigestItem fileDigest = DigestUtils.file(checksum, baseDirPath, file);
+            items.add(fileDigest);
+            if (compareWithBaseline) {
+                sourcesMatched &= checkItemMatchesBaseline(baselineHolder.get(), fileDigest);
             }
         }
-        if ( compareWithBaseline )
-        {
-            LOGGER.info( "Source code: {}", sourcesMatched ? "MATCHED" : "OUT OF DATE" );
+        if (compareWithBaseline) {
+            LOGGER.info("Source code: {}", sourcesMatched ? "MATCHED" : "OUT OF DATE");
         }
 
         boolean dependenciesMatched = true;
-        for ( Map.Entry<String, String> entry : dependenciesChecksum.entrySet() )
-        {
-            DigestItem dependencyDigest = DigestUtils.dependency( checksum, entry.getKey(), entry.getValue() );
-            items.add( dependencyDigest );
-            if ( compareWithBaseline )
-            {
-                dependenciesMatched &= checkItemMatchesBaseline( baselineHolder.get(), dependencyDigest );
+        for (Map.Entry<String, String> entry : dependenciesChecksum.entrySet()) {
+            DigestItem dependencyDigest = DigestUtils.dependency(checksum, entry.getKey(), entry.getValue());
+            items.add(dependencyDigest);
+            if (compareWithBaseline) {
+                dependenciesMatched &= checkItemMatchesBaseline(baselineHolder.get(), dependencyDigest);
             }
         }
 
-        if ( compareWithBaseline )
-        {
-            LOGGER.info( "Dependencies: {}", dependenciesMatched ? "MATCHED" : "OUT OF DATE" );
+        if (compareWithBaseline) {
+            LOGGER.info("Dependencies: {}", dependenciesMatched ? "MATCHED" : "OUT OF DATE");
         }
 
         final ProjectsInputInfo projectsInputInfoType = new ProjectsInputInfo();
-        projectsInputInfoType.setChecksum( checksum.digest() );
-        projectsInputInfoType.getItems().addAll( items );
+        projectsInputInfoType.setChecksum(checksum.digest());
+        projectsInputInfoType.getItems().addAll(items);
 
         final long t2 = System.currentTimeMillis();
 
-        for ( DigestItem item : projectsInputInfoType.getItems() )
-        {
-            LOGGER.debug( "Hash calculated, item: {}, hash: {}", item.getType(), item.getHash() );
+        for (DigestItem item : projectsInputInfoType.getItems()) {
+            LOGGER.debug("Hash calculated, item: {}, hash: {}", item.getType(), item.getHash());
         }
-        LOGGER.info( "Project inputs calculated in {} ms. {} checksum [{}] calculated in {} ms.",
-                t1 - t0, config.getHashFactory().getAlgorithm(), projectsInputInfoType.getChecksum(), t2 - t1 );
+        LOGGER.info(
+                "Project inputs calculated in {} ms. {} checksum [{}] calculated in {} ms.",
+                t1 - t0,
+                config.getHashFactory().getAlgorithm(),
+                projectsInputInfoType.getChecksum(),
+                t2 - t1);
         return projectsInputInfoType;
     }
 
-    private void checkEffectivePomMatch( ProjectsInputInfo baselineBuild, DigestItem effectivePomChecksum )
-    {
+    private void checkEffectivePomMatch(ProjectsInputInfo baselineBuild, DigestItem effectivePomChecksum) {
         Optional<DigestItem> pomHolder = Optional.empty();
-        for ( DigestItem it : baselineBuild.getItems() )
-        {
-            if ( it.getType().equals( "pom" ) )
-            {
-                pomHolder = Optional.of( it );
+        for (DigestItem it : baselineBuild.getItems()) {
+            if (it.getType().equals("pom")) {
+                pomHolder = Optional.of(it);
                 break;
             }
         }
 
-        if ( pomHolder.isPresent() )
-        {
+        if (pomHolder.isPresent()) {
             DigestItem pomItem = pomHolder.get();
-            final boolean matches = StringUtils.equals( pomItem.getHash(), effectivePomChecksum.getHash() );
-            if ( !matches )
-            {
-                LOGGER.info( "Mismatch in effective poms. Current: {}, remote: {}",
-                        effectivePomChecksum.getHash(), pomItem.getHash() );
+            final boolean matches = StringUtils.equals(pomItem.getHash(), effectivePomChecksum.getHash());
+            if (!matches) {
+                LOGGER.info(
+                        "Mismatch in effective poms. Current: {}, remote: {}",
+                        effectivePomChecksum.getHash(),
+                        pomItem.getHash());
             }
-            LOGGER.info( "Effective pom: {}", matches ? "MATCHED" : "OUT OF DATE" );
+            LOGGER.info("Effective pom: {}", matches ? "MATCHED" : "OUT OF DATE");
         }
     }
 
-    private boolean checkItemMatchesBaseline( ProjectsInputInfo baselineBuild, DigestItem fileDigest )
-    {
+    private boolean checkItemMatchesBaseline(ProjectsInputInfo baselineBuild, DigestItem fileDigest) {
         Optional<DigestItem> baselineFileDigest = Optional.empty();
-        for ( DigestItem it : baselineBuild.getItems() )
-        {
-            if ( it.getType().equals( fileDigest.getType() )
-                    && fileDigest.getValue().equals( it.getValue().trim() ) )
-            {
-                baselineFileDigest = Optional.of( it );
+        for (DigestItem it : baselineBuild.getItems()) {
+            if (it.getType().equals(fileDigest.getType())
+                    && fileDigest.getValue().equals(it.getValue().trim())) {
+                baselineFileDigest = Optional.of(it);
                 break;
             }
         }
 
         boolean matched = false;
-        if ( baselineFileDigest.isPresent() )
-        {
+        if (baselineFileDigest.isPresent()) {
             String hash = baselineFileDigest.get().getHash();
-            matched = StringUtils.equals( hash, fileDigest.getHash() );
-            if ( !matched )
-            {
-                LOGGER.info( "Mismatch in {}: {}. Local hash: {}, remote: {}",
-                        fileDigest.getType(), fileDigest.getValue(), fileDigest.getHash(), hash );
+            matched = StringUtils.equals(hash, fileDigest.getHash());
+            if (!matched) {
+                LOGGER.info(
+                        "Mismatch in {}: {}. Local hash: {}, remote: {}",
+                        fileDigest.getType(),
+                        fileDigest.getValue(),
+                        fileDigest.getHash(),
+                        hash);
             }
-        }
-        else
-        {
-            LOGGER.info( "Mismatch in {}: {}. Not found in remote cache",
-                    fileDigest.getType(), fileDigest.getValue() );
+        } else {
+            LOGGER.info("Mismatch in {}: {}. Not found in remote cache", fileDigest.getType(), fileDigest.getValue());
         }
         return matched;
     }
@@ -334,35 +326,26 @@ public class MavenProjectInput
     /**
      * @param prototype effective model fully resolved by maven build. Do not pass here just parsed Model.
      */
-    private String getEffectivePom( Model prototype ) throws IOException
-    {
+    private String getEffectivePom(Model prototype) throws IOException {
         ByteArrayOutputStream output = new ByteArrayOutputStream();
 
         Writer writer = null;
-        try
-        {
-            writer = WriterFactory.newXmlWriter( output );
-            new MavenXpp3Writer().write( writer, prototype );
+        try {
+            writer = WriterFactory.newXmlWriter(output);
+            new MavenXpp3Writer().write(writer, prototype);
 
-            //normalize env specifics
-            final String[] searchList =
-            { baseDirPath.toString(), "\\", "windows", "linux"
-            };
-            final String[] replacementList =
-            { "", "/", "os.classifier", "os.classifier"
-            };
+            // normalize env specifics
+            final String[] searchList = {baseDirPath.toString(), "\\", "windows", "linux"};
+            final String[] replacementList = {"", "/", "os.classifier", "os.classifier"};
 
-            return replaceEachRepeatedly( output.toString(), searchList, replacementList );
+            return replaceEachRepeatedly(output.toString(), searchList, replacementList);
 
-        }
-        finally
-        {
-            IOUtil.close( writer );
+        } finally {
+            IOUtil.close(writer);
         }
     }
 
-    private SortedSet<Path> getInputFiles()
-    {
+    private SortedSet<Path> getInputFiles() {
         long start = System.currentTimeMillis();
         HashSet<WalkKey> visitedDirs = new HashSet<>();
         ArrayList<Path> collectedFiles = new ArrayList<>();
@@ -370,62 +353,58 @@ public class MavenProjectInput
         org.apache.maven.model.Build build = project.getBuild();
 
         final boolean recursive = true;
-        startWalk( Paths.get( build.getSourceDirectory() ), dirGlob, recursive, collectedFiles, visitedDirs );
-        for ( Resource resource : build.getResources() )
-        {
-            startWalk( Paths.get( resource.getDirectory() ), dirGlob, recursive, collectedFiles, visitedDirs );
+        startWalk(Paths.get(build.getSourceDirectory()), dirGlob, recursive, collectedFiles, visitedDirs);
+        for (Resource resource : build.getResources()) {
+            startWalk(Paths.get(resource.getDirectory()), dirGlob, recursive, collectedFiles, visitedDirs);
         }
 
-        startWalk( Paths.get( build.getTestSourceDirectory() ), dirGlob, recursive, collectedFiles, visitedDirs );
-        for ( Resource testResource : build.getTestResources() )
-        {
-            startWalk( Paths.get( testResource.getDirectory() ), dirGlob, recursive, collectedFiles, visitedDirs );
+        startWalk(Paths.get(build.getTestSourceDirectory()), dirGlob, recursive, collectedFiles, visitedDirs);
+        for (Resource testResource : build.getTestResources()) {
+            startWalk(Paths.get(testResource.getDirectory()), dirGlob, recursive, collectedFiles, visitedDirs);
         }
 
         Properties properties = project.getProperties();
-        for ( String name : properties.stringPropertyNames() )
-        {
-            if ( name.startsWith( CACHE_INPUT_NAME ) )
-            {
-                String path = properties.getProperty( name );
-                startWalk( Paths.get( path ), dirGlob, recursive, collectedFiles, visitedDirs );
+        for (String name : properties.stringPropertyNames()) {
+            if (name.startsWith(CACHE_INPUT_NAME)) {
+                String path = properties.getProperty(name);
+                startWalk(Paths.get(path), dirGlob, recursive, collectedFiles, visitedDirs);
             }
         }
 
         List<Include> includes = config.getGlobalIncludePaths();
-        for ( Include include : includes )
-        {
+        for (Include include : includes) {
             final String path = include.getValue();
-            final String glob = defaultIfEmpty( include.getGlob(), dirGlob );
-            startWalk( Paths.get( path ), glob, include.isRecursive(), collectedFiles, visitedDirs );
+            final String glob = defaultIfEmpty(include.getGlob(), dirGlob);
+            startWalk(Paths.get(path), glob, include.isRecursive(), collectedFiles, visitedDirs);
         }
 
         long walkKnownPathsFinished = System.currentTimeMillis() - start;
 
-        LOGGER.info( "Scanning plugins configurations to find input files. Probing is {}", processPlugins
-                ? "enabled, values will be checked for presence in file system"
-                : "disabled, only tags with attribute " + CACHE_INPUT_NAME + "=\"true\" will be added" );
+        LOGGER.info(
+                "Scanning plugins configurations to find input files. Probing is {}",
+                processPlugins
+                        ? "enabled, values will be checked for presence in file system"
+                        : "disabled, only tags with attribute " + CACHE_INPUT_NAME + "=\"true\" will be added");
 
-        if ( processPlugins )
-        {
-            collectFromPlugins( collectedFiles, visitedDirs );
-        }
-        else
-        {
-            LOGGER.info( "Skipping check plugins scan (probing is disabled by config)" );
+        if (processPlugins) {
+            collectFromPlugins(collectedFiles, visitedDirs);
+        } else {
+            LOGGER.info("Skipping check plugins scan (probing is disabled by config)");
         }
 
         long pluginsFinished = System.currentTimeMillis() - start - walkKnownPathsFinished;
 
-        TreeSet<Path> sorted = new TreeSet<>( fileComparator );
-        for ( Path collectedFile : collectedFiles )
-        {
-            sorted.add( collectedFile.normalize().toAbsolutePath() );
+        TreeSet<Path> sorted = new TreeSet<>(fileComparator);
+        for (Path collectedFile : collectedFiles) {
+            sorted.add(collectedFile.normalize().toAbsolutePath());
         }
 
-        LOGGER.info( "Found {} input files. Project dir processing: {}, plugins: {} millis",
-                sorted.size(), walkKnownPathsFinished, pluginsFinished );
-        LOGGER.debug( "Src input: {}", sorted );
+        LOGGER.info(
+                "Found {} input files. Project dir processing: {}, plugins: {} millis",
+                sorted.size(),
+                walkKnownPathsFinished,
+                pluginsFinished);
+        LOGGER.debug("Src input: {}", sorted);
 
         return sorted;
     }
@@ -433,303 +412,241 @@ public class MavenProjectInput
     /**
      * entry point for directory walk
      */
-    private void startWalk( Path candidate,
-            String glob,
-            boolean recursive,
-            List<Path> collectedFiles,
-            Set<WalkKey> visitedDirs )
-    {
-        Path normalized = candidate.isAbsolute() ? candidate : baseDirPath.resolve( candidate );
+    private void startWalk(
+            Path candidate, String glob, boolean recursive, List<Path> collectedFiles, Set<WalkKey> visitedDirs) {
+        Path normalized = candidate.isAbsolute() ? candidate : baseDirPath.resolve(candidate);
         normalized = normalized.toAbsolutePath().normalize();
-        WalkKey key = new WalkKey( normalized, glob, recursive );
-        if ( visitedDirs.contains( key ) || !Files.exists( normalized ) )
-        {
+        WalkKey key = new WalkKey(normalized, glob, recursive);
+        if (visitedDirs.contains(key) || !Files.exists(normalized)) {
             return;
         }
 
-        if ( Files.isDirectory( normalized ) )
-        {
-            if ( baseDirPath.startsWith( normalized ) )
-            { // requested to walk parent, can do only non recursive
-                key = new WalkKey( normalized, glob, false );
+        if (Files.isDirectory(normalized)) {
+            if (baseDirPath.startsWith(normalized)) { // requested to walk parent, can do only non recursive
+                key = new WalkKey(normalized, glob, false);
             }
-            try
-            {
-                walkDir( key, collectedFiles, visitedDirs );
-                visitedDirs.add( key );
-            }
-            catch ( IOException e )
-            {
-                throw new RuntimeException( e );
+            try {
+                walkDir(key, collectedFiles, visitedDirs);
+                visitedDirs.add(key);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
             }
-        }
-        else
-        {
-            if ( !isFilteredOutSubpath( normalized ) )
-            {
-                LOGGER.debug( "Adding: {}", normalized );
-                collectedFiles.add( normalized );
+        } else {
+            if (!isFilteredOutSubpath(normalized)) {
+                LOGGER.debug("Adding: {}", normalized);
+                collectedFiles.add(normalized);
             }
         }
     }
 
-    private Path normalizedPath( String directory )
-    {
-        return Paths.get( directory ).normalize();
+    private Path normalizedPath(String directory) {
+        return Paths.get(directory).normalize();
     }
 
-    private void collectFromPlugins( List<Path> files, HashSet<WalkKey> visitedDirs )
-    {
+    private void collectFromPlugins(List<Path> files, HashSet<WalkKey> visitedDirs) {
         List<Plugin> plugins = project.getBuild().getPlugins();
-        for ( Plugin plugin : plugins )
-        {
-            PluginScanConfig scanConfig = config.getPluginDirScanConfig( plugin );
+        for (Plugin plugin : plugins) {
+            PluginScanConfig scanConfig = config.getPluginDirScanConfig(plugin);
 
-            if ( scanConfig.isSkip() )
-            {
-                LOGGER.debug( "Skipping plugin config scan (skip by config): {}", plugin.getArtifactId() );
+            if (scanConfig.isSkip()) {
+                LOGGER.debug("Skipping plugin config scan (skip by config): {}", plugin.getArtifactId());
                 continue;
             }
 
             Object configuration = plugin.getConfiguration();
-            LOGGER.debug( "Processing plugin config: {}", plugin.getArtifactId() );
-            if ( configuration != null )
-            {
-                addInputsFromPluginConfigs( Xpp3DomUtils.getChildren( configuration ), scanConfig, files, visitedDirs );
+            LOGGER.debug("Processing plugin config: {}", plugin.getArtifactId());
+            if (configuration != null) {
+                addInputsFromPluginConfigs(Xpp3DomUtils.getChildren(configuration), scanConfig, files, visitedDirs);
             }
 
-            for ( PluginExecution exec : plugin.getExecutions() )
-            {
-                final PluginScanConfig executionScanConfig = config.getExecutionDirScanConfig( plugin, exec );
-                PluginScanConfig mergedConfig = scanConfig.mergeWith( executionScanConfig );
+            for (PluginExecution exec : plugin.getExecutions()) {
+                final PluginScanConfig executionScanConfig = config.getExecutionDirScanConfig(plugin, exec);
+                PluginScanConfig mergedConfig = scanConfig.mergeWith(executionScanConfig);
 
-                if ( mergedConfig.isSkip() )
-                {
-                    LOGGER.debug( "Skipping plugin execution config scan (skip by config): {}, execId: {}",
-                            plugin.getArtifactId(), exec.getId() );
+                if (mergedConfig.isSkip()) {
+                    LOGGER.debug(
+                            "Skipping plugin execution config scan (skip by config): {}, execId: {}",
+                            plugin.getArtifactId(),
+                            exec.getId());
                     continue;
                 }
 
                 Object execConfiguration = exec.getConfiguration();
-                LOGGER.debug( "Processing plugin: {}, execution: {}", plugin.getArtifactId(), exec.getId() );
+                LOGGER.debug("Processing plugin: {}, execution: {}", plugin.getArtifactId(), exec.getId());
 
-                if ( execConfiguration != null )
-                {
-                    addInputsFromPluginConfigs( Xpp3DomUtils.getChildren( execConfiguration ), mergedConfig, files,
-                            visitedDirs );
+                if (execConfiguration != null) {
+                    addInputsFromPluginConfigs(
+                            Xpp3DomUtils.getChildren(execConfiguration), mergedConfig, files, visitedDirs);
                 }
             }
         }
     }
 
-    private Path walkDir( final WalkKey key,
-            final List<Path> collectedFiles,
-            final Set<WalkKey> visitedDirs ) throws IOException
-    {
-        return Files.walkFileTree( key.getPath(), new SimpleFileVisitor<Path>()
-        {
+    private Path walkDir(final WalkKey key, final List<Path> collectedFiles, final Set<WalkKey> visitedDirs)
+            throws IOException {
+        return Files.walkFileTree(key.getPath(), new SimpleFileVisitor<Path>() {
 
             @Override
-            public FileVisitResult preVisitDirectory( Path path,
-                    BasicFileAttributes basicFileAttributes ) throws IOException
-            {
-                WalkKey currentDirKey = new WalkKey( path.toAbsolutePath().normalize(), key.getGlob(),
-                        key.isRecursive() );
-                if ( isHidden( path ) )
-                {
-                    LOGGER.debug( "Skipping subtree (hidden): {}", path );
+            public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes basicFileAttributes)
+                    throws IOException {
+                WalkKey currentDirKey =
+                        new WalkKey(path.toAbsolutePath().normalize(), key.getGlob(), key.isRecursive());
+                if (isHidden(path)) {
+                    LOGGER.debug("Skipping subtree (hidden): {}", path);
                     return FileVisitResult.SKIP_SUBTREE;
-                }
-                else if ( !isReadable( path ) )
-                {
-                    LOGGER.debug( "Skipping subtree (not readable): {}", path );
+                } else if (!isReadable(path)) {
+                    LOGGER.debug("Skipping subtree (not readable): {}", path);
                     return FileVisitResult.SKIP_SUBTREE;
-                }
-                else if ( isFilteredOutSubpath( path ) )
-                {
-                    LOGGER.debug( "Skipping subtree (blacklisted): {}", path );
+                } else if (isFilteredOutSubpath(path)) {
+                    LOGGER.debug("Skipping subtree (blacklisted): {}", path);
                     return FileVisitResult.SKIP_SUBTREE;
-                }
-                else if ( visitedDirs.contains( currentDirKey ) )
-                {
-                    LOGGER.debug( "Skipping subtree (visited): {}", path );
+                } else if (visitedDirs.contains(currentDirKey)) {
+                    LOGGER.debug("Skipping subtree (visited): {}", path);
                     return FileVisitResult.SKIP_SUBTREE;
                 }
 
-                walkDirectoryFiles(
-                        path,
-                        collectedFiles,
-                        key.getGlob(),
-                        entry -> filteredOutPaths.stream()
-                                .anyMatch( it -> it.getFileName().equals( entry.getFileName() ) ) );
+                walkDirectoryFiles(path, collectedFiles, key.getGlob(), entry -> filteredOutPaths.stream()
+                        .anyMatch(it -> it.getFileName().equals(entry.getFileName())));
 
-                if ( !key.isRecursive() )
-                {
-                    LOGGER.debug( "Skipping subtree (non recursive): {}", path );
+                if (!key.isRecursive()) {
+                    LOGGER.debug("Skipping subtree (non recursive): {}", path);
                     return FileVisitResult.SKIP_SUBTREE;
                 }
 
-                LOGGER.debug( "Visiting subtree: {}", path );
+                LOGGER.debug("Visiting subtree: {}", path);
                 return FileVisitResult.CONTINUE;
             }
 
             @Override
-            public FileVisitResult visitFileFailed( Path path, IOException exc )
-                    throws IOException
-            {
-                LOGGER.debug( "Skipping subtree (exception: {}): {}", exc, path );
+            public FileVisitResult visitFileFailed(Path path, IOException exc) throws IOException {
+                LOGGER.debug("Skipping subtree (exception: {}): {}", exc, path);
                 return FileVisitResult.SKIP_SUBTREE;
             }
-        } );
+        });
     }
 
-    private void addInputsFromPluginConfigs( Object[] configurationChildren,
+    private void addInputsFromPluginConfigs(
+            Object[] configurationChildren,
             PluginScanConfig scanConfig,
-            List<Path> files, HashSet<WalkKey> visitedDirs )
-    {
-        if ( configurationChildren == null )
-        {
+            List<Path> files,
+            HashSet<WalkKey> visitedDirs) {
+        if (configurationChildren == null) {
             return;
         }
 
-        for ( Object configChild : configurationChildren )
-        {
-            String tagName = Xpp3DomUtils.getName( configChild );
-            String tagValue = Xpp3DomUtils.getValue( configChild );
+        for (Object configChild : configurationChildren) {
+            String tagName = Xpp3DomUtils.getName(configChild);
+            String tagValue = Xpp3DomUtils.getValue(configChild);
 
-            if ( !scanConfig.accept( tagName ) )
-            {
-                LOGGER.debug( "Skipping property (scan config)): {}, value: {}",
-                        tagName, stripToEmpty( tagValue ) );
+            if (!scanConfig.accept(tagName)) {
+                LOGGER.debug("Skipping property (scan config)): {}, value: {}", tagName, stripToEmpty(tagValue));
                 continue;
             }
 
-            LOGGER.debug( "Checking xml tag. Tag: {}, value: {}", tagName, stripToEmpty( tagValue ) );
-
-            addInputsFromPluginConfigs( Xpp3DomUtils.getChildren( configChild ), scanConfig, files, visitedDirs );
-
-            final ScanConfigProperties propertyConfig = scanConfig.getTagScanProperties( tagName );
-            final String glob = defaultIfEmpty( propertyConfig.getGlob(), dirGlob );
-            if ( "true".equals( Xpp3DomUtils.getAttribute( configChild, CACHE_INPUT_NAME ) ) )
-            {
-                LOGGER.info( "Found tag marked with {} attribute. Tag: {}, value: {}",
-                        CACHE_INPUT_NAME, tagName, tagValue );
-                startWalk( Paths.get( tagValue ), glob, propertyConfig.isRecursive(), files, visitedDirs );
-            }
-            else
-            {
-                final Path candidate = getPathOrNull( tagValue );
-                if ( candidate != null )
-                {
-                    startWalk( candidate, glob, propertyConfig.isRecursive(), files, visitedDirs );
-                    if ( "descriptorRef".equals( tagName ) )
-                    { // hardcoded logic for assembly plugin which could reference files omitting .xml suffix
-                        startWalk( Paths.get( tagValue + ".xml" ), glob, propertyConfig.isRecursive(), files,
-                                visitedDirs );
+            LOGGER.debug("Checking xml tag. Tag: {}, value: {}", tagName, stripToEmpty(tagValue));
+
+            addInputsFromPluginConfigs(Xpp3DomUtils.getChildren(configChild), scanConfig, files, visitedDirs);
+
+            final ScanConfigProperties propertyConfig = scanConfig.getTagScanProperties(tagName);
+            final String glob = defaultIfEmpty(propertyConfig.getGlob(), dirGlob);
+            if ("true".equals(Xpp3DomUtils.getAttribute(configChild, CACHE_INPUT_NAME))) {
+                LOGGER.info(
+                        "Found tag marked with {} attribute. Tag: {}, value: {}", CACHE_INPUT_NAME, tagName, tagValue);
+                startWalk(Paths.get(tagValue), glob, propertyConfig.isRecursive(), files, visitedDirs);
+            } else {
+                final Path candidate = getPathOrNull(tagValue);
+                if (candidate != null) {
+                    startWalk(candidate, glob, propertyConfig.isRecursive(), files, visitedDirs);
+                    if ("descriptorRef"
+                            .equals(tagName)) { // hardcoded logic for assembly plugin which could reference files
+                        // omitting .xml suffix
+                        startWalk(Paths.get(tagValue + ".xml"), glob, propertyConfig.isRecursive(), files, visitedDirs);
                     }
                 }
             }
         }
     }
 
-    private Path getPathOrNull( String text )
-    {
+    private Path getPathOrNull(String text) {
         // small optimization to not probe not-paths
-        if ( isBlank( text ) )
-        {
+        if (isBlank(text)) {
             // do not even bother logging about blank/null values
-        }
-        else if ( equalsAnyIgnoreCase( text, "true", "false", "utf-8", "null", "\\" ) // common values
-                || contains( text, "*" ) // tag value is a glob or regex - unclear how to process
-                || ( contains( text, ":" ) && !contains( text, ":\\" ) )// artifactId
-                || startsWithAny( text, "com.", "org.", "io.", "java.", "javax." ) // java packages
-                || startsWithAny( text, "${env." ) // env variables in maven notation
-                || startsWithAny( text, "http:", "https:", "scm:", "ssh:", "git:", "svn:", "cp:",
-                        "classpath:" ) ) // urls identified by common protocols
-        {
-            LOGGER.debug( "Skipping directory (blacklisted literal): {}", text );
-        }
-        else if ( startsWithAny( text, tmpDir ) ) // tmp dir
-        {
-            LOGGER.debug( "Skipping directory (temp dir): {}", text );
-        }
-        else
-        {
-            try
-            {
-                return Paths.get( text );
-            }
-            catch ( Exception ignore )
-            {
-                LOGGER.debug( "Skipping directory (invalid path): {}", text );
+        } else if (equalsAnyIgnoreCase(text, "true", "false", "utf-8", "null", "\\") // common values
+                || contains(text, "*") // tag value is a glob or regex - unclear how to process
+                || (contains(text, ":") && !contains(text, ":\\")) // artifactId
+                || startsWithAny(text, "com.", "org.", "io.", "java.", "javax.") // java packages
+                || startsWithAny(text, "${env.") // env variables in maven notation
+                || startsWithAny(
+                        text,
+                        "http:",
+                        "https:",
+                        "scm:",
+                        "ssh:",
+                        "git:",
+                        "svn:",
+                        "cp:",
+                        "classpath:")) // urls identified by common protocols
+        {
+            LOGGER.debug("Skipping directory (blacklisted literal): {}", text);
+        } else if (startsWithAny(text, tmpDir)) // tmp dir
+        {
+            LOGGER.debug("Skipping directory (temp dir): {}", text);
+        } else {
+            try {
+                return Paths.get(text);
+            } catch (Exception ignore) {
+                LOGGER.debug("Skipping directory (invalid path): {}", text);
             }
         }
         return null;
     }
 
-    static void walkDirectoryFiles( Path dir, List<Path> collectedFiles, String glob, Predicate<Path> mustBeSkipped )
-    {
-        if ( !Files.isDirectory( dir ) )
-        {
+    static void walkDirectoryFiles(Path dir, List<Path> collectedFiles, String glob, Predicate<Path> mustBeSkipped) {
+        if (!Files.isDirectory(dir)) {
             return;
         }
 
-        try
-        {
-            try ( DirectoryStream<Path> stream = Files.newDirectoryStream( dir, glob ) )
-            {
-                for ( Path entry : stream )
-                {
-                    if ( mustBeSkipped.test( entry ) )
-                    {
+        try {
+            try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, glob)) {
+                for (Path entry : stream) {
+                    if (mustBeSkipped.test(entry)) {
                         continue;
                     }
                     File file = entry.toFile();
-                    if ( file.isFile() && !isHidden( entry ) && isReadable( entry ) )
-                    {
-                        collectedFiles.add( entry );
+                    if (file.isFile() && !isHidden(entry) && isReadable(entry)) {
+                        collectedFiles.add(entry);
                     }
                 }
             }
-        }
-        catch ( IOException e )
-        {
-            throw new RuntimeException( "Cannot process directory: " + dir, e );
+        } catch (IOException e) {
+            throw new RuntimeException("Cannot process directory: " + dir, e);
         }
     }
 
-    private static boolean isHidden( Path entry ) throws IOException
-    {
-        return Files.isHidden( entry ) || entry.toFile().getName().startsWith( "." );
+    private static boolean isHidden(Path entry) throws IOException {
+        return Files.isHidden(entry) || entry.toFile().getName().startsWith(".");
     }
 
-    private static boolean isReadable( Path entry ) throws IOException
-    {
-        return Files.isReadable( entry );
+    private static boolean isReadable(Path entry) throws IOException {
+        return Files.isReadable(entry);
     }
 
-    private boolean isFilteredOutSubpath( Path path )
-    {
+    private boolean isFilteredOutSubpath(Path path) {
         Path normalized = path.normalize();
-        for ( Path filteredOutDir : filteredOutPaths )
-        {
-            if ( normalized.startsWith( filteredOutDir ) )
-            {
+        for (Path filteredOutDir : filteredOutPaths) {
+            if (normalized.startsWith(filteredOutDir)) {
                 return true;
             }
         }
         return false;
     }
 
-    private SortedMap<String, String> getMutableDependencies() throws IOException
-    {
+    private SortedMap<String, String> getMutableDependencies() throws IOException {
         SortedMap<String, String> result = new TreeMap<>();
 
-        for ( Dependency dependency : project.getDependencies() )
-        {
+        for (Dependency dependency : project.getDependencies()) {
 
-            if ( CacheUtils.isPom( dependency ) )
-            {
+            if (CacheUtils.isPom(dependency)) {
                 // POM dependency will be resolved by maven system to actual dependencies
                 // and will contribute to effective pom.
                 // Effective result will be recorded by #getNormalizedPom
@@ -738,102 +655,86 @@ public class MavenProjectInput
             }
 
             // saved to index by the end of dependency build
-            MavenProject dependencyProject = multiModuleSupport.tryToResolveProject(
-                    dependency.getGroupId(),
-                    dependency.getArtifactId(),
-                    dependency.getVersion() )
-                    .orElse( null );
-            boolean isSnapshot = isSnapshot( dependency.getVersion() );
-            if ( dependencyProject == null && !isSnapshot )
-            {
+            MavenProject dependencyProject = multiModuleSupport
+                    .tryToResolveProject(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion())
+                    .orElse(null);
+            boolean isSnapshot = isSnapshot(dependency.getVersion());
+            if (dependencyProject == null && !isSnapshot) {
                 // external immutable dependency, should skip
                 continue;
             }
             String projectHash;
-            if ( dependencyProject != null ) //part of multi module
+            if (dependencyProject != null) // part of multi module
             {
-                projectHash = projectInputCalculator.calculateInput( dependencyProject ).getChecksum();
-            }
-            else //this is a snapshot dependency
+                projectHash =
+                        projectInputCalculator.calculateInput(dependencyProject).getChecksum();
+            } else // this is a snapshot dependency
             {
-                DigestItem resolved = resolveArtifact(
-                        repoSystem.createDependencyArtifact( dependency ),
-                        false );
+                DigestItem resolved = resolveArtifact(repoSystem.createDependencyArtifact(dependency), false);
                 projectHash = resolved.getHash();
             }
             result.put(
-                    KeyUtils.getVersionlessArtifactKey( repoSystem.createDependencyArtifact( dependency ) ),
-                    projectHash );
+                    KeyUtils.getVersionlessArtifactKey(repoSystem.createDependencyArtifact(dependency)), projectHash);
         }
         return result;
     }
 
     @Nonnull
-    private DigestItem resolveArtifact( final Artifact dependencyArtifact,
-            boolean isOffline ) throws IOException
-    {
+    private DigestItem resolveArtifact(final Artifact dependencyArtifact, boolean isOffline) throws IOException {
         ArtifactResolutionRequest request = new ArtifactResolutionRequest()
-                .setArtifact( dependencyArtifact )
-                .setResolveRoot( true )
-                .setResolveTransitively( false )
-                .setLocalRepository( session.getLocalRepository() )
-                .setRemoteRepositories( project.getRemoteArtifactRepositories() )
-                .setOffline( session.isOffline() || isOffline )
-                .setForceUpdate( session.getRequest().isUpdateSnapshots() )
-                .setServers( session.getRequest().getServers() )
-                .setMirrors( session.getRequest().getMirrors() )
-                .setProxies( session.getRequest().getProxies() );
-
-        final ArtifactResolutionResult result = repoSystem.resolve( request );
-
-        if ( !result.isSuccess() )
-        {
-            throw new DependencyNotResolvedException( "Cannot resolve in-project dependency: " + dependencyArtifact );
+                .setArtifact(dependencyArtifact)
+                .setResolveRoot(true)
+                .setResolveTransitively(false)
+                .setLocalRepository(session.getLocalRepository())
+                .setRemoteRepositories(project.getRemoteArtifactRepositories())
+                .setOffline(session.isOffline() || isOffline)
+                .setForceUpdate(session.getRequest().isUpdateSnapshots())
+                .setServers(session.getRequest().getServers())
+                .setMirrors(session.getRequest().getMirrors())
+                .setProxies(session.getRequest().getProxies());
+
+        final ArtifactResolutionResult result = repoSystem.resolve(request);
+
+        if (!result.isSuccess()) {
+            throw new DependencyNotResolvedException("Cannot resolve in-project dependency: " + dependencyArtifact);
         }
 
-        if ( !result.getMissingArtifacts().isEmpty() )
-        {
+        if (!result.getMissingArtifacts().isEmpty()) {
             throw new DependencyNotResolvedException(
-                    "Cannot resolve artifact: " + dependencyArtifact + ", missing: " + result.getMissingArtifacts() );
+                    "Cannot resolve artifact: " + dependencyArtifact + ", missing: " + result.getMissingArtifacts());
         }
 
-        if ( result.getArtifacts().size() != 1 )
-        {
-            throw new IllegalStateException(
-                    "Unexpected number of artifacts returned. Requested: " + dependencyArtifact
-                            + ", expected: 1, actual: " + result.getArtifacts() );
+        if (result.getArtifacts().size() != 1) {
+            throw new IllegalStateException("Unexpected number of artifacts returned. Requested: " + dependencyArtifact
+                    + ", expected: 1, actual: " + result.getArtifacts());
         }
 
         final Artifact resolved = result.getArtifacts().iterator().next();
 
         final HashAlgorithm algorithm = config.getHashFactory().createAlgorithm();
-        final String hash = algorithm.hash( resolved.getFile().toPath() );
-        return DtoUtils.createDigestedFile( resolved, hash );
+        final String hash = algorithm.hash(resolved.getFile().toPath());
+        return DtoUtils.createDigestedFile(resolved, hash);
     }
 
     /**
      * PathIgnoringCaseComparator
      */
-    public static class PathIgnoringCaseComparator implements Comparator<Path>
-    {
+    public static class PathIgnoringCaseComparator implements Comparator<Path> {
 
         @Override
-        public int compare( Path f1, Path f2 )
-        {
+        public int compare(Path f1, Path f2) {
             String s1 = f1.toAbsolutePath().toString();
             String s2 = f2.toAbsolutePath().toString();
-            if ( File.separator.equals( "\\" ) )
-            {
-                s1 = s1.replaceAll( "\\\\", "/" );
-                s2 = s2.replaceAll( "\\\\", "/" );
+            if (File.separator.equals("\\")) {
+                s1 = s1.replaceAll("\\\\", "/");
+                s2 = s2.replaceAll("\\\\", "/");
             }
-            return s1.compareToIgnoreCase( s2 );
+            return s1.compareToIgnoreCase(s2);
         }
     }
 
-    public static boolean isSkipCache( MavenProject project )
-    {
-        return Boolean.parseBoolean( project.getProperties().getProperty( CACHE_SKIP, "false" ) );
+    public static boolean isSkipCache(MavenProject project) {
+        return Boolean.parseBoolean(project.getProperties().getProperty(CACHE_SKIP, "false"));
     }
 
     /**
@@ -843,10 +744,8 @@ public class MavenProjectInput
      * @param  project
      * @return
      */
-    public static boolean isRestoreGeneratedSources( MavenProject project )
-    {
-        return Boolean
-                .parseBoolean( project.getProperties().getProperty( RESTORE_GENERATED_SOURCES_PROPERTY_NAME, "true" ) );
+    public static boolean isRestoreGeneratedSources(MavenProject project) {
+        return Boolean.parseBoolean(
+                project.getProperties().getProperty(RESTORE_GENERATED_SOURCES_PROPERTY_NAME, "true"));
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/WalkKey.java b/src/main/java/org/apache/maven/buildcache/checksum/WalkKey.java
index 2d5803d..5dc9463 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/WalkKey.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/WalkKey.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -23,72 +23,60 @@ import java.nio.file.Path;
 /**
  * WalkKey
  */
-public class WalkKey
-{
+public class WalkKey {
 
     private final Path normalized;
     private final String glob;
     private final boolean recursive;
 
-    public WalkKey( Path normalized, String glob, boolean recursive )
-    {
+    public WalkKey(Path normalized, String glob, boolean recursive) {
         this.normalized = normalized;
         this.glob = glob;
         this.recursive = recursive;
     }
 
     @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
+    public boolean equals(Object o) {
+        if (this == o) {
             return true;
         }
-        if ( o == null || getClass() != o.getClass() )
-        {
+        if (o == null || getClass() != o.getClass()) {
             return false;
         }
 
-        WalkKey key = ( WalkKey ) o;
+        WalkKey key = (WalkKey) o;
 
-        if ( recursive != key.recursive )
-        {
+        if (recursive != key.recursive) {
             return false;
         }
-        if ( !normalized.equals( key.normalized ) )
-        {
+        if (!normalized.equals(key.normalized)) {
             return false;
         }
-        return glob.equals( key.glob );
+        return glob.equals(key.glob);
     }
 
     @Override
-    public int hashCode()
-    {
+    public int hashCode() {
         int result = normalized.hashCode();
         result = 31 * result + glob.hashCode();
-        result = 31 * result + ( recursive ? 1 : 0 );
+        result = 31 * result + (recursive ? 1 : 0);
         return result;
     }
 
-    public Path getPath()
-    {
+    public Path getPath() {
         return normalized;
     }
 
-    public String getGlob()
-    {
+    public String getGlob() {
         return glob;
     }
 
-    public boolean isRecursive()
-    {
+    public boolean isRecursive() {
         return recursive;
     }
 
     @Override
-    public String toString()
-    {
+    public String toString() {
         return "WalkKey{" + "normalized=" + normalized + ", glob='" + glob + '\'' + ", recursive=" + recursive + '}';
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/CloseableBuffer.java b/src/main/java/org/apache/maven/buildcache/hash/CloseableBuffer.java
index c884d1b..791168d 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/CloseableBuffer.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/CloseableBuffer.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -32,35 +32,27 @@ import static org.apache.maven.buildcache.hash.ReflectionUtils.getMethod;
 /**
  * CloseableBuffer https://stackoverflow.com/a/54046774
  */
-public class CloseableBuffer implements AutoCloseable
-{
+public class CloseableBuffer implements AutoCloseable {
 
-    private static final Cleaner CLEANER = doPrivileged( new PrivilegedAction<Cleaner>()
-    {
+    private static final Cleaner CLEANER = doPrivileged(new PrivilegedAction<Cleaner>() {
 
         @Override
-        public Cleaner run()
-        {
-            final String jsv = System.getProperty( "java.specification.version", "9" );
-            if ( jsv.startsWith( "1." ) )
-            {
+        public Cleaner run() {
+            final String jsv = System.getProperty("java.specification.version", "9");
+            if (jsv.startsWith("1.")) {
                 return DirectCleaner.isSupported() ? new DirectCleaner() : new NoopCleaner();
-            }
-            else
-            {
+            } else {
                 return UnsafeCleaner.isSupported() ? new UnsafeCleaner() : new NoopCleaner();
             }
         }
-    } );
+    });
 
-    public static CloseableBuffer directBuffer( int capacity )
-    {
-        return new CloseableBuffer( ByteBuffer.allocateDirect( capacity ) );
+    public static CloseableBuffer directBuffer(int capacity) {
+        return new CloseableBuffer(ByteBuffer.allocateDirect(capacity));
     }
 
-    public static CloseableBuffer mappedBuffer( FileChannel channel, MapMode mode ) throws IOException
-    {
-        return new CloseableBuffer( channel.map( mode, 0, channel.size() ) );
+    public static CloseableBuffer mappedBuffer(FileChannel channel, MapMode mode) throws IOException {
+        return new CloseableBuffer(channel.map(mode, 0, channel.size()));
     }
 
     private ByteBuffer buffer;
@@ -68,8 +60,7 @@ public class CloseableBuffer implements AutoCloseable
     /**
      * Unmap only DirectByteBuffer and MappedByteBuffer
      */
-    private CloseableBuffer( ByteBuffer buffer )
-    {
+    private CloseableBuffer(ByteBuffer buffer) {
         // Java 8: buffer.isDirect()
         this.buffer = buffer;
     }
@@ -77,57 +68,46 @@ public class CloseableBuffer implements AutoCloseable
     /**
      * Do not use buffer after close
      */
-    public ByteBuffer getBuffer()
-    {
+    public ByteBuffer getBuffer() {
         return buffer;
     }
 
     @Override
-    public void close()
-    {
+    public void close() {
         // Java 8: () -> CLEANER.clean(buffer)
-        boolean done = doPrivileged( new PrivilegedAction<Boolean>()
-        {
+        boolean done = doPrivileged(new PrivilegedAction<Boolean>() {
 
             @Override
-            public Boolean run()
-            {
-                return CLEANER.clean( buffer );
+            public Boolean run() {
+                return CLEANER.clean(buffer);
             }
-        } );
-        if ( done )
-        {
+        });
+        if (done) {
             buffer = null;
         }
     }
 
     // Java 8: @FunctionalInterface
-    private interface Cleaner
-    {
+    private interface Cleaner {
 
-        boolean clean( ByteBuffer buffer );
+        boolean clean(ByteBuffer buffer);
     }
 
-    private static class NoopCleaner implements Cleaner
-    {
+    private static class NoopCleaner implements Cleaner {
 
         @Override
-        public boolean clean( ByteBuffer buffer )
-        {
+        public boolean clean(ByteBuffer buffer) {
             return false;
         }
     }
 
-    private static class DirectCleaner implements Cleaner
-    {
+    private static class DirectCleaner implements Cleaner {
 
-        private static final Method ATTACHMENT = getMethod( "sun.nio.ch.DirectBuffer",
-                "attachment" );
-        private static final Method CLEANER = getMethod( "sun.nio.ch.DirectBuffer", "cleaner" );
-        private static final Method CLEAN = getMethod( "sun.misc.Cleaner", "clean" );
+        private static final Method ATTACHMENT = getMethod("sun.nio.ch.DirectBuffer", "attachment");
+        private static final Method CLEANER = getMethod("sun.nio.ch.DirectBuffer", "cleaner");
+        private static final Method CLEAN = getMethod("sun.misc.Cleaner", "clean");
 
-        public static boolean isSupported()
-        {
+        public static boolean isSupported() {
             return ATTACHMENT != null && CLEAN != null && CLEANER != null;
         }
 
@@ -137,32 +117,25 @@ public class CloseableBuffer implements AutoCloseable
          * EXCEPTION_ACCESS_VIOLATION" See: https://stackoverflow.com/a/31592947/3950982
          */
         @Override
-        public boolean clean( ByteBuffer buffer )
-        {
-            try
-            {
-                if ( ATTACHMENT.invoke( buffer ) == null )
-                {
-                    CLEAN.invoke( CLEANER.invoke( buffer ) );
+        public boolean clean(ByteBuffer buffer) {
+            try {
+                if (ATTACHMENT.invoke(buffer) == null) {
+                    CLEAN.invoke(CLEANER.invoke(buffer));
                     return true;
                 }
-            }
-            catch ( Exception ignore )
-            {
+            } catch (Exception ignore) {
             }
             return false;
         }
     }
 
-    private static class UnsafeCleaner implements Cleaner
-    {
+    private static class UnsafeCleaner implements Cleaner {
 
         // Java 9: getMethod("jdk.internal.misc.Unsafe", "invokeCleaner", ByteBuffer.class);
-        private static final Method INVOKE_CLEANER = getMethod( "sun.misc.Unsafe", "invokeCleaner", ByteBuffer.class );
-        private static final Object UNSAFE = getField( "sun.misc.Unsafe", "theUnsafe" );
+        private static final Method INVOKE_CLEANER = getMethod("sun.misc.Unsafe", "invokeCleaner", ByteBuffer.class);
+        private static final Object UNSAFE = getField("sun.misc.Unsafe", "theUnsafe");
 
-        public static boolean isSupported()
-        {
+        public static boolean isSupported() {
             return UNSAFE != null && INVOKE_CLEANER != null;
         }
 
@@ -172,16 +145,12 @@ public class CloseableBuffer implements AutoCloseable
          * makes the same call, but does not print the reflection warning
          */
         @Override
-        public boolean clean( ByteBuffer buffer )
-        {
-            try
-            {
+        public boolean clean(ByteBuffer buffer) {
+            try {
                 // throws IllegalArgumentException if buffer is a duplicate or slice
-                INVOKE_CLEANER.invoke( UNSAFE, buffer );
+                INVOKE_CLEANER.invoke(UNSAFE, buffer);
                 return true;
-            }
-            catch ( Exception ignore )
-            {
+            } catch (Exception ignore) {
             }
             return false;
         }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/Hash.java b/src/main/java/org/apache/maven/buildcache/hash/Hash.java
index 9228d37..7fc8e2a 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/Hash.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/Hash.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -24,27 +24,24 @@ import java.nio.file.Path;
 /**
  * Hash
  */
-public class Hash
-{
+public class Hash {
 
     /**
      * Algorithm
      */
-    public interface Algorithm
-    {
+    public interface Algorithm {
 
-        byte[] hash( byte[] array );
+        byte[] hash(byte[] array);
 
-        byte[] hash( Path path ) throws IOException;
+        byte[] hash(Path path) throws IOException;
     }
 
     /**
      * accumulates states and should be completed by {@link #digest()}
      */
-    public interface Checksum
-    {
+    public interface Checksum {
 
-        void update( byte[] hash );
+        void update(byte[] hash);
 
         byte[] digest();
     }
@@ -52,13 +49,12 @@ public class Hash
     /**
      * Factory
      */
-    public interface Factory
-    {
+    public interface Factory {
 
         String getAlgorithm();
 
         Algorithm algorithm();
 
-        Checksum checksum( int count );
+        Checksum checksum(int count);
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/HashAlgorithm.java b/src/main/java/org/apache/maven/buildcache/hash/HashAlgorithm.java
index d2d42fe..87d9ea0 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/HashAlgorithm.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/HashAlgorithm.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -24,23 +24,19 @@ import java.nio.file.Path;
 /**
  * HashAlgorithm
  */
-public class HashAlgorithm
-{
+public class HashAlgorithm {
 
     private final Hash.Algorithm algorithm;
 
-    HashAlgorithm( Hash.Algorithm algorithm )
-    {
+    HashAlgorithm(Hash.Algorithm algorithm) {
         this.algorithm = algorithm;
     }
 
-    public String hash( Path path ) throws IOException
-    {
-        return HexUtils.encode( algorithm.hash( path ) );
+    public String hash(Path path) throws IOException {
+        return HexUtils.encode(algorithm.hash(path));
     }
 
-    public String hash( byte[] bytes )
-    {
-        return HexUtils.encode( algorithm.hash( bytes ) );
+    public String hash(byte[] bytes) {
+        return HexUtils.encode(algorithm.hash(bytes));
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/HashChecksum.java b/src/main/java/org/apache/maven/buildcache/hash/HashChecksum.java
index e9099e9..ce74f7a 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/HashChecksum.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/HashChecksum.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -24,44 +24,37 @@ import java.nio.file.Path;
 /**
  * HashChecksum
  */
-public class HashChecksum
-{
+public class HashChecksum {
 
     private final Hash.Algorithm algorithm;
     private final Hash.Checksum checksum;
 
-    HashChecksum( Hash.Algorithm algorithm, Hash.Checksum checksum )
-    {
+    HashChecksum(Hash.Algorithm algorithm, Hash.Checksum checksum) {
         this.algorithm = algorithm;
         this.checksum = checksum;
     }
 
-    public String update( Path path ) throws IOException
-    {
-        return updateAndEncode( algorithm.hash( path ) );
+    public String update(Path path) throws IOException {
+        return updateAndEncode(algorithm.hash(path));
     }
 
-    public String update( byte[] bytes )
-    {
-        return updateAndEncode( algorithm.hash( bytes ) );
+    public String update(byte[] bytes) {
+        return updateAndEncode(algorithm.hash(bytes));
     }
 
     /**
      * @param hexHash hash value in hex format. This method doesn't accept generic text - could result in error
      */
-    public String update( String hexHash )
-    {
-        return updateAndEncode( HexUtils.decode( hexHash ) );
+    public String update(String hexHash) {
+        return updateAndEncode(HexUtils.decode(hexHash));
     }
 
-    private String updateAndEncode( byte[] hash )
-    {
-        checksum.update( hash );
-        return HexUtils.encode( hash );
+    private String updateAndEncode(byte[] hash) {
+        checksum.update(hash);
+        return HexUtils.encode(hash);
     }
 
-    public String digest()
-    {
-        return HexUtils.encode( checksum.digest() );
+    public String digest() {
+        return HexUtils.encode(checksum.digest());
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/HashFactory.java b/src/main/java/org/apache/maven/buildcache/hash/HashFactory.java
index 30b3b1d..73cfc16 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/HashFactory.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/HashFactory.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -25,55 +25,45 @@ import java.util.Map;
 /**
  * HashFactory
  */
-public enum HashFactory
-{
-
-    SHA1( new SHA( "SHA-1" ) ),
-    SHA256( new SHA( "SHA-256" ) ),
-    SHA384( new SHA( "SHA-384" ) ),
-    SHA512( new SHA( "SHA-512" ) ),
-    XX( new XX() ),
-    XXMM( new XXMM() );
+public enum HashFactory {
+    SHA1(new SHA("SHA-1")),
+    SHA256(new SHA("SHA-256")),
+    SHA384(new SHA("SHA-384")),
+    SHA512(new SHA("SHA-512")),
+    XX(new XX()),
+    XXMM(new XXMM());
 
     private static final Map<String, HashFactory> LOOKUP = new HashMap<>();
 
-    static
-    {
-        for ( HashFactory factory : HashFactory.values() )
-        {
-            LOOKUP.put( factory.getAlgorithm(), factory );
+    static {
+        for (HashFactory factory : HashFactory.values()) {
+            LOOKUP.put(factory.getAlgorithm(), factory);
         }
     }
 
-    public static HashFactory of( String algorithm ) throws NoSuchAlgorithmException
-    {
-        final HashFactory factory = LOOKUP.get( algorithm );
-        if ( factory == null )
-        {
-            throw new NoSuchAlgorithmException( algorithm );
+    public static HashFactory of(String algorithm) throws NoSuchAlgorithmException {
+        final HashFactory factory = LOOKUP.get(algorithm);
+        if (factory == null) {
+            throw new NoSuchAlgorithmException(algorithm);
         }
         return factory;
     }
 
     private final Hash.Factory factory;
 
-    HashFactory( Hash.Factory factory )
-    {
+    HashFactory(Hash.Factory factory) {
         this.factory = factory;
     }
 
-    public String getAlgorithm()
-    {
+    public String getAlgorithm() {
         return factory.getAlgorithm();
     }
 
-    public HashAlgorithm createAlgorithm()
-    {
-        return new HashAlgorithm( factory.algorithm() );
+    public HashAlgorithm createAlgorithm() {
+        return new HashAlgorithm(factory.algorithm());
     }
 
-    public HashChecksum createChecksum( int count )
-    {
-        return new HashChecksum( factory.algorithm(), factory.checksum( count ) );
+    public HashChecksum createChecksum(int count) {
+        return new HashChecksum(factory.algorithm(), factory.checksum(count));
     }
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/HexUtils.java b/src/main/java/org/apache/maven/buildcache/hash/HexUtils.java
index 1b18a37..1e38b90 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/HexUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/HexUtils.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -23,64 +23,53 @@ import java.nio.charset.StandardCharsets;
 /**
  * HexUtils
  */
-@SuppressWarnings( "checkstyle:MagicNumber" )
-public class HexUtils
-{
+@SuppressWarnings("checkstyle:MagicNumber")
+public class HexUtils {
 
     private static final byte[] ENC_ARRAY;
     private static final byte[] DEC_ARRAY;
 
-    static
-    {
+    static {
         ENC_ARRAY = new byte[16];
         DEC_ARRAY = new byte[256];
-        for ( byte i = 0; i < 10; i++ )
-        {
-            ENC_ARRAY[i] = ( byte ) ( '0' + i );
+        for (byte i = 0; i < 10; i++) {
+            ENC_ARRAY[i] = (byte) ('0' + i);
             DEC_ARRAY['0' + i] = i;
         }
-        for ( byte i = 10; i < 16; i++ )
-        {
-            ENC_ARRAY[i] = ( byte ) ( 'a' + i - 10 );
+        for (byte i = 10; i < 16; i++) {
+            ENC_ARRAY[i] = (byte) ('a' + i - 10);
             DEC_ARRAY['a' + i - 10] = i;
             DEC_ARRAY['A' + i - 10] = i;
         }
     }
 
-    public static String encode( byte[] hash )
-    {
+    public static String encode(byte[] hash) {
         byte[] hexChars = new byte[hash.length * 2];
-        for ( int j = 0; j < hash.length; j++ )
-        {
+        for (int j = 0; j < hash.length; j++) {
             int v = hash[j] & 0xFF;
             hexChars[j * 2] = ENC_ARRAY[v >>> 4];
             hexChars[j * 2 + 1] = ENC_ARRAY[v & 0x0F];
         }
-        return new String( hexChars, StandardCharsets.US_ASCII );
+        return new String(hexChars, StandardCharsets.US_ASCII);
     }
 
-    public static byte[] decode( String hex )
-    {
+    public static byte[] decode(String hex) {
         int size = hex.length();
-        if ( size % 2 != 0 )
-        {
-            throw new IllegalArgumentException( "String length should be even" );
+        if (size % 2 != 0) {
+            throw new IllegalArgumentException("String length should be even");
         }
         byte[] bytes = new byte[size / 2];
         int idx = 0;
-        for ( int i = 0; i < size; i += 2 )
-        {
-            bytes[idx++] = ( byte ) ( DEC_ARRAY[hex.charAt( i )] << 4 | DEC_ARRAY[hex.charAt( i + 1 )] );
+        for (int i = 0; i < size; i += 2) {
+            bytes[idx++] = (byte) (DEC_ARRAY[hex.charAt(i)] << 4 | DEC_ARRAY[hex.charAt(i + 1)]);
         }
         return bytes;
     }
 
-    public static byte[] toByteArray( long value )
-    {
+    public static byte[] toByteArray(long value) {
         byte[] result = new byte[8];
-        for ( int i = 7; i >= 0; i-- )
-        {
-            result[i] = ( byte ) ( value & 0xFF );
+        for (int i = 7; i >= 0; i--) {
+            result[i] = (byte) (value & 0xFF);
             value >>= 8;
         }
         return result;
diff --git a/src/main/java/org/apache/maven/buildcache/hash/ReflectionUtils.java b/src/main/java/org/apache/maven/buildcache/hash/ReflectionUtils.java
index 522557c..74c4614 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/ReflectionUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/ReflectionUtils.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -24,38 +24,27 @@ import java.lang.reflect.Method;
 /**
  * ReflectionUtils
  */
-class ReflectionUtils
-{
+class ReflectionUtils {
 
-    static Method getMethod( String className, String methodName, Class<?>... parameterTypes )
-    {
-        try
-        {
-            final Method method = Class.forName( className ).getMethod( methodName, parameterTypes );
-            method.setAccessible( true );
+    static Method getMethod(String className, String methodName, Class<?>... parameterTypes) {
+        try {
+            final Method method = Class.forName(className).getMethod(methodName, parameterTypes);
+            method.setAccessible(true);
             return method;
-        }
-        catch ( Exception ignore )
-        {
+        } catch (Exception ignore) {
             return null;
         }
     }
 
-    static Object getField( String className, String fieldName )
-    {
-        try
-        {
-            final Field field = Class.forName( className ).getDeclaredField( fieldName );
-            field.setAccessible( true );
-            return field.get( null );
-        }
-        catch ( Exception ignore )
-        {
+    static Object getField(String className, String fieldName) {
+        try {
+            final Field field = Class.forName(className).getDeclaredField(fieldName);
+            field.setAccessible(true);
+            return field.get(null);
+        } catch (Exception ignore) {
             return null;
         }
     }
 
-    private ReflectionUtils()
-    {
-    }
+    private ReflectionUtils() {}
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/SHA.java b/src/main/java/org/apache/maven/buildcache/hash/SHA.java
index 0292e03..38d8b2d 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/SHA.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/SHA.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -26,79 +26,66 @@ import java.security.MessageDigest;
 /**
  * SHA
  */
-public class SHA implements Hash.Factory
-{
+public class SHA implements Hash.Factory {
 
     private static final ThreadLocal<MessageDigest> ALGORITHM = new ThreadLocal<>();
     private static final ThreadLocal<MessageDigest> CHECKSUM = new ThreadLocal<>();
 
     private final String algorithm;
 
-    SHA( String algorithm )
-    {
+    SHA(String algorithm) {
         this.algorithm = algorithm;
     }
 
     @Override
-    public String getAlgorithm()
-    {
+    public String getAlgorithm() {
         return algorithm;
     }
 
     @Override
-    public Hash.Algorithm algorithm()
-    {
-        return new SHA.Algorithm( ThreadLocalDigest.get( ALGORITHM, algorithm ) );
+    public Hash.Algorithm algorithm() {
+        return new SHA.Algorithm(ThreadLocalDigest.get(ALGORITHM, algorithm));
     }
 
     @Override
-    public Hash.Checksum checksum( int count )
-    {
-        return new SHA.Checksum( ThreadLocalDigest.get( CHECKSUM, algorithm ) );
+    public Hash.Checksum checksum(int count) {
+        return new SHA.Checksum(ThreadLocalDigest.get(CHECKSUM, algorithm));
     }
 
-    private static class Algorithm implements Hash.Algorithm
-    {
+    private static class Algorithm implements Hash.Algorithm {
 
         private final MessageDigest digest;
 
-        private Algorithm( MessageDigest digest )
-        {
+        private Algorithm(MessageDigest digest) {
             this.digest = digest;
         }
 
         @Override
-        public byte[] hash( byte[] array )
-        {
-            return digest.digest( array );
+        public byte[] hash(byte[] array) {
+            return digest.digest(array);
         }
 
         @Override
-        public byte[] hash( Path path ) throws IOException
-        {
-            return hash( Files.readAllBytes( path ) );
+        public byte[] hash(Path path) throws IOException {
+            return hash(Files.readAllBytes(path));
         }
     }
 
-    private static class Checksum implements Hash.Checksum
-    {
+    private static class Checksum implements Hash.Checksum {
 
         private final MessageDigest digest;
 
-        private Checksum( MessageDigest digest )
-        {
+        private Checksum(MessageDigest digest) {
             this.digest = digest;
         }
 
         @Override
-        public void update( byte[] hash )
-        {
-            digest.update( hash );
+        public void update(byte[] hash) {
+            digest.update(hash);
         }
 
         @Override
-        public byte[] digest()
-        {
+        public byte[] digest() {
             return digest.digest();
         }
     }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalBuffer.java b/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalBuffer.java
index ef42774..1ba19ec 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalBuffer.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalBuffer.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -25,62 +25,50 @@ import java.util.concurrent.ConcurrentMap;
 /**
  * ThreadLocalBuffer
  */
-public class ThreadLocalBuffer
-{
+public class ThreadLocalBuffer {
 
     private static final ConcurrentMap<CloseableBuffer, Boolean> LOCALS = new ConcurrentHashMap<>();
 
-    public static ByteBuffer get( ThreadLocal<CloseableBuffer> local, int capacity )
-    {
+    public static ByteBuffer get(ThreadLocal<CloseableBuffer> local, int capacity) {
         final CloseableBuffer buffer = local.get();
-        if ( buffer == null )
-        {
-            return create( local, capacity );
+        if (buffer == null) {
+            return create(local, capacity);
         }
 
-        if ( capacity( buffer ) < capacity )
-        {
-            close( buffer );
-            return create( local, capacity * 2 );
+        if (capacity(buffer) < capacity) {
+            close(buffer);
+            return create(local, capacity * 2);
         }
 
-        return clear( buffer );
+        return clear(buffer);
     }
 
     @Override
-    public void finalize()
-    {
-        for ( CloseableBuffer buffer : LOCALS.keySet() )
-        {
+    public void finalize() {
+        for (CloseableBuffer buffer : LOCALS.keySet()) {
             buffer.close();
         }
     }
 
-    private static ByteBuffer create( ThreadLocal<CloseableBuffer> local, int capacity )
-    {
-        final CloseableBuffer buffer = CloseableBuffer.directBuffer( capacity );
-        local.set( buffer );
-        LOCALS.put( buffer, false );
+    private static ByteBuffer create(ThreadLocal<CloseableBuffer> local, int capacity) {
+        final CloseableBuffer buffer = CloseableBuffer.directBuffer(capacity);
+        local.set(buffer);
+        LOCALS.put(buffer, false);
         return buffer.getBuffer();
     }
 
-    private static int capacity( CloseableBuffer buffer )
-    {
+    private static int capacity(CloseableBuffer buffer) {
         return buffer.getBuffer().capacity();
     }
 
-    private static ByteBuffer clear( CloseableBuffer buffer )
-    {
-        return ( ByteBuffer ) buffer.getBuffer().clear();
+    private static ByteBuffer clear(CloseableBuffer buffer) {
+        return (ByteBuffer) buffer.getBuffer().clear();
     }
 
-    private static void close( CloseableBuffer buffer )
-    {
-        LOCALS.remove( buffer );
+    private static void close(CloseableBuffer buffer) {
+        LOCALS.remove(buffer);
         buffer.close();
     }
 
-    private ThreadLocalBuffer()
-    {
-    }
+    private ThreadLocalBuffer() {}
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalDigest.java b/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalDigest.java
index 0e4c64a..9414093 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalDigest.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/ThreadLocalDigest.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -25,47 +25,36 @@ import java.util.Objects;
 /**
  * ThreadLocalDigest
  */
-public class ThreadLocalDigest
-{
+public class ThreadLocalDigest {
 
-    public static MessageDigest get( ThreadLocal<MessageDigest> local, String algorithm )
-    {
+    public static MessageDigest get(ThreadLocal<MessageDigest> local, String algorithm) {
         final MessageDigest digest = local.get();
-        if ( digest == null )
-        {
-            return create( local, algorithm );
+        if (digest == null) {
+            return create(local, algorithm);
         }
 
-        if ( Objects.equals( digest.getAlgorithm(), algorithm ) )
-        {
-            return reset( digest );
+        if (Objects.equals(digest.getAlgorithm(), algorithm)) {
+            return reset(digest);
         }
 
-        reset( digest );
-        return create( local, algorithm );
+        reset(digest);
+        return create(local, algorithm);
     }
 
-    private static MessageDigest create( ThreadLocal<MessageDigest> local, String algorithm )
-    {
-        try
-        {
-            final MessageDigest digest = MessageDigest.getInstance( algorithm );
-            local.set( digest );
+    private static MessageDigest create(ThreadLocal<MessageDigest> local, String algorithm) {
+        try {
+            final MessageDigest digest = MessageDigest.getInstance(algorithm);
+            local.set(digest);
             return digest;
-        }
-        catch ( NoSuchAlgorithmException e )
-        {
-            throw new RuntimeException( "Cannot create message digest with algorithm: " + algorithm, e );
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException("Cannot create message digest with algorithm: " + algorithm, e);
         }
     }
 
-    private static MessageDigest reset( MessageDigest digest )
-    {
+    private static MessageDigest reset(MessageDigest digest) {
         digest.reset();
         return digest;
     }
 
-    private ThreadLocalDigest()
-    {
-    }
+    private ThreadLocalDigest() {}
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/XX.java b/src/main/java/org/apache/maven/buildcache/hash/XX.java
index 05e37b4..59fc966 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/XX.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/XX.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -22,77 +22,65 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.file.Files;
 import java.nio.file.Path;
+
 import net.openhft.hashing.LongHashFunction;
 
 /**
  * XX
  */
-public class XX implements Hash.Factory
-{
+public class XX implements Hash.Factory {
 
     static final LongHashFunction INSTANCE = LongHashFunction.xx();
 
     @Override
-    public String getAlgorithm()
-    {
+    public String getAlgorithm() {
         return "XX";
     }
 
     @Override
-    public Hash.Algorithm algorithm()
-    {
+    public Hash.Algorithm algorithm() {
         return new XX.Algorithm();
     }
 
     @Override
-    public Hash.Checksum checksum( int count )
-    {
-        return new XX.Checksum( ByteBuffer.allocate( capacity( count ) ) );
+    public Hash.Checksum checksum(int count) {
+        return new XX.Checksum(ByteBuffer.allocate(capacity(count)));
     }
 
-    static int capacity( int count )
-    {
+    static int capacity(int count) {
         // Java 8: Long.BYTES
         return count * Long.SIZE / Byte.SIZE;
     }
 
-    static class Algorithm implements Hash.Algorithm
-    {
+    static class Algorithm implements Hash.Algorithm {
 
         @Override
-        public byte[] hash( byte[] array )
-        {
-            return HexUtils.toByteArray( INSTANCE.hashBytes( array ) );
+        public byte[] hash(byte[] array) {
+            return HexUtils.toByteArray(INSTANCE.hashBytes(array));
         }
 
         @Override
-        public byte[] hash( Path path ) throws IOException
-        {
-            return hash( Files.readAllBytes( path ) );
+        public byte[] hash(Path path) throws IOException {
+            return hash(Files.readAllBytes(path));
         }
     }
 
-    static class Checksum implements Hash.Checksum
-    {
+    static class Checksum implements Hash.Checksum {
 
         private final ByteBuffer buffer;
 
-        Checksum( ByteBuffer buffer )
-        {
+        Checksum(ByteBuffer buffer) {
             this.buffer = buffer;
         }
 
         @Override
-        public void update( byte[] hash )
-        {
-            buffer.put( hash );
+        public void update(byte[] hash) {
+            buffer.put(hash);
         }
 
         @Override
-        public byte[] digest()
-        {
-            return HexUtils.toByteArray( INSTANCE.hashBytes( buffer, 0, buffer.position() ) );
+        public byte[] digest() {
+            return HexUtils.toByteArray(INSTANCE.hashBytes(buffer, 0, buffer.position()));
         }
     }
-
 }
diff --git a/src/main/java/org/apache/maven/buildcache/hash/XXMM.java b/src/main/java/org/apache/maven/buildcache/hash/XXMM.java
index 6d7682e..9eedd1f 100644
--- a/src/main/java/org/apache/maven/buildcache/hash/XXMM.java
+++ b/src/main/java/org/apache/maven/buildcache/hash/XXMM.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -28,39 +28,32 @@ import static java.nio.file.StandardOpenOption.READ;
 /**
  * XXMM
  */
-public class XXMM implements Hash.Factory
-{
+public class XXMM implements Hash.Factory {
 
     private static final ThreadLocal<CloseableBuffer> BUFFER = new ThreadLocal<>();
 
     @Override
-    public String getAlgorithm()
-    {
+    public String getAlgorithm() {
         return "XXMM";
     }
 
     @Override
-    public Hash.Algorithm algorithm()
-    {
+    public Hash.Algorithm algorithm() {
         return new Algorithm();
     }
 
     @Override
-    public Hash.Checksum checksum( int count )
-    {
-        return new XX.Checksum( ThreadLocalBuffer.get( BUFFER, XX.capacity( count ) ) );
+    public Hash.Checksum checksum(int count) {
+        return new XX.Checksum(ThreadLocalBuffer.get(BUFFER, XX.capacity(count)));
     }
 
-    private static class Algorithm extends XX.Algorithm
-    {
+    private static class Algorithm extends XX.Algorithm {
 
         @Override
-        public byte[] hash( Path path ) throws IOException
-        {
-            try ( FileChannel channel = FileChannel.open( path, READ );
-                    CloseableBuffer buffer = CloseableBuffer.mappedBuffer( channel, READ_ONLY ) )
-            {
-                return HexUtils.toByteArray( XX.INSTANCE.hashBytes( buffer.getBuffer() ) );
+        public byte[] hash(Path path) throws IOException {
+            try (FileChannel channel = FileChannel.open(path, READ);
+                    CloseableBuffer buffer = CloseableBuffer.mappedBuffer(channel, READ_ONLY)) {
+                return HexUtils.toByteArray(XX.INSTANCE.hashBytes(buffer.getBuffer()));
             }
         }
     }
diff --git a/src/main/java/org/apache/maven/buildcache/xml/Build.java b/src/main/java/org/apache/maven/buildcache/xml/Build.java
index 6ce7422..0a8f5d9 100644
--- a/src/main/java/org/apache/maven/buildcache/xml/Build.java
+++ b/src/main/java/org/apache/maven/buildcache/xml/Build.java
@@ -7,7 +7,7 @@
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *  http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
+
 import org.apache.maven.buildcache.CacheUtils;
 import org.apache.maven.buildcache.checksum.MavenProjectInput;
 import org.apache.maven.buildcache.hash.HashAlgorithm;
@@ -43,159 +44,132 @@ import static org.apache.maven.buildcache.CacheUtils.mojoExecutionKey;
 /**
  * Build
  */
-public class Build
-{
+public class Build {
 
     final org.apache.maven.buildcache.xml.build.Build dto;
     CacheSource source;
     volatile Map<String, CompletedExecution> execMap;
 
-    public Build( List<String> goals,
+    public Build(
+            List<String> goals,
             Artifact artifact,
             List<Artifact> attachedArtifacts,
             ProjectsInputInfo projectsInputInfo,
             List<CompletedExecution> completedExecutions,
-            String hashAlgorithm )
-    {
+            String hashAlgorithm) {
         this.dto = new org.apache.maven.buildcache.xml.build.Build();
-        this.dto.setCacheImplementationVersion( MavenProjectInput.CACHE_IMPLEMENTATION_VERSION );
-        this.dto.setBuildTime( new Date() );
-        try
-        {
-            this.dto.setBuildServer( InetAddress.getLocalHost().getCanonicalHostName() );
-        }
-        catch ( UnknownHostException ignore )
-        {
-            this.dto.setBuildServer( "unknown" );
+        this.dto.setCacheImplementationVersion(MavenProjectInput.CACHE_IMPLEMENTATION_VERSION);
+        this.dto.setBuildTime(new Date());
+        try {
+            this.dto.setBuildServer(InetAddress.getLocalHost().getCanonicalHostName());
+        } catch (UnknownHostException ignore) {
+            this.dto.setBuildServer("unknown");
         }
-        this.dto.setHashFunction( hashAlgorithm );
-        this.dto.setArtifact( artifact );
-        this.dto.setGoals( goals );
-        this.dto.setAttachedArtifacts( attachedArtifacts );
-        this.dto.setExecutions( completedExecutions );
-        this.dto.setProjectsInputInfo( projectsInputInfo );
+        this.dto.setHashFunction(hashAlgorithm);
+        this.dto.setArtifact(artifact);
+        this.dto.setGoals(goals);
+        this.dto.setAttachedArtifacts(attachedArtifacts);
+        this.dto.setExecutions(completedExecutions);
+        this.dto.setProjectsInputInfo(projectsInputInfo);
         this.source = CacheSource.BUILD;
     }
 
-    public CacheSource getSource()
-    {
+    public CacheSource getSource() {
         return source;
     }
 
-    public Build( org.apache.maven.buildcache.xml.build.Build dto, CacheSource source )
-    {
+    public Build(org.apache.maven.buildcache.xml.build.Build dto, CacheSource source) {
         this.dto = dto;
         this.source = source;
     }
 
-    public static List<Artifact> createAttachedArtifacts( List<org.apache.maven.artifact.Artifact> artifacts,
-            HashAlgorithm algorithm ) throws IOException
-    {
+    public static List<Artifact> createAttachedArtifacts(
+            List<org.apache.maven.artifact.Artifact> artifacts, HashAlgorithm algorithm) throws IOException {
         List<Artifact> attachedArtifacts = new ArrayList<>();
-        for ( org.apache.maven.artifact.Artifact artifact : artifacts )
-        {
-            final Artifact dto = DtoUtils.createDto( artifact );
-            if ( artifact.getFile() != null )
-            {
-                dto.setFileHash( algorithm.hash( artifact.getFile().toPath() ) );
... 4952 lines suppressed ...