diff --git a/README.md b/README.md
index 4fe4b6ae..11bd01ff 100644
--- a/README.md
+++ b/README.md
@@ -62,42 +62,7 @@ docker run -it --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye check
> :warning: `hawkeye-maven-plugin` is available since 3.3.0, but it's still Alpha which means that the API is subject to change before stable. Mainly, the configuration options may change.
-You can integrate HawkEye's functionality with Maven Plugin:
-
-```xml
-
- io.korandoru.hawkeye
- hawkeye-maven-plugin
- ${hawkeye.version}
-
-```
-
-The plugin provides three goals:
-
-* `check`: Check license headers.
-* `format`: Format license headers (auto-fix all files that failed the check).
-* `remove`: Remove license headers.
-
-With the plugin properly configured, you can run a specific goal as (take `check` as an example):
-
-```shell
-mvn hawkeye:check
-```
-
-You can configure a customized location of the `licenserc.toml` file as:
-
-```xml
-
- io.korandoru.hawkeye
- hawkeye-maven-plugin
- ${hawkeye.version}
-
- ${...}
-
-
-```
-
-... the default location is `${project.basedir}/licenserc.toml`.
+Read the [dedicated README](hawkeye-maven-plugin/README.md) for HawkEye Maven Plugin.
### Executable JAR
diff --git a/hawkeye-core/src/main/java/io/korandoru/hawkeye/core/config/HawkEyeConfig.java b/hawkeye-core/src/main/java/io/korandoru/hawkeye/core/config/HawkEyeConfig.java
index 13d56a70..04082dd3 100644
--- a/hawkeye-core/src/main/java/io/korandoru/hawkeye/core/config/HawkEyeConfig.java
+++ b/hawkeye-core/src/main/java/io/korandoru/hawkeye/core/config/HawkEyeConfig.java
@@ -20,6 +20,7 @@
import io.korandoru.hawkeye.core.mapping.Mapping;
import java.io.File;
import java.nio.file.Path;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -73,6 +74,12 @@ private Builder() {
// always use #of methods
}
+ public HawkEyeConfig.Builder addExcludes(List excludes) {
+ this.excludes = new ArrayList<>(this.excludes);
+ this.excludes.addAll(excludes);
+ return this;
+ }
+
public HawkEyeConfig build() {
return new HawkEyeConfig(
baseDir,
diff --git a/hawkeye-maven-plugin/README.md b/hawkeye-maven-plugin/README.md
new file mode 100644
index 00000000..28bed4cb
--- /dev/null
+++ b/hawkeye-maven-plugin/README.md
@@ -0,0 +1,104 @@
+# HawkEye Maven Plugin
+
+## Usage
+
+You can integrate HawkEye's functionality with Maven Plugin:
+
+```xml
+
+ io.korandoru.hawkeye
+ hawkeye-maven-plugin
+ ${hawkeye.version}
+
+```
+
+The plugin provides three goals:
+
+* `check`: Check license headers.
+* `format`: Format license headers (auto-fix all files that failed the check).
+* `remove`: Remove license headers.
+
+With the plugin properly configured, you can run a specific goal as (take `check` as an example):
+
+```shell
+mvn hawkeye:check
+```
+
+You can configure a customized location of the `licenserc.toml` file as:
+
+```xml
+
+ io.korandoru.hawkeye
+ hawkeye-maven-plugin
+ ${hawkeye.version}
+
+ ${...}
+
+
+```
+
+... the default location is `${project.basedir}/licenserc.toml`.
+
+## Verify
+
+The `check` goal is bind to the `verify` phase by default. If you'd like to do all verifications with a single `mvn verify`, you can add the HawkEye checks as:
+
+```xml
+
+ io.korandoru.hawkeye
+ hawkeye-maven-plugin
+ ${hawkeye.version}
+
+
+
+ check
+
+
+
+
+```
+
+## Multimodule
+
+HawkEye is designed to run against a whole project but Maven plugin is configured to each module.
+
+That said, the default location of configuration file (`${project.basedir}/licenserc.toml`) will be resolved to different place due to each module has its own `${project.basedir}`. This is the same to the basedir of the execution.
+
+Below are two recommendations for configuring multimodule project.
+
+### Aggregator
+
+The HawkEye plugin provides an option named `aggregate` with which you can check the headers for all modules of your project.
+
+You can configure the plugin with `aggregate` for your parent `pom.xml`:
+
+```xml
+
+ io.korandoru.hawkeye
+ hawkeye-maven-plugin
+ ${hawkeye.version}
+
+ true
+
+
+```
+
+... and properly skip all the submodules.
+
+You can also run as aggregator from the commandline:
+
+```shell
+mvn hawkeye:check -pl . -Daggregate=true
+```
+
+### Each module
+
+You can still configure the plugin executions for each module, but pay attention to the resolved value of `configLocation` and `baseDir`.
+
+> This means `aggregate=false` and the plugin will exclude submodules when running against a parent module.
+
+The default `configLocation` is `${project.basedir}/licenserc.toml` which requires a `licenserc.toml` per module. If you use one config file for all modules, you should change the config value to a fixed location. [directory-maven-plugin](https://github.com/jdcasey/directory-maven-plugin), `${maven.multiModuleProjectDirectory}`, or [MNG-7038](https://issues.apache.org/jira/browse/MNG-7038) can help.
+
+The default `basedir` is overwritten by `${project.basedir}`, which means the one configured in `licenserc.toml` is not used. This should often be the value you want, but you can still change the directory for each module.
+
+Be aware that this basedir is also the one for resolving `includes` and `excludes`. If a file is not properly included or excluded, think of the resolved value of `includes` and `excludes` pattens.
diff --git a/hawkeye-maven-plugin/pom.xml b/hawkeye-maven-plugin/pom.xml
index be37f188..ece55d4e 100644
--- a/hawkeye-maven-plugin/pom.xml
+++ b/hawkeye-maven-plugin/pom.xml
@@ -34,16 +34,22 @@
hawkeye-core
${project.version}
+
+ org.apache.maven
+ maven-core
+ ${maven-core.version}
+ provided
+
org.apache.maven
maven-plugin-api
- ${maven-plugin-api.version}
+ ${maven-core.version}
provided
org.apache.maven.plugin-tools
maven-plugin-annotations
- ${maven-plugin-annotation.version}
+ ${maven-plugin-tools.version}
provided
@@ -53,7 +59,7 @@
org.apache.maven.plugins
maven-plugin-plugin
- ${maven-plugin-plugin.version}
+ ${maven-plugin-tools.version}
diff --git a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/AbstractMojo.java b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/AbstractMojo.java
index a454af21..3615fcb0 100644
--- a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/AbstractMojo.java
+++ b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/AbstractMojo.java
@@ -16,13 +16,53 @@
package io.korandoru.hawkeye.maven.plugin;
+import io.korandoru.hawkeye.core.config.HawkEyeConfig;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
abstract class AbstractMojo extends org.apache.maven.plugin.AbstractMojo {
- @Parameter(name = "config", alias = "cfg", defaultValue = "${project.basedir}/licenserc.toml")
- public File config;
+ /**
+ * The base directory, in which to search for project files.
+ */
+ @Parameter(property = "hawkeye.basedir", defaultValue = "${project.basedir}", required = true)
+ public File basedir;
- @Parameter(name = "dryRun", defaultValue = "false")
+ /**
+ * Location of the `licenserc.toml` file.
+ */
+ @Parameter(property = "hawkeye.configLocation", defaultValue = "${project.basedir}/licenserc.toml", required = true)
+ public File configLocation;
+
+ /**
+ * Whether to do the real formatting or removal.
+ */
+ @Parameter(property = "hawkeye.dryRun", defaultValue = "false")
public boolean dryRun;
+
+ /**
+ * You can set this flag to true if you want to check the headers for all
+ * modules of your project. Only used for multi-modules projects, to check
+ * for example the header licenses from the parent module for all submodules.
+ */
+ @Parameter(property = "hawkeye.aggregate", defaultValue = "false")
+ public boolean aggregate = false;
+
+ @Parameter(defaultValue = "${project}", readonly = true, required = true)
+ public MavenProject project;
+
+ protected HawkEyeConfig.Builder configBuilder() {
+ final List submodulesExcludes = new ArrayList<>();
+ if (project != null && project.getModules() != null && !aggregate) {
+ for (String module : project.getModules()) {
+ submodulesExcludes.add(module + "/**");
+ }
+ }
+ return HawkEyeConfig.of(configLocation)
+ .dryRun(dryRun)
+ .addExcludes(submodulesExcludes)
+ .baseDir(basedir.toPath());
+ }
}
diff --git a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/CheckMojo.java b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/CheckMojo.java
index 2d38d3a0..5b69c8a0 100644
--- a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/CheckMojo.java
+++ b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/CheckMojo.java
@@ -17,7 +17,6 @@
package io.korandoru.hawkeye.maven.plugin;
import io.korandoru.hawkeye.core.LicenseChecker;
-import io.korandoru.hawkeye.core.config.HawkEyeConfig;
import io.korandoru.hawkeye.core.report.Report;
import io.korandoru.hawkeye.core.report.ReportConstants;
import java.util.List;
@@ -32,32 +31,31 @@ public class CheckMojo extends AbstractMojo {
@Override
public void execute() throws MojoFailureException {
final Log log = getLog();
- log.info("Checking license headers... with cfg: %s".formatted(config));
- final HawkEyeConfig heConfig = HawkEyeConfig.of(config).build();
- final LicenseChecker checker = new LicenseChecker(heConfig);
+ log.info("Checking license headers... with config: %s".formatted(configLocation));
+
+ final LicenseChecker checker = new LicenseChecker(configBuilder().build());
final Report report = checker.call();
final List unknownHeaderFiles = report.getResults().entrySet().stream()
.filter(e -> ReportConstants.RESULT_UNKNOWN.equals(e.getValue()))
.map(Map.Entry::getKey)
.toList();
-
- for (String unknownHeaderFile : unknownHeaderFiles) {
- log.warn("Processing unknown file: %s".formatted(unknownHeaderFile));
- }
-
final List missingHeaderFiles = report.getResults().entrySet().stream()
.filter(e -> ReportConstants.RESULT_MISSING.equals(e.getValue()))
.map(Map.Entry::getKey)
.toList();
+ if (!unknownHeaderFiles.isEmpty()) {
+ log.warn("Processing unknown files: %s".formatted(unknownHeaderFiles));
+ }
+
if (missingHeaderFiles.isEmpty()) {
log.info("No missing header file has been found.");
return;
}
- for (String missingHeaderFile : missingHeaderFiles) {
- log.error("Found missing header file: %s".formatted(missingHeaderFile));
+ for (String filename : missingHeaderFiles) {
+ log.error("Found missing header files: %s".formatted(filename));
}
- throw new MojoFailureException("Missing header files found");
+ throw new MojoFailureException("Found missing header files.");
}
}
diff --git a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/FormatMojo.java b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/FormatMojo.java
index 4817d479..a3e643b6 100644
--- a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/FormatMojo.java
+++ b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/FormatMojo.java
@@ -17,7 +17,6 @@
package io.korandoru.hawkeye.maven.plugin;
import io.korandoru.hawkeye.core.LicenseFormatter;
-import io.korandoru.hawkeye.core.config.HawkEyeConfig;
import io.korandoru.hawkeye.core.report.Report;
import io.korandoru.hawkeye.core.report.ReportConstants;
import java.util.List;
@@ -30,35 +29,29 @@ public class FormatMojo extends AbstractMojo {
@Override
public void execute() {
final Log log = getLog();
- log.info("Formatting license headers... with cfg: %s, dryRun: %s".formatted(config, dryRun));
+ log.info("Formatting license headers... with config: %s, dryRun: %s".formatted(configLocation, dryRun));
- final HawkEyeConfig heConfig = HawkEyeConfig.of(config).dryRun(dryRun).build();
- final LicenseFormatter checker = new LicenseFormatter(heConfig);
- final Report report = checker.call();
+ final LicenseFormatter formatter = new LicenseFormatter(configBuilder().build());
+ final Report report = formatter.call();
final List unknownHeaderFiles = report.getResults().entrySet().stream()
.filter(e -> ReportConstants.RESULT_UNKNOWN.equals(e.getValue()))
.map(Map.Entry::getKey)
.toList();
- for (String unknownHeaderFile : unknownHeaderFiles) {
- log.warn("Processing unknown file: %s".formatted(unknownHeaderFile));
- }
-
final List> updatedHeaderFiles = report.getResults().entrySet().stream()
.filter(e -> !ReportConstants.RESULT_UNKNOWN.equals(e.getValue()))
.filter(e -> !ReportConstants.RESULT_NOOP.equals(e.getValue()))
.toList();
- if (updatedHeaderFiles.isEmpty()) {
- log.info("All files have proper header.");
- return;
+ if (!unknownHeaderFiles.isEmpty()) {
+ log.warn("Processing unknown files: %s".formatted(unknownHeaderFiles));
}
- if (!dryRun) {
- for (Map.Entry updatedHeaderFile : updatedHeaderFiles) {
- log.info("Updated header for file: %s".formatted(updatedHeaderFile.getKey()));
- }
+ if (updatedHeaderFiles.isEmpty()) {
+ log.info("All files have proper header.");
+ } else if (!dryRun) {
+ log.info("Updated header for files: %s".formatted(updatedHeaderFiles));
}
}
}
diff --git a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/RemoveMojo.java b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/RemoveMojo.java
index 2d75fa16..f2c05903 100644
--- a/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/RemoveMojo.java
+++ b/hawkeye-maven-plugin/src/main/java/io/korandoru/hawkeye/maven/plugin/RemoveMojo.java
@@ -17,7 +17,6 @@
package io.korandoru.hawkeye.maven.plugin;
import io.korandoru.hawkeye.core.LicenseRemover;
-import io.korandoru.hawkeye.core.config.HawkEyeConfig;
import io.korandoru.hawkeye.core.report.Report;
import io.korandoru.hawkeye.core.report.ReportConstants;
import java.util.List;
@@ -25,39 +24,33 @@
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Mojo;
-@Mojo(name = "remove")
+@Mojo(name = "remove", aggregator = true)
public class RemoveMojo extends AbstractMojo {
@Override
public void execute() {
final Log log = getLog();
- log.info("Removing license headers... with cfg: %s, dryRun: %s".formatted(config, dryRun));
+ log.info("Removing license headers... with config: %s, dryRun: %s".formatted(configLocation, dryRun));
- final HawkEyeConfig heConfig = HawkEyeConfig.of(config).dryRun(dryRun).build();
- final LicenseRemover remover = new LicenseRemover(heConfig);
+ final LicenseRemover remover = new LicenseRemover(configBuilder().build());
final Report report = remover.call();
final List unknownHeaderFiles = report.getResults().entrySet().stream()
.filter(e -> ReportConstants.RESULT_UNKNOWN.equals(e.getValue()))
.map(Map.Entry::getKey)
.toList();
-
- for (String unknownHeaderFile : unknownHeaderFiles) {
- log.warn("Processing unknown file: %s".formatted(unknownHeaderFile));
- }
-
final List removedHeaderFiles = report.getResults().entrySet().stream()
.filter(e -> ReportConstants.RESULT_REMOVED.equals(e.getValue()))
.map(Map.Entry::getKey)
.toList();
+ if (!unknownHeaderFiles.isEmpty()) {
+ log.warn("Processing unknown files: %s".formatted(unknownHeaderFiles));
+ }
+
if (removedHeaderFiles.isEmpty()) {
log.info("No file has been removed header.");
- return;
- }
- if (!dryRun) {
- for (String removedHeaderFile : removedHeaderFiles) {
- log.info("Removed header for file: %s".formatted(removedHeaderFile));
- }
+ } else if (!dryRun) {
+ log.info("Removed header for files: %s".formatted(removedHeaderFiles));
}
}
}
diff --git a/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/CheckMojoTest.java b/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/CheckMojoTest.java
index 6d7d2995..3aee9046 100644
--- a/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/CheckMojoTest.java
+++ b/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/CheckMojoTest.java
@@ -16,34 +16,39 @@
package io.korandoru.hawkeye.maven.plugin;
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import org.apache.maven.plugin.MojoFailureException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
class CheckMojoTest {
private CheckMojo checkMojo;
+ @TempDir
+ private Path tempDir;
+
@BeforeEach
void setUp() {
checkMojo = new CheckMojo();
- checkMojo.config = new File("src/test/resources/t1.toml");
+ checkMojo.basedir = tempDir.toFile();
+ checkMojo.configLocation = new File("src/test/resources/t1.toml");
}
@Test
- void execute() {
- assertDoesNotThrow(() -> checkMojo.execute());
+ void execute() throws Exception {
+ checkMojo.execute();
}
@Test
void executeFailure() throws IOException {
- final File tempFile = File.createTempFile("test", ".yaml", new File("src/test/resources"));
- assertTrue(tempFile.setWritable(true));
- assertThrows(MojoFailureException.class, () -> checkMojo.execute(), "Missing header files found");
+ final File tempFile = File.createTempFile("test", ".yaml", tempDir.toFile());
tempFile.deleteOnExit();
+ assertThatThrownBy(() -> checkMojo.execute())
+ .isExactlyInstanceOf(MojoFailureException.class)
+ .hasMessage("Found missing header files.");
}
}
diff --git a/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/FormatMojoTest.java b/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/FormatMojoTest.java
index f2607e5c..9b59916f 100644
--- a/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/FormatMojoTest.java
+++ b/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/FormatMojoTest.java
@@ -16,36 +16,35 @@
package io.korandoru.hawkeye.maven.plugin;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-import org.junit.jupiter.api.AfterEach;
+import java.nio.file.Path;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
class FormatMojoTest {
private FormatMojo formatMojo;
private File tempFile;
+ @TempDir
+ private Path tempDir;
+
@BeforeEach
void setUp() throws IOException {
- tempFile = File.createTempFile("test", ".yaml", new File("src/test/resources"));
- assertTrue(tempFile.setWritable(true));
+ tempFile = File.createTempFile("test", ".yaml", tempDir.toFile());
formatMojo = new FormatMojo();
- formatMojo.config = new File("src/test/resources/t1.toml");
- }
-
- @AfterEach
- void tearDown() {
- assertTrue(tempFile.delete());
+ formatMojo.basedir = tempDir.toFile();
+ formatMojo.configLocation = new File("src/test/resources/t1.toml");
}
@Test
void executeWithoutDryRun() throws IOException {
formatMojo.execute();
final String content = new String(Files.readAllBytes(tempFile.toPath()));
- assertTrue(content.contains("Korandoru Contributors"));
+ assertThat(content).contains("Korandoru Contributors");
}
@Test
@@ -54,7 +53,6 @@ void executeWithDryRun() {
formatMojo.execute();
final File formatedfile = new File(tempFile.getAbsolutePath() + ".formatted");
- assertTrue(formatedfile.exists());
- formatedfile.deleteOnExit();
+ assertThat(formatedfile).exists();
}
}
diff --git a/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/RemoveMojoTest.java b/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/RemoveMojoTest.java
index cf4ae12e..01c078ed 100644
--- a/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/RemoveMojoTest.java
+++ b/hawkeye-maven-plugin/src/test/java/io/korandoru/hawkeye/maven/plugin/RemoveMojoTest.java
@@ -16,30 +16,26 @@
package io.korandoru.hawkeye.maven.plugin;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
class RemoveMojoTest {
private RemoveMojo removeMojo;
private File tempFile;
+ @TempDir
+ private Path tempDir;
+
@BeforeEach
void setUp() throws IOException {
- final File testDir = new File("src/test/resources/test_remove");
- if (!testDir.exists()) {
- assertTrue(testDir.mkdirs());
- }
- testDir.deleteOnExit();
- tempFile = File.createTempFile("test", ".yaml", testDir);
- assertTrue(tempFile.setWritable(true));
+ tempFile = File.createTempFile("test", ".yaml", tempDir.toFile());
final String header =
"""
@@ -55,19 +51,16 @@ void setUp() throws IOException {
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
- # limitations under the License.""";
+ # limitations under the License.
- final Path path = Paths.get(tempFile.getAbsolutePath());
+ name: testfile""";
+ final Path path = Paths.get(tempFile.getAbsolutePath());
Files.write(path, header.getBytes());
removeMojo = new RemoveMojo();
- removeMojo.config = new File("src/test/resources/t2.toml");
- }
-
- @AfterEach
- void tearDown() {
- assertTrue(tempFile.delete());
+ removeMojo.basedir = tempDir.toFile();
+ removeMojo.configLocation = new File("src/test/resources/t2.toml");
}
@Test
@@ -75,7 +68,8 @@ void executeWithoutDryRun() throws IOException {
removeMojo.execute();
final String content = new String(Files.readAllBytes(tempFile.toPath()));
- assertFalse(content.contains("Korandoru Contributors"));
+ assertThat(content).doesNotContain("Korandoru Contributors");
+ assertThat(content).contains("testfile");
}
@Test
@@ -84,7 +78,6 @@ void executeWithDryRun() {
removeMojo.execute();
final File formatedfile = new File(tempFile.getAbsolutePath() + ".removed");
- assertTrue(formatedfile.exists());
- formatedfile.deleteOnExit();
+ assertThat(formatedfile).exists();
}
}
diff --git a/hawkeye-maven-plugin/src/test/resources/t1.toml b/hawkeye-maven-plugin/src/test/resources/t1.toml
index 5142a813..b687a12c 100644
--- a/hawkeye-maven-plugin/src/test/resources/t1.toml
+++ b/hawkeye-maven-plugin/src/test/resources/t1.toml
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-baseDir = "."
-
headerPath = "Apache-2.0.txt"
excludes = [
diff --git a/hawkeye-maven-plugin/src/test/resources/t2.toml b/hawkeye-maven-plugin/src/test/resources/t2.toml
index 63c1dfde..37ed46e2 100644
--- a/hawkeye-maven-plugin/src/test/resources/t2.toml
+++ b/hawkeye-maven-plugin/src/test/resources/t2.toml
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-baseDir = "src/test/resources/test_remove"
-
headerPath = "Apache-2.0.txt"
excludes = [
diff --git a/pom.xml b/pom.xml
index 3b84123d..8b0c73c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,9 +79,8 @@
1.7.36
- 3.9.4
- 3.9.0
- 3.9.0
+ 3.9.4
+ 3.9.0
3.3.0