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()
artifactId
public String getDescription()
public InputStream getInputStream() throws IOException
IOException
public File getFile() throws IOException
getFile
in interface org.springframework.core.io.Resource
getFile
in class org.springframework.core.io.AbstractResource
IOException
public String getFilename()
getFilename
in interface org.springframework.core.io.Resource
getFilename
in class org.springframework.core.io.AbstractResource
public boolean exists()
exists
in interface org.springframework.core.io.Resource
exists
in class org.springframework.core.io.AbstractResource
public final boolean equals(Object o)
equals
in class org.springframework.core.io.AbstractResource
public int hashCode()
hashCode
in class org.springframework.core.io.AbstractResource
public String toString()
toString
in class org.springframework.core.io.AbstractResource
public URI getURI() throws IOException
getURI
in interface org.springframework.core.io.Resource
getURI
in class org.springframework.core.io.AbstractResource
IOException
public 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.MavenResource
public 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 authenticationMavenResource
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.