snyk-mvn-plugin
Advanced tools
Comparing version 2.4.0 to 2.5.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const parse_mvn_1 = require("./parse-mvn"); | ||
@@ -8,26 +9,28 @@ const fs = require("fs"); | ||
function inspect(root, targetFile, options) { | ||
if (!options) { | ||
options = { dev: false }; | ||
} | ||
const mvnArgs = buildArgs(root, targetFile, options.args); | ||
return subProcess.execute('mvn', mvnArgs, { cwd: root }) | ||
.then((result) => { | ||
const parseResult = parse_mvn_1.parseTree(result, options.dev); | ||
return { | ||
plugin: { | ||
name: 'bundled:maven', | ||
runtime: 'unknown', | ||
}, | ||
package: parseResult.data, | ||
}; | ||
}) | ||
.catch((error) => { | ||
error.message = error.message + '\n\n' + | ||
'Please make sure that Apache Maven Dependency Plugin ' + | ||
'version 2.2 or above is installed, and that ' + | ||
'`mvn ' + mvnArgs.join(' ') + '` executes successfully ' + | ||
'on this project.\n\n' + | ||
'If the problem persists, collect the output of ' + | ||
'`mvn ' + mvnArgs.join(' ') + '` and contact support@snyk.io\n'; | ||
throw error; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
if (!options) { | ||
options = { dev: false }; | ||
} | ||
const mvnArgs = buildArgs(root, targetFile, options.args); | ||
try { | ||
const result = yield subProcess.execute('mvn', mvnArgs, { cwd: root }); | ||
const parseResult = parse_mvn_1.parseTree(result, options.dev); | ||
return { | ||
plugin: { | ||
name: 'bundled:maven', | ||
runtime: 'unknown', | ||
}, | ||
package: parseResult.data, | ||
}; | ||
} | ||
catch (error) { | ||
error.message = error.message + '\n\n' + | ||
'Please make sure that Apache Maven Dependency Plugin ' + | ||
'version 2.2 or above is installed, and that ' + | ||
'`mvn ' + mvnArgs.join(' ') + '` executes successfully ' + | ||
'on this project.\n\n' + | ||
'If the problem persists, collect the output of ' + | ||
'`mvn ' + mvnArgs.join(' ') + '` and contact support@snyk.io\n'; | ||
throw error; | ||
} | ||
}); | ||
@@ -34,0 +37,0 @@ } |
@@ -32,3 +32,3 @@ "use strict"; | ||
}; | ||
const root = Object.assign({}, defaultRoot, rootProject); | ||
const root = Object.assign(Object.assign({}, defaultRoot), rootProject); | ||
// Add any subsequent projects to the root as dependencies | ||
@@ -60,3 +60,3 @@ for (let i = 1; i < projects.length; i++) { | ||
const sourcePackage = createPackage(source); | ||
if (sourcePackage.scope === 'test' && !withDev) { | ||
if (sourcePackage.labels && sourcePackage.labels.scope === 'test' && !withDev) { | ||
// skip a test dependency if it's not asked for | ||
@@ -70,3 +70,3 @@ return null; | ||
const pkg = assemblePackage(dep, projectDeps, withDev); | ||
if (pkg) { | ||
if (pkg && pkg.name) { | ||
sourcePackage.dependencies[pkg.name] = pkg; | ||
@@ -90,9 +90,7 @@ } | ||
if (parts.length >= 5) { | ||
result.scope = parts[parts.length - 1]; | ||
result.labels = { | ||
scope: parts[parts.length - 1], | ||
}; | ||
result.version = parts[parts.length - 2]; | ||
} | ||
// TODO: This is likely obsolete, remove | ||
if (range) { | ||
result.dep = range; | ||
} | ||
return result; | ||
@@ -99,0 +97,0 @@ } |
@@ -36,6 +36,7 @@ { | ||
"dependencies": { | ||
"@snyk/cli-interface": "2.2.0", | ||
"lodash": "^4.17.15", | ||
"tslib": "1.9.3" | ||
}, | ||
"version": "2.4.0" | ||
"version": "2.5.0" | ||
} |
![Snyk logo](https://snyk.io/style/asset/logo/snyk-print.svg) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/snyk/snyk-mvn-plugin/badge.svg?targetFile=package.json)](https://snyk.io/test/github/snyk/snyk-mvn-plugin?targetFile=package.json) | ||
*** | ||
@@ -7,4 +12,10 @@ | ||
| :information_source: This repository is only a plugin to be used with the Snyk CLI tool. To use this plugin to test and fix vulnerabilities in your project, install the Snyk CLI tool first. Head over to [snyk.io](https://github.com/snyk/snyk) to get started. | | ||
| --- | | ||
## Snyk Maven CLI Plugin | ||
This plugin provides dependency metadata for Maven projects that use `mvn` and have a `pom.xml` file. | ||
This plugin provides dependency metadata for Maven projects that use mvn and have a pom.xml file. It is an internal component intended for use by our [CLI tool](https://github.com/snyk/snyk). | ||
If you are looking to add tasks to your Maven build process you should use our [Maven Plugin](https://github.com/snyk/snyk-maven-plugin). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16406
206
21
3
+ Added@snyk/cli-interface@2.2.0
+ Added@snyk/cli-interface@2.2.0(transitive)