diff --git a/licensescout-core/src/test/java/org/aposin/licensescout/execution/SimpleExecutionTest.java b/licensescout-core/src/test/java/org/aposin/licensescout/execution/SimpleExecutionTest.java index 35cd9a7b..ff2c9365 100644 --- a/licensescout-core/src/test/java/org/aposin/licensescout/execution/SimpleExecutionTest.java +++ b/licensescout-core/src/test/java/org/aposin/licensescout/execution/SimpleExecutionTest.java @@ -72,10 +72,10 @@ public void testExecutionJavaWithOutputsScanDirectory() throws Exception { @Test public void testExecutionJavaWithOutputsScanFiles() throws Exception { final File scanDirectory = new File("src/test/resources/scans/empty"); + final ScanLocation scanLocation = new ScanLocation(Arrays.asList(scanDirectory)); final ArrayList outputs = createTripleOutput(); - final ExecutionParameters executionParameters = createExecutionParameters(ArchiveType.JAVA, scanDirectory, - outputs); - executionParameters.setScanLocation(new ScanLocation(Arrays.asList(scanDirectory))); + final ExecutionParameters executionParameters = createExecutionParameters(ArchiveType.JAVA, scanLocation, + outputs, true); assertExecution(executionParameters); } @@ -226,8 +226,9 @@ public void testExecutionJavaWriteToDatabaseNoDatabaseConfiguredSnapshotVersionW @Test(expected = LicenseScoutExecutionException.class) public void testExecutionJavaNoReportExporterFactory() throws Exception { final File scanDirectory = new File("src/test/resources/scans/java-unpacked-license-manifest"); + final ScanLocation scanLocation = new ScanLocation(scanDirectory); final ArrayList outputs = createTripleOutput(); - final ExecutionParameters executionParameters = createExecutionParameters(ArchiveType.JAVA, scanDirectory, + final ExecutionParameters executionParameters = createExecutionParameters(ArchiveType.JAVA, scanLocation, outputs, false); assertExecution(executionParameters); } @@ -265,11 +266,8 @@ public void testExecutionJavaNotExistingScanDirectory() throws Exception { */ @Test(expected = LicenseScoutExecutionException.class) public void testExecutionJavaNoScanLocation() throws Exception { - // TODO: clean up - final File scanDirectory = new File("not_existing"); final ExecutionParameters executionParameters = createExecutionParametersNoOutputs(ArchiveType.JAVA, - scanDirectory); - executionParameters.setScanLocation(null); + (ScanLocation) null); assertExecution(executionParameters); } @@ -341,25 +339,33 @@ private ExecutionParameters createExecutionParametersNoOutputs(final ArchiveType return createExecutionParameters(archiveType, scanDirectory, outputs); } + private ExecutionParameters createExecutionParametersNoOutputs(final ArchiveType archiveType, + final ScanLocation scanLocation) { + final ArrayList outputs = new ArrayList<>(); + return createExecutionParameters(archiveType, scanLocation, outputs, true); + } + private ExecutionParameters createExecutionParameters(final ArchiveType archiveType, final File scanDirectory, final ArrayList outputs) { - return createExecutionParameters(archiveType, scanDirectory, outputs, true); + final ScanLocation scanLocation = new ScanLocation(scanDirectory); + return createExecutionParameters(archiveType, scanLocation, outputs, true); } /** * @param archiveType - * @param scanDirectory + * @param scanLocation the scan location * @param outputs * @param withStandardReportExporterFactory - * @return an execution parameters instance + * @return */ - private ExecutionParameters createExecutionParameters(final ArchiveType archiveType, final File scanDirectory, + private ExecutionParameters createExecutionParameters(final ArchiveType archiveType, + final ScanLocation scanLocation, final ArrayList outputs, final boolean withStandardReportExporterFactory) { final ExecutionParameters executionParameters = new ExecutionParameters(); executionParameters.setArchiveType(archiveType); executionParameters.setFilteredVendorNames(new ArrayList<>()); - executionParameters.setScanLocation(new ScanLocation(scanDirectory)); + executionParameters.setScanLocation(scanLocation); executionParameters.setOutputDirectory(new File("target")); executionParameters.setOutputs(outputs); executionParameters.setCleanOutputActive(false); diff --git a/licensescout-documentation/src/site/asciidoc/usermanual/configuration.adoc b/licensescout-documentation/src/site/asciidoc/usermanual/configuration.adoc index de673a8b..54b0c276 100644 --- a/licensescout-documentation/src/site/asciidoc/usermanual/configuration.adoc +++ b/licensescout-documentation/src/site/asciidoc/usermanual/configuration.adoc @@ -84,7 +84,12 @@ In one execution, LicenseScout can either scan for Java artifacts or for Javascr === Scan Location -The base directory where archives are searched for (recursively and also inside JARs) is configured by the parameter `scanDirectory`. +The location to b scanned can either be: + +* a base directory where archives are searched for (recursively and also inside JARs). This is configured by the parameter `scanDirectory`. +* a list of Maven artifacts. The configured artifacts and their (transitive) dependencies are scanned. This is configured by the parameter `scanArtifacts`. +The parameter `scanArtifactScope` optionally allows to specify the +scope for dependency resolution. [[output-types-and-files]] === Output types and files diff --git a/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-artifact/pom.xml b/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-artifact/pom.xml new file mode 100644 index 00000000..5fa11c00 --- /dev/null +++ b/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-artifact/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + org.aposin.licensescout.test + org.aposin.licensescout.test.licensescout + 1.0.0-SNAPSHOT + pom + + Simple Test for License Scout Maven Plugin + + https://aposin.org/ + + + UTF-8 + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + + CSV + + + + @project.groupId@ + org.aposin.licensescout.configuration.sample + @project.version@ + configuration + zip + + + + + test + + scanJava + + + + + + + + diff --git a/licensescout-maven-plugin/src/it/java-csv-artifact-configuration/verify.groovy b/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-artifact/verify.groovy similarity index 100% rename from licensescout-maven-plugin/src/it/java-csv-artifact-configuration/verify.groovy rename to licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-artifact/verify.groovy diff --git a/licensescout-maven-plugin/src/it/java-csv-artifact-configuration/pom.xml b/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-directory/pom.xml similarity index 100% rename from licensescout-maven-plugin/src/it/java-csv-artifact-configuration/pom.xml rename to licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-directory/pom.xml diff --git a/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-directory/verify.groovy b/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-directory/verify.groovy new file mode 100644 index 00000000..953e96fe --- /dev/null +++ b/licensescout-maven-plugin/src/it/java-csv-artifact-configuration-scan-directory/verify.groovy @@ -0,0 +1,17 @@ +/** + * Copyright 2019 Association for the promotion of open-source insurance software and for the establishment of open interface standards in the insurance industry (Verein zur Förderung quelloffener Versicherungssoftware und Etablierung offener Schnittstellenstandards in der Versicherungsbranche) + * + * Licensed under the Apache License, Version 2.0 (the "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 + * + * Unless required by applicable law or agreed to in writing, software + * 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. + */ +File reportFile = new File( basedir, "target/licensescout/licensereport.csv" ); +assert reportFile.isFile(); diff --git a/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-artifact/pom.xml b/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-artifact/pom.xml new file mode 100644 index 00000000..97f23282 --- /dev/null +++ b/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-artifact/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.aposin.licensescout.test + org.aposin.licensescout.test.licensescout + 1.0.0-SNAPSHOT + pom + + Simple Test for License Scout Maven Plugin + + https://aposin.org/ + + + UTF-8 + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + + HTML + + + + @project.groupId@ + org.aposin.licensescout.configuration.sample + @project.version@ + configuration + zip + + + + + test + + scanJava + + + + + + + + diff --git a/licensescout-maven-plugin/src/it/java-html-artifact-configuration/verify.groovy b/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-artifact/verify.groovy similarity index 100% rename from licensescout-maven-plugin/src/it/java-html-artifact-configuration/verify.groovy rename to licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-artifact/verify.groovy diff --git a/licensescout-maven-plugin/src/it/java-html-artifact-configuration/pom.xml b/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-directory/pom.xml similarity index 100% rename from licensescout-maven-plugin/src/it/java-html-artifact-configuration/pom.xml rename to licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-directory/pom.xml diff --git a/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-directory/verify.groovy b/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-directory/verify.groovy new file mode 100644 index 00000000..4d39757e --- /dev/null +++ b/licensescout-maven-plugin/src/it/java-html-artifact-configuration-scan-directory/verify.groovy @@ -0,0 +1,17 @@ +/** + * Copyright 2019 Association for the promotion of open-source insurance software and for the establishment of open interface standards in the insurance industry (Verein zur Förderung quelloffener Versicherungssoftware und Etablierung offener Schnittstellenstandards in der Versicherungsbranche) + * + * Licensed under the Apache License, Version 2.0 (the "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 + * + * Unless required by applicable law or agreed to in writing, software + * 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. + */ +File reportFile = new File( basedir, "target/licensescout/licensereport.html" ); +assert reportFile.isFile(); diff --git a/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-artifacts/pom.xml b/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-artifacts/pom.xml new file mode 100644 index 00000000..5eb3f31b --- /dev/null +++ b/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-artifacts/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + org.aposin.licensescout.test + org.aposin.licensescout.test.licensescout + 1.0.0-SNAPSHOT + pom + + Simple Test for License Scout Maven Plugin + + https://aposin.org/ + + + UTF-8 + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + ${licensescout.outputDirectory} + + + TXT + + + + @project.groupId@ + org.aposin.licensescout.configuration.sample + @project.version@ + configuration + zip + + + + + test + + scanJava + + + + + + + + diff --git a/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-artifacts/verify.groovy b/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-artifacts/verify.groovy new file mode 100644 index 00000000..c45c969b --- /dev/null +++ b/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-artifacts/verify.groovy @@ -0,0 +1,17 @@ +/** + * Copyright 2019 Association for the promotion of open-source insurance software and for the establishment of open interface standards in the insurance industry (Verein zur Förderung quelloffener Versicherungssoftware und Etablierung offener Schnittstellenstandards in der Versicherungsbranche) + * + * Licensed under the Apache License, Version 2.0 (the "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 + * + * Unless required by applicable law or agreed to in writing, software + * 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. + */ +File reportFile = new File( basedir, "target/licensescout/licensereport.txt" ); +assert reportFile.isFile(); diff --git a/licensescout-maven-plugin/src/it/java-txt-artifact-configuration/pom.xml b/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-directory/pom.xml similarity index 100% rename from licensescout-maven-plugin/src/it/java-txt-artifact-configuration/pom.xml rename to licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-directory/pom.xml diff --git a/licensescout-maven-plugin/src/it/java-txt-artifact-configuration/verify.groovy b/licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-directory/verify.groovy similarity index 100% rename from licensescout-maven-plugin/src/it/java-txt-artifact-configuration/verify.groovy rename to licensescout-maven-plugin/src/it/java-txt-artifact-configuration-scan-directory/verify.groovy diff --git a/licensescout-report-maven-plugin/src/it/java-report/invoker.properties b/licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/invoker.properties similarity index 100% rename from licensescout-report-maven-plugin/src/it/java-report/invoker.properties rename to licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/invoker.properties diff --git a/licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/pom.xml b/licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/pom.xml new file mode 100644 index 00000000..9f0885c4 --- /dev/null +++ b/licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + org.aposin.licensescout.test + org.aposin.licensescout.test.licensescout + 1.0.0-SNAPSHOT + pom + + Simple Test for License Scout Report Maven Plugin + + https://aposin.org/ + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + org.apache.maven.plugins + maven-site-plugin + 3.8.2 + + + + + + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + @project.groupId@ + org.aposin.licensescout.configuration.sample + @project.version@ + configuration + zip + + + + + + + + diff --git a/licensescout-report-maven-plugin/src/it/java-report/verify.groovy b/licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/verify.groovy similarity index 100% rename from licensescout-report-maven-plugin/src/it/java-report/verify.groovy rename to licensescout-report-maven-plugin/src/it/java-report-scan-artifacts/verify.groovy diff --git a/licensescout-report-maven-plugin/src/it/java-report-scan-directory/invoker.properties b/licensescout-report-maven-plugin/src/it/java-report-scan-directory/invoker.properties new file mode 100644 index 00000000..8fb5154d --- /dev/null +++ b/licensescout-report-maven-plugin/src/it/java-report-scan-directory/invoker.properties @@ -0,0 +1,19 @@ +# +# Copyright 2019 Association for the promotion of open-source insurance software and for the establishment of open interface standards in the insurance industry (Verein zur Förderung quelloffener Versicherungssoftware und Etablierung offener Schnittstellenstandards in der Versicherungsbranche) +# +# Licensed under the Apache License, Version 2.0 (the "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 +# +# Unless required by applicable law or agreed to in writing, software +# 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. +# + +invoker.goals = clean site +invoker.java.version=11+ +invoker.profiles = diff --git a/licensescout-report-maven-plugin/src/it/java-report/pom.xml b/licensescout-report-maven-plugin/src/it/java-report-scan-directory/pom.xml similarity index 100% rename from licensescout-report-maven-plugin/src/it/java-report/pom.xml rename to licensescout-report-maven-plugin/src/it/java-report-scan-directory/pom.xml diff --git a/licensescout-report-maven-plugin/src/it/java-report-scan-directory/verify.groovy b/licensescout-report-maven-plugin/src/it/java-report-scan-directory/verify.groovy new file mode 100644 index 00000000..a489465f --- /dev/null +++ b/licensescout-report-maven-plugin/src/it/java-report-scan-directory/verify.groovy @@ -0,0 +1,17 @@ +/** + * Copyright 2019 Association for the promotion of open-source insurance software and for the establishment of open interface standards in the insurance industry (Verein zur Förderung quelloffener Versicherungssoftware und Etablierung offener Schnittstellenstandards in der Versicherungsbranche) + * + * Licensed under the Apache License, Version 2.0 (the "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 + * + * Unless required by applicable law or agreed to in writing, software + * 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. + */ +File reportFile = new File( basedir, "target/site/licensereport.html" ); +assert reportFile.isFile(); diff --git a/licensescout-report-maven-plugin/src/main/java/org/aposin/licensescout/report/mojo/AbstractReportMojo.java b/licensescout-report-maven-plugin/src/main/java/org/aposin/licensescout/report/mojo/AbstractReportMojo.java index f9b7e8d2..3097d42b 100644 --- a/licensescout-report-maven-plugin/src/main/java/org/aposin/licensescout/report/mojo/AbstractReportMojo.java +++ b/licensescout-report-maven-plugin/src/main/java/org/aposin/licensescout/report/mojo/AbstractReportMojo.java @@ -70,7 +70,7 @@ public abstract class AbstractReportMojo extends AbstractMavenReport implements * * @since 1.1 */ - @Parameter(property = "scanDirectory", required = true) + @Parameter(property = "scanDirectory", required = false) private File scanDirectory; /**