diff --git a/src/main/groovy/com/github/jk1/license/reader/ModuleReader.groovy b/src/main/groovy/com/github/jk1/license/reader/ModuleReader.groovy index 88b6867..0611fb2 100644 --- a/src/main/groovy/com/github/jk1/license/reader/ModuleReader.groovy +++ b/src/main/groovy/com/github/jk1/license/reader/ModuleReader.groovy @@ -69,7 +69,7 @@ class ModuleReaderImpl implements ModuleReader { extraPomResults.each { ResolvedArtifactResult artifact -> LOGGER.info("Processing artifact: $artifact ($artifact.file)") if (artifact.file.exists()) { - def pom = pomReader.readPomData(artifact) + def pom = pomReader.readPomData(project, artifact) if (pom) moduleData.poms << pom } else { LOGGER.info("Skipping artifact file $artifact.file as it does not exist") diff --git a/src/main/groovy/com/github/jk1/license/reader/PomReader.groovy b/src/main/groovy/com/github/jk1/license/reader/PomReader.groovy index 5e60359..f6cc30c 100644 --- a/src/main/groovy/com/github/jk1/license/reader/PomReader.groovy +++ b/src/main/groovy/com/github/jk1/license/reader/PomReader.groovy @@ -74,7 +74,8 @@ class PomReader { } } - PomData readPomData(ResolvedArtifactResult artifact) { + PomData readPomData(Project project, ResolvedArtifactResult artifact) { + resolver = new CachingArtifactResolver(project) GPathResult pomContent = findAndSlurpPom(artifact.file) return readPomFile(pomContent) } diff --git a/src/test/groovy/com/github/jk1/license/reader/PomDependencyResolutionFuncSpec.groovy b/src/test/groovy/com/github/jk1/license/reader/PomDependencyResolutionFuncSpec.groovy index d7539f9..a4daa2d 100644 --- a/src/test/groovy/com/github/jk1/license/reader/PomDependencyResolutionFuncSpec.groovy +++ b/src/test/groovy/com/github/jk1/license/reader/PomDependencyResolutionFuncSpec.groovy @@ -56,6 +56,7 @@ class PomDependencyResolutionFuncSpec extends AbstractGradleRunnerFunctionalSpec then: runResult.task(":generateLicenseReport").outcome == TaskOutcome.SUCCESS + // 2 licenses because it also resolves jackson-parent, which has its own license configurationsString == """[ { "dependencies": [ @@ -80,6 +81,10 @@ class PomDependencyResolutionFuncSpec extends AbstractGradleRunnerFunctionalSpec { "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", "name": "Apache License, Version 2.0" + }, + { + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt", + "name": "The Apache Software License, Version 2.0" } ] }