Added support for installed plugins in Maven scans.

This commit is contained in:
Šesták Vít
2017-12-20 15:06:12 +01:00
parent 5f9546934e
commit d57b9aeb97

View File

@@ -7,7 +7,7 @@ import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file._
import java.nio.file.attribute.BasicFileAttributes
import java.sql.{Array => _}
import java.util.{Properties, Map => JMap}
import java.util.{Properties, UUID, Map => JMap}
import _root_.org.apache.commons.lang3.SystemUtils
import _root_.org.owasp.dependencycheck.dependency.{VulnerableSoftware => OdcVulnerableSoftware}
@@ -69,6 +69,17 @@ class OdcService @Inject() (odcConfig: OdcConfig, odcDbConnectionConfig: OdcDbCo
</goals>
</execution>
</executions>
<dependencies>
{pluginFiles.map{x =>
<dependency>
<groupId>com.ysoft</groupId>
<artifactId>ad-hoc-artifact-{UUID.randomUUID().toString}</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>{x.toString}</systemPath>
</dependency>
}}
</dependencies>
</plugin>
</plugins>
</build>
@@ -192,6 +203,8 @@ class OdcService @Inject() (odcConfig: OdcConfig, odcDbConnectionConfig: OdcDbCo
Seq(odcBin, "--version").!!.trim.reverse.takeWhile(_!=' ').reverse
}
private def pluginFiles: Seq[File] = new File(new File(odcConfig.odcPath), "plugins").listFiles().toSeq
private def createHintfulOdcCommand(scandirPrefix: String, path: Path, reportFilename: String): Seq[String] = {
val newPropertyFile = s"${scandirPrefix}odc.properties"
createModifiedProps(newPropertyFile, Map("hints.file" -> s"${scandirPrefix}hints.xml"))