[NO ISSUE][HYR][LIC] Enable license automation plugin to skip license/notice file content

Ext-ref: MB-64542
Change-Id: Id51ed3c059795c377151fcbc45af1fea026435c9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19244
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
index 5c11106..0b95429 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
@@ -284,6 +284,9 @@
     }
 
     private void rebuildLicenseContentProjectMap() throws IOException {
+        if (skipLicenses) {
+            return;
+        }
         int counter = 0;
         Map<String, LicensedProjects> licenseMap2 = new TreeMap<>(WHITESPACE_NORMALIZED_COMPARATOR);
         for (LicensedProjects lps : licenseMap.values()) {
@@ -333,6 +336,9 @@
 
     private void buildNoticeProjectMap() throws IOException {
         noticeMap = new TreeMap<>(WHITESPACE_NORMALIZED_COMPARATOR);
+        if (skipNotices) {
+            return;
+        }
         for (Project p : getProjects()) {
             String noticeText = p.getNoticeText();
             if (noticeText == null && noticeOverrides.containsKey(p.gav())) {
@@ -374,11 +380,15 @@
     }
 
     private void resolveNoticeFiles() throws MojoExecutionException, IOException {
-        resolveArtifactFiles(NOTICE);
+        if (!skipNotices) {
+            resolveArtifactFiles(NOTICE);
+        }
     }
 
     private void resolveLicenseFiles() throws MojoExecutionException, IOException {
-        resolveArtifactFiles(LICENSE);
+        if (!skipLicenses) {
+            resolveArtifactFiles(LICENSE);
+        }
     }
 
     private void resolveArtifactFiles(final EmbeddedArtifact artifact) throws MojoExecutionException, IOException {
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
index 3b5fde6..5e91807 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
@@ -131,6 +131,12 @@
     @Parameter
     protected List<String> extraDependencies = new ArrayList<>();
 
+    @Parameter
+    protected boolean skipLicenses;
+
+    @Parameter
+    protected boolean skipNotices;
+
     private Map<String, MavenProject> projectCache = new HashMap<>();
 
     private Map<String, Model> supplementModels;
@@ -274,8 +280,18 @@
 
     private void addDependencyToLicenseMap(MavenProject depProject, List<Pair<String, String>> depLicenses,
             String depLocation) {
+        LicenseSpec spec = extractLicenseSpec(depProject, depLicenses, depLocation);
+        addProject(new Project(depProject, depLocation, depProject.getArtifact().getFile(),
+                Boolean.parseBoolean(String.valueOf(depProject.getContextValue(SHADOWED_KEY)))), spec, true);
+    }
+
+    private LicenseSpec extractLicenseSpec(MavenProject depProject, List<Pair<String, String>> depLicenses,
+            String depLocation) {
         final String depGav = toGav(depProject);
         getLog().debug("adding " + depGav + ", location: " + depLocation);
+        if (skipLicenses) {
+            return new LicenseSpec("DUMMY LICENSE", "DUMMY LICENSE");
+        }
         final MutableBoolean usedMetric = new MutableBoolean(false);
         if (depLicenses.size() > 1) {
             Collections.sort(depLicenses, (o1, o2) -> {
@@ -311,10 +327,7 @@
                 licenseUrl = fakeLicenseUrl;
             }
         }
-        addProject(
-                new Project(depProject, depLocation, depProject.getArtifact().getFile(),
-                        Boolean.parseBoolean(String.valueOf(depProject.getContextValue(SHADOWED_KEY)))),
-                new LicenseSpec(licenseUrl, displayName), true);
+        return new LicenseSpec(licenseUrl, displayName);
     }
 
     protected void addProject(Project project, LicenseSpec spec, boolean additive) {