protected function pdepend($path)
    {
        $jsonGenerator = new JsonGenerator();
        $jsonGenerator->setLogFile($path.DIRECTORY_SEPARATOR.$this->json);

        $application = new Application();

        // overwrite default config to ensure that cache files are stored in
        // different folders per build
        $config = $application->getConfiguration();
        $config->cache->driver = 'file';
        $config->cache->location = $path.DIRECTORY_SEPARATOR.$this->pdepend;

        $engine = $application->getEngine();
        $engine->addReportGenerator($jsonGenerator);

        $engine->addDirectory($this->config['path']);

        // exclude directories are evaluated relative to where pdepend is being
        // run from, not what it is running on
        $converter = new PathConverter($this->config['path'], getcwd());
        $exclude = array_map(array($converter, 'convert'), $this->config['exclude_folders']);
        $filter = new ExcludePathFilter($exclude);
        $engine->addFileFilter($filter);

        try {
            $engine->analyze();
        } catch (\Exception $e) {
            throw new Exception('Unable to generate pdepend metrics.');
        }
    }