mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-25 02:21:28 +01:00
updated to use HTTP or HTTPS as appropriate for the download URL
Former-commit-id: a285898cfb8ae9d2dd92549b8136c64cc551d1a4
This commit is contained in:
@@ -27,7 +27,7 @@ public class MavenArtifact {
|
|||||||
/**
|
/**
|
||||||
* The base URL for download artifacts from Central.
|
* The base URL for download artifacts from Central.
|
||||||
*/
|
*/
|
||||||
private static final String CENTRAL_CONTENT_URL = "http://search.maven.org/remotecontent?filepath=";
|
private static final String CENTRAL_CONTENT_URL = "//search.maven.org/remotecontent?filepath=";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The groupId
|
* The groupId
|
||||||
@@ -80,19 +80,26 @@ public class MavenArtifact {
|
|||||||
* @param version the version
|
* @param version the version
|
||||||
* @param jarAvailable if the jar file is available from central
|
* @param jarAvailable if the jar file is available from central
|
||||||
* @param pomAvailable if the pom file is available from central
|
* @param pomAvailable if the pom file is available from central
|
||||||
|
* @param secureDownload if the jar and pom files should be downloaded using HTTPS.
|
||||||
*/
|
*/
|
||||||
public MavenArtifact(String groupId, String artifactId, String version, boolean jarAvailable, boolean pomAvailable) {
|
public MavenArtifact(String groupId, String artifactId, String version, boolean jarAvailable, boolean pomAvailable, boolean secureDownload) {
|
||||||
this.groupId = groupId;
|
this.groupId = groupId;
|
||||||
this.artifactId = artifactId;
|
this.artifactId = artifactId;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
String base;
|
||||||
|
if (secureDownload) {
|
||||||
|
base = "https:" + CENTRAL_CONTENT_URL;
|
||||||
|
} else {
|
||||||
|
base = "http:" + CENTRAL_CONTENT_URL;
|
||||||
|
}
|
||||||
if (jarAvailable) {
|
if (jarAvailable) {
|
||||||
//org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom
|
//org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom
|
||||||
this.artifactUrl = this.CENTRAL_CONTENT_URL + groupId.replace('.', '/') + "/" + artifactId.replace('.', '/') + "/"
|
this.artifactUrl = base + groupId.replace('.', '/') + "/" + artifactId + "/"
|
||||||
+ version + "/" + artifactId + "-" + version + ".jar";
|
+ version + "/" + artifactId + "-" + version + ".jar";
|
||||||
}
|
}
|
||||||
if (pomAvailable) {
|
if (pomAvailable) {
|
||||||
//org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom
|
//org/springframework/spring-core/3.2.0.RELEASE/spring-core-3.2.0.RELEASE.pom
|
||||||
this.pomUrl = this.CENTRAL_CONTENT_URL + groupId.replace('.', '/') + "/" + artifactId.replace('.', '/') + "/"
|
this.pomUrl = base + groupId.replace('.', '/') + "/" + artifactId + "/"
|
||||||
+ version + "/" + artifactId + "-" + version + ".pom";
|
+ version + "/" + artifactId + "-" + version + ".pom";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user