mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 07:43:40 +01:00
added pom URL as part of patch for issue #196 and improved the URL provided for the jar file itself
Former-commit-id: 8f485f53031a7e244d4a8f8d0c055e6b38fca746
This commit is contained in:
@@ -24,6 +24,11 @@ package org.owasp.dependencycheck.data.nexus;
|
||||
*/
|
||||
public class MavenArtifact {
|
||||
|
||||
/**
|
||||
* The base URL for download artifacts from Central.
|
||||
*/
|
||||
private final String CENTRAL_CONTENT_URL = "http://search.maven.org/remotecontent?filepath=";
|
||||
|
||||
/**
|
||||
* The groupId
|
||||
*/
|
||||
@@ -43,6 +48,10 @@ public class MavenArtifact {
|
||||
* The artifact url. This may change depending on which Nexus server the search took place.
|
||||
*/
|
||||
private String artifactUrl;
|
||||
/**
|
||||
* The url to download the POM from.
|
||||
*/
|
||||
private String pomUrl;
|
||||
|
||||
/**
|
||||
* Creates an empty MavenArtifact.
|
||||
@@ -58,9 +67,32 @@ public class MavenArtifact {
|
||||
* @param version the version
|
||||
*/
|
||||
public MavenArtifact(String groupId, String artifactId, String version) {
|
||||
setGroupId(groupId);
|
||||
setArtifactId(artifactId);
|
||||
setVersion(version);
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MavenArtifact with the given attributes.
|
||||
*
|
||||
* @param groupId the groupId
|
||||
* @param artifactId the artifactId
|
||||
* @param version the version
|
||||
* @param jarAvailable if the jar file is available from central
|
||||
* @param pomAvailable if the pom file is available from central
|
||||
*/
|
||||
public MavenArtifact(String groupId, String artifactId, String version, boolean jarAvailable, boolean pomAvailable) {
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
this.version = version;
|
||||
if (jarAvailable) {
|
||||
//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('.', '/') + "/" + version + "/" + artifactId + "-" + version + ".jar";
|
||||
}
|
||||
if (pomAvailable) {
|
||||
//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('.', '/') + "/" + version + "/" + artifactId + "-" + version + ".pom";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,10 +104,10 @@ public class MavenArtifact {
|
||||
* @param url the artifactLink url
|
||||
*/
|
||||
public MavenArtifact(String groupId, String artifactId, String version, String url) {
|
||||
setGroupId(groupId);
|
||||
setArtifactId(artifactId);
|
||||
setVersion(version);
|
||||
setArtifactUrl(url);
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
this.version = version;
|
||||
this.artifactUrl = url;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,6 +191,25 @@ public class MavenArtifact {
|
||||
public String getArtifactUrl() {
|
||||
return artifactUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of pomUrl.
|
||||
*
|
||||
* @return the value of pomUrl
|
||||
*/
|
||||
public String getPomUrl() {
|
||||
return pomUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of pomUrl.
|
||||
*
|
||||
* @param pomUrl new value of pomUrl
|
||||
*/
|
||||
public void setPomUrl(String pomUrl) {
|
||||
this.pomUrl = pomUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: cc=120:sw=4:ts=4:sts=4
|
||||
|
||||
Reference in New Issue
Block a user