public class MavenResource
extends org.springframework.core.io.AbstractResource
Resource implementation for resolving an artifact via maven coordinates.
The MavenResource class contains
Maven coordinates for a jar file containing an app/library, or a Bill of Materials pom.
To create a new instance, either use MavenResource.Builder to set the individual fields:
new MavenResource.Builder()
.setGroupId("org.springframework.sample")
.setArtifactId("some-app")
.setExtension("jar") //optional
.setClassifier("exec") //optional
.setVersion("2.0.0")
.build()
...or use parse(String) to parse the coordinates as a colon delimited string:
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
MavenResource.parse("org.springframework.sample:some-app:2.0.0);
MavenResource.parse("org.springframework.sample:some-app:jar:exec:2.0.0);
| Modifier and Type | Class and Description |
|---|---|
static class |
MavenResource.Builder |
| Modifier and Type | Field and Description |
|---|---|
static String |
URI_SCHEME |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
boolean |
exists() |
String |
getArtifactId() |
String |
getClassifier() |
String |
getDescription() |
String |
getExtension() |
File |
getFile() |
String |
getFilename() |
String |
getGroupId() |
InputStream |
getInputStream() |
URI |
getURI() |
String |
getVersion() |
int |
hashCode() |
static MavenResource |
parse(String coordinates)
Create a
MavenResource for the provided coordinates and default properties. |
static MavenResource |
parse(String coordinates,
MavenProperties properties)
Create a
MavenResource for the provided coordinates and properties. |
String |
toString()
Returns the coordinates encoded as
<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>,
conforming to the Aether convention.
|
public static String URI_SCHEME
public String getArtifactId()
artifactIdpublic String getDescription()
public InputStream getInputStream() throws IOException
IOExceptionpublic File getFile() throws IOException
getFile in interface org.springframework.core.io.ResourcegetFile in class org.springframework.core.io.AbstractResourceIOExceptionpublic String getFilename()
getFilename in interface org.springframework.core.io.ResourcegetFilename in class org.springframework.core.io.AbstractResourcepublic boolean exists()
exists in interface org.springframework.core.io.Resourceexists in class org.springframework.core.io.AbstractResourcepublic final boolean equals(Object o)
equals in class org.springframework.core.io.AbstractResourcepublic int hashCode()
hashCode in class org.springframework.core.io.AbstractResourcepublic String toString()
toString in class org.springframework.core.io.AbstractResourcepublic URI getURI() throws IOException
getURI in interface org.springframework.core.io.ResourcegetURI in class org.springframework.core.io.AbstractResourceIOExceptionpublic static MavenResource parse(String coordinates)
MavenResource for the provided coordinates and default properties.coordinates - coordinates encoded as <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>,
conforming to the Aether convention.MavenResourcepublic static MavenResource parse(String coordinates, MavenProperties properties)
MavenResource for the provided coordinates and properties.coordinates - coordinates encoded as <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>,
conforming to the Aether convention.properties - the properties for the repositories, proxies, and authenticationMavenResourceCopyright © 2020 Pivotal Software, Inc.. All rights reserved.