summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/expected/java/maven-multimodules/v1.0.json94
-rw-r--r--spec/fixtures/expected/java/maven-multimodules/v1.1.json157
-rw-r--r--spec/fixtures/expected/java/maven-multimodules/v2.0.json58
-rw-r--r--spec/fixtures/maven-multimodule/api/pom.xml26
-rw-r--r--spec/fixtures/maven-multimodule/model/pom.xml27
-rw-r--r--spec/fixtures/maven-multimodule/pom.xml27
-rw-r--r--spec/fixtures/maven-multimodule/web/pom.xml27
-rw-r--r--spec/integration/java/maven_spec.rb37
-rw-r--r--spec/support/integration_test_helper.rb4
-rw-r--r--spec/support/shared.rb2
10 files changed, 456 insertions, 3 deletions
diff --git a/spec/fixtures/expected/java/maven-multimodules/v1.0.json b/spec/fixtures/expected/java/maven-multimodules/v1.0.json
new file mode 100644
index 0000000..ac9f480
--- /dev/null
+++ b/spec/fixtures/expected/java/maven-multimodules/v1.0.json
@@ -0,0 +1,94 @@
+{
+ "licenses": [
+ { "count": 15, "name": "Apache 2.0" },
+ { "count": 4, "name": "BSD" },
+ { "count": 1, "name": "MPL 1.1, GNU Lesser General Public License version 2.1, Apache 2.0" },
+ { "count": 1, "name": "unknown" }
+ ],
+ "dependencies": [
+ {
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "asm", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "asm-commons", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "asm-tree", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "commons-fileupload", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "commons-io", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "commons-lang3", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "freemarker", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-annotations", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-core", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-databind", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-dataformat-xml", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-module-jaxb-annotations", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "MPL 1.1, GNU Lesser General Public License version 2.1, Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "javassist", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "log4j-api", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "log4j-api", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "log4j-core", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "unknown" },
+ "dependency": { "name": "model", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "netty-all", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "ognl", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "stax2-api", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "struts2-core", "description": "", "pathes": [ "." ] }
+ }
+ ]
+}
diff --git a/spec/fixtures/expected/java/maven-multimodules/v1.1.json b/spec/fixtures/expected/java/maven-multimodules/v1.1.json
new file mode 100644
index 0000000..a8e2841
--- /dev/null
+++ b/spec/fixtures/expected/java/maven-multimodules/v1.1.json
@@ -0,0 +1,157 @@
+{
+ "version": "1.1",
+ "licenses": [
+ { "count": 15, "name": "Apache 2.0" },
+ { "count": 4, "name": "BSD" },
+ { "count": 1, "name": "MPL 1.1, GNU Lesser General Public License version 2.1, Apache 2.0" },
+ { "count": 1, "name": "unknown" }
+ ],
+ "dependencies": [
+ {
+ "licenses": [
+ { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" }
+ ],
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "asm", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [ { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" } ],
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "asm-commons", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [ { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" } ],
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "asm-tree", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "commons-fileupload", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "commons-io", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "commons-lang3", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "freemarker", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-annotations", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-core", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-databind", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-dataformat-xml", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "jackson-module-jaxb-annotations", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ { "name": "GNU Lesser General Public License version 2.1", "url": "https://opensource.org/licenses/LGPL-2.1" },
+ { "name": "MPL 1.1", "url": "" }
+ ],
+ "license": { "name": "MPL 1.1, GNU Lesser General Public License version 2.1, Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "javassist", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "log4j-api", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "log4j-api", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "log4j-core", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "unknown", "url": "" }
+ ],
+ "license": { "name": "unknown" },
+ "dependency": { "name": "model", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ {
+ "name": "Apache 2.0",
+ "url": "http://www.apache.org/licenses/LICENSE-2.0.txt"
+ }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "netty-all", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "ognl", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" }
+ ],
+ "license": { "name": "BSD", "url": "http://en.wikipedia.org/wiki/BSD_licenses#4-clause_license_.28original_.22BSD_License.22.29" },
+ "dependency": { "name": "stax2-api", "description": "", "pathes": [ "." ] }
+ },
+ {
+ "licenses": [
+ { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" }
+ ],
+ "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" },
+ "dependency": { "name": "struts2-core", "description": "", "pathes": [ "." ] }
+ }
+ ]
+}
diff --git a/spec/fixtures/expected/java/maven-multimodules/v2.0.json b/spec/fixtures/expected/java/maven-multimodules/v2.0.json
new file mode 100644
index 0000000..aa08ef9
--- /dev/null
+++ b/spec/fixtures/expected/java/maven-multimodules/v2.0.json
@@ -0,0 +1,58 @@
+{
+ "version": "2.0",
+ "licenses": [
+ {
+ "id": "Apache-2.0",
+ "name": "Apache License 2.0",
+ "url": "https://opensource.org/licenses/Apache-2.0",
+ "count": 16
+ },
+ {
+ "id": "BSD-4-Clause",
+ "name": "BSD 4-Clause \"Original\" or \"Old\" License",
+ "url": "http://directory.fsf.org/wiki/License:BSD_4Clause",
+ "count": 4
+ },
+ {
+ "id": "LGPL-2.1",
+ "name": "GNU Lesser General Public License v2.1 only",
+ "url": "https://opensource.org/licenses/LGPL-2.1",
+ "count": 1
+ },
+ {
+ "id": "MPL-1.1",
+ "name": "Mozilla Public License 1.1",
+ "url": "https://opensource.org/licenses/MPL-1.1",
+ "count": 1
+ },
+ {
+ "id": "unknown",
+ "name": "unknown",
+ "url": "",
+ "count": 1
+ }
+ ],
+ "dependencies": [
+ { "name": "asm", "url": "", "description": "", "paths": [ "." ], "licenses": [ "BSD-4-Clause" ] },
+ { "name": "asm-commons", "url": "", "description": "", "paths": [ "." ], "licenses": [ "BSD-4-Clause" ] },
+ { "name": "asm-tree", "url": "", "description": "", "paths": [ "." ], "licenses": [ "BSD-4-Clause" ] },
+ { "name": "commons-fileupload", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "commons-io", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "commons-lang3", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "freemarker", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "jackson-annotations", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "jackson-core", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "jackson-databind", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "jackson-dataformat-xml", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "jackson-module-jaxb-annotations", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "javassist", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0", "LGPL-2.1", "MPL-1.1" ] },
+ { "name": "log4j-api", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "log4j-api", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "log4j-core", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "model", "url": "", "description": "", "paths": [ "." ], "licenses": [ "unknown" ] },
+ { "name": "netty-all", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "ognl", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] },
+ { "name": "stax2-api", "url": "", "description": "", "paths": [ "." ], "licenses": [ "BSD-4-Clause" ] },
+ { "name": "struts2-core", "url": "", "description": "", "paths": [ "." ], "licenses": [ "Apache-2.0" ] }
+ ]
+}
diff --git a/spec/fixtures/maven-multimodule/api/pom.xml b/spec/fixtures/maven-multimodule/api/pom.xml
new file mode 100644
index 0000000..c621c1a
--- /dev/null
+++ b/spec/fixtures/maven-multimodule/api/pom.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>java-maven-multi-modules</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>api</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-core</artifactId>
+ <version>2.5.1</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/spec/fixtures/maven-multimodule/model/pom.xml b/spec/fixtures/maven-multimodule/model/pom.xml
new file mode 100644
index 0000000..91b366b
--- /dev/null
+++ b/spec/fixtures/maven-multimodule/model/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>java-maven-multi-modules</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>model</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>model</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <maven.compiler.source>1.6</maven.compiler.source>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.8.2</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/spec/fixtures/maven-multimodule/pom.xml b/spec/fixtures/maven-multimodule/pom.xml
new file mode 100644
index 0000000..e84ad4a
--- /dev/null
+++ b/spec/fixtures/maven-multimodule/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>java-maven-multi-modules</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>java-maven-multi-modules</name>
+ <modules>
+ <module>api</module>
+ <module>model</module>
+ <module>web</module>
+ </modules>
+ <dependencies>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ <version>4.1.0.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/spec/fixtures/maven-multimodule/web/pom.xml b/spec/fixtures/maven-multimodule/web/pom.xml
new file mode 100644
index 0000000..548e9fb
--- /dev/null
+++ b/spec/fixtures/maven-multimodule/web/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>java-maven-multi-modules</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>com.gitlab.security_products.tests</groupId>
+ <artifactId>web</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>web</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <maven.compiler.source>1.6</maven.compiler.source>
+ <maven.compiler.target>1.6</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>2.7.3</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/spec/integration/java/maven_spec.rb b/spec/integration/java/maven_spec.rb
index dbcfa5e..ad4cf5e 100644
--- a/spec/integration/java/maven_spec.rb
+++ b/spec/integration/java/maven_spec.rb
@@ -2,12 +2,15 @@ require 'spec_helper'
RSpec.describe "maven" do
include_examples "each report version", "java", "maven"
+ include_examples "each report version", "java", "maven-multimodules"
describe "When the maven dependencies come from a custom public maven repository" do
it 'is able to detect some of the licenses' do
runner.add_file('pom.xml', fixture_file_content('pom-public-gitlab-repository.xml'))
- report = runner.scan(env: { 'CI_PROJECT_ID' => '17523603' })
+ report = runner.scan(env: {
+ 'CI_PROJECT_ID' => '17523603'
+ })
expect(report).to match_schema(version: '2.0')
expect(report[:dependencies]).to match_array([{ name: 'mvn-spike', url: '', description: '', paths: ['.'], licenses: ['MIT'] }])
@@ -18,7 +21,6 @@ RSpec.describe "maven" do
runner.add_file('my_settings.xml', fixture_file_content('custom-maven-settings.xml'))
report = runner.scan(env: {
- 'CI_DEBUG_TRACE' => 'true',
'CI_PROJECT_ID' => 'invalid',
'MAVEN_CLI_OPTS' => "--settings my_settings.xml"
})
@@ -45,4 +47,35 @@ RSpec.describe "maven" do
expect(report).to match_schema(version: '2.0')
end
end
+
+ describe "When scanning a project with multiple modules" do
+ before do
+ runner.mount(dir: fixture_file('maven-multimodule'))
+ end
+
+ it 'detects dependences from each module' do
+ report = runner.scan
+
+ expect(report).to match_schema(version: '2.0')
+ expect(report[:dependencies]).not_to be_empty
+
+ [
+ { name: "asm", licenses: ["BSD-4-Clause"] },
+ { name: "asm-commons", licenses: ["BSD-4-Clause"] },
+ { name: "jackson-annotations", licenses: ["Apache-2.0"] },
+ { name: "jackson-core", licenses: ["Apache-2.0"] },
+ { name: "jackson-databind", licenses: ["Apache-2.0"] },
+ { name: "jackson-dataformat-xml", licenses: ["Apache-2.0"] },
+ { name: "jackson-module-jaxb-annotations", licenses: ["Apache-2.0"] },
+ { name: "log4j-api", licenses: ["Apache-2.0"] },
+ { name: "log4j-core", licenses: ["Apache-2.0"] },
+ { name: "netty-all", licenses: ["Apache-2.0"] },
+ { name: "stax2-api", licenses: ["BSD-4-Clause"] }
+ ].each do |dependency|
+ expect(find_in(report, dependency[:name])[:licenses]).to match_array(dependency[:licenses])
+ end
+
+ expect(report[:dependencies].map { |x| x[:name] }).not_to include('junit')
+ end
+ end
end
diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb
index 9ecc8aa..25e670f 100644
--- a/spec/support/integration_test_helper.rb
+++ b/spec/support/integration_test_helper.rb
@@ -13,6 +13,10 @@ module IntegrationTestHelper
IO.write(full_path, block_given? ? yield : content)
end
+ def mount(dir:)
+ FileUtils.cp_r("#{dir}/.", project_path)
+ end
+
def clone(repo, branch: 'master')
execute({}, "git", "clone", repo, project_path)
Dir.chdir project_path do
diff --git a/spec/support/shared.rb b/spec/support/shared.rb
index 049191e..ba3d3cc 100644
--- a/spec/support/shared.rb
+++ b/spec/support/shared.rb
@@ -1,6 +1,6 @@
RSpec.shared_examples "each report version" do |language, package_manager, branch = 'master'|
['1.0', '1.1', '2.0'].each do |version|
- context "when generating a `#{version}` report" do
+ context "when generating a `#{version}` report for #{package_manager}" do
let(:url) { "https://gitlab.com/gitlab-org/security-products/tests/#{language}-#{package_manager}.git" }
let(:expected_content) { JSON.parse(fixture_file_content("expected/#{language}/#{package_manager}/v#{version}.json")) }