mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +01:00
added configuration for whether or not the nexus analyzer should use the configured proxy
Former-commit-id: 99f3110346941ebc00c14ae1c00220eef76c1e9f
This commit is contained in:
@@ -502,6 +502,28 @@ public class DependencyCheckTask extends Task {
|
||||
public void setNexusUrl(String nexusUrl) {
|
||||
this.nexusUrl = nexusUrl;
|
||||
}
|
||||
/**
|
||||
* Whether or not the defined proxy should be used when connecting to Nexus.
|
||||
*/
|
||||
private boolean nexusUsesProxy = true;
|
||||
|
||||
/**
|
||||
* Get the value of nexusUsesProxy
|
||||
*
|
||||
* @return the value of nexusUsesProxy
|
||||
*/
|
||||
public boolean isNexusUsesProxy() {
|
||||
return nexusUsesProxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of nexusUsesProxy
|
||||
*
|
||||
* @param nexusUsesProxy new value of nexusUsesProxy
|
||||
*/
|
||||
public void setNexusUsesProxy(boolean nexusUsesProxy) {
|
||||
this.nexusUsesProxy = nexusUsesProxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* The database driver name; such as org.h2.Driver.
|
||||
@@ -867,6 +889,7 @@ public class DependencyCheckTask extends Task {
|
||||
if (nexusUrl != null && !nexusUrl.isEmpty()) {
|
||||
Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
|
||||
}
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
|
||||
if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
|
||||
Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ ProxyPassword | Defines the proxy password. | Optional |
|
||||
ConnectionTimeout | The connection timeout used when downloading data files from the Internet. | Optional |
|
||||
nexusAnalyzerEnabled | The connection timeout used when downloading data files from the Internet. | Optional |
|
||||
nexusUrl | The connection timeout used when downloading data files from the Internet. | Optional |
|
||||
nexusUsesProxy | Whether or not the defined proxy should be used when connecting to Nexus. | Optional | true
|
||||
databaseDriverName | The name of the database driver. Example: org.h2.Driver. | Optional |
|
||||
databaseDriverPath | The path to the database driver JAR file; only used if the driver is not in the class path. | Optional |
|
||||
connectionString | The connection string used to connect to the database. | Optional |
|
||||
|
||||
@@ -160,6 +160,7 @@ public class App {
|
||||
final String suppressionFile = cli.getSuppressionFile();
|
||||
final boolean nexusDisabled = cli.isNexusDisabled();
|
||||
final String nexusUrl = cli.getNexusUrl();
|
||||
final boolean nexusUsesProxy = cli.isNexusUsesProxy();
|
||||
final String databaseDriverName = cli.getDatabaseDriverName();
|
||||
final String databaseDriverPath = cli.getDatabaseDriverPath();
|
||||
final String connectionString = cli.getConnectionString();
|
||||
@@ -215,7 +216,7 @@ public class App {
|
||||
if (nexusUrl != null && !nexusUrl.isEmpty()) {
|
||||
Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
|
||||
}
|
||||
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
|
||||
if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
|
||||
Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
|
||||
}
|
||||
|
||||
@@ -204,6 +204,10 @@ public final class CliParser {
|
||||
.withDescription("The url to the Nexus Server.")
|
||||
.create();
|
||||
|
||||
final Option nexusUsesProxy = OptionBuilder.withArgName("true/false").hasArg().withLongOpt(ArgumentName.NEXUS_URL)
|
||||
.withDescription("Whether or not the configured proxy should be used when connecting to Nexus.")
|
||||
.create();
|
||||
|
||||
final Option additionalZipExtensions = OptionBuilder.withArgName("extensions").hasArg()
|
||||
.withLongOpt(ArgumentName.ADDITIONAL_ZIP_EXTENSIONS)
|
||||
.withDescription("A comma seperated list of additional extensions to be scanned as ZIP files "
|
||||
@@ -227,6 +231,7 @@ public final class CliParser {
|
||||
.addOption(suppressionFile)
|
||||
.addOption(disableNexusAnalyzer)
|
||||
.addOption(nexusUrl)
|
||||
.addOption(nexusUsesProxy)
|
||||
.addOption(additionalZipExtensions);
|
||||
}
|
||||
|
||||
@@ -342,6 +347,20 @@ public final class CliParser {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is
|
||||
* returned.
|
||||
*
|
||||
* @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false
|
||||
*/
|
||||
public boolean isNexusUsesProxy() {
|
||||
if (line == null || !line.hasOption(ArgumentName.NEXUS_USES_PROXY)) {
|
||||
return true;
|
||||
} else {
|
||||
return Boolean.parseBoolean(line.getOptionValue(ArgumentName.NEXUS_USES_PROXY));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the command line help message to the standard output.
|
||||
*/
|
||||
@@ -697,6 +716,10 @@ public final class CliParser {
|
||||
* The URL of the nexus server.
|
||||
*/
|
||||
public static final String NEXUS_URL = "nexus";
|
||||
/**
|
||||
* Whether or not the defined proxy should be used when connecting to Nexus.
|
||||
*/
|
||||
public static final String NEXUS_USES_PROXY = "nexusUsesProxy";
|
||||
/**
|
||||
* The CLI argument name for setting the connection string.
|
||||
*/
|
||||
|
||||
@@ -28,4 +28,5 @@ Short | Argument Name | Parameter | Description | Requirement
|
||||
| \-\-dbUser | \<user\> | The username used to connect to the database. | Optional
|
||||
| \-\-disableNexus | | Disable the Nexus Analyzer. | Optional
|
||||
| \-\-nexus | \<url\> | The url to the Nexus Server. | Optional
|
||||
| \-\-nexusUsesProxy | \<true|false\> | Whether or not the defined proxy should be used when connecting to Nexus. | Optional
|
||||
| \-\-zipExtensions | \<strings\> | A comma-separated list of additional file extensions to be treated like a ZIP file, the contents will be extracted and analyzed. | Optional
|
||||
@@ -198,6 +198,12 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
|
||||
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal"})
|
||||
@Parameter(property = "nexusUrl", defaultValue = "", required = false)
|
||||
private String nexusUrl;
|
||||
/**
|
||||
* Whether or not the configured proxy is used to connect to Nexus.
|
||||
*/
|
||||
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal"})
|
||||
@Parameter(property = "nexusUsesProxy", defaultValue = "true", required = false)
|
||||
private boolean nexusUsesProxy = true;
|
||||
/**
|
||||
* The database connection string.
|
||||
*/
|
||||
@@ -751,6 +757,7 @@ public class DependencyCheckMojo extends AbstractMojo implements MavenMultiPageR
|
||||
if (nexusUrl != null && !nexusUrl.isEmpty()) {
|
||||
Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
|
||||
}
|
||||
Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
|
||||
if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
|
||||
Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ proxyUsername | Defines the proxy user name. |
|
||||
proxyPassword | Defines the proxy password. |
|
||||
nexusAnalyzerEnabled | Sets whether Nexus Analyzer will be used. |
|
||||
nexusUrl | Defines the Nexus URL. |
|
||||
nexusUsesProxy | Whether or not the defined proxy should be used when connecting to Nexus. | true
|
||||
databaseDriverName | The name of the database driver. Example: org.h2.Driver. |
|
||||
databaseDriverPath | The path to the database driver JAR file; only used if the driver is not in the class path. |
|
||||
connectionString | The connection string used to connect to the database. |
|
||||
|
||||
Reference in New Issue
Block a user