Class MavenResource
java.lang.Object
org.springframework.core.io.AbstractResource
org.springframework.cloud.function.deployer.utils.MavenResource
- All Implemented Interfaces:
org.springframework.core.io.InputStreamSource,org.springframework.core.io.Resource
public final class MavenResource
extends org.springframework.core.io.AbstractResource
A
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);
- Author:
- David Turanski, Mark Fisher, Patrick Peralta, Venil Noronha, Ilayaperumal Gopinathan
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanexists()getFile()getURI()getVersions(String coordinates) Get all the available versions on this maven co-ordinate.inthashCode()static MavenResourceCreate aMavenResourcefor the provided coordinates and default properties.static MavenResourceparse(String coordinates, MavenProperties properties) Create aMavenResourcefor the provided coordinates and properties.toString()Returns the coordinates encoded as <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>, conforming to the Aether convention.Methods inherited from class org.springframework.core.io.AbstractResource
contentLength, createRelative, getFileForLastModifiedCheck, getURL, isFile, isOpen, isReadable, lastModified, readableChannelMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.io.Resource
getContentAsByteArray, getContentAsString
-
Field Details
-
URI_SCHEME
URI Scheme.
-
-
Method Details
-
getGroupId
-
getArtifactId
-
getExtension
-
getClassifier
-
getVersion
-
getDescription
-
getInputStream
- Throws:
IOException
-
getFile
- Specified by:
getFilein interfaceorg.springframework.core.io.Resource- Overrides:
getFilein classorg.springframework.core.io.AbstractResource- Throws:
IOException
-
getFilename
- Specified by:
getFilenamein interfaceorg.springframework.core.io.Resource- Overrides:
getFilenamein classorg.springframework.core.io.AbstractResource
-
exists
public boolean exists()- Specified by:
existsin interfaceorg.springframework.core.io.Resource- Overrides:
existsin classorg.springframework.core.io.AbstractResource
-
equals
- Overrides:
equalsin classorg.springframework.core.io.AbstractResource
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.springframework.core.io.AbstractResource
-
toString
Returns the coordinates encoded as <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>, conforming to the Aether convention.- Overrides:
toStringin classorg.springframework.core.io.AbstractResource
-
getURI
- Specified by:
getURIin interfaceorg.springframework.core.io.Resource- Overrides:
getURIin classorg.springframework.core.io.AbstractResource- Throws:
IOException
-
parse
Create aMavenResourcefor the provided coordinates and default properties.- Parameters:
coordinates- coordinates encoded as <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>, conforming to the Aether convention.- Returns:
- the
MavenResource
-
parse
Create aMavenResourcefor the provided coordinates and properties.- Parameters:
coordinates- coordinates encoded as <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>, conforming to the Aether convention.properties- the properties for the repositories, proxies, and authentication- Returns:
- the
MavenResource
-
getVersions
Get all the available versions on this maven co-ordinate.- Parameters:
coordinates- the co-ordinate with the version constraint added. Example: org.springframework.cloud.stream.app:http-source-rabbit:[0,)- Returns:
- the list of all the available versions
-