Class MavenDependencyResolver
- java.lang.Object
-
- org.robolectric.internal.dependency.MavenDependencyResolver
-
- All Implemented Interfaces:
org.robolectric.internal.dependency.DependencyResolver
public class MavenDependencyResolver extends java.lang.Object implements org.robolectric.internal.dependency.DependencyResolverThis class is mainly responsible for fetching Android framework JAR dependencies from MavenCentral. Initially the fetching was being done with maven-ant-tasks, but that dependency become outdated and unmaintained and had security vulnerabilities.There was an initial attempt to use maven-resolver for this, but that depends on a newer version of Apache Http Client that is not compatible with the one expected to be on the classpath for Android 16-18.
This uses only basic
HttpURLConnectionfor fetching. In general using an HTTP client library here could create conflicts with the ones in the Android system.- See Also:
- maven-ant-tasks, Maven Resolver
-
-
Constructor Summary
Constructors Constructor Description MavenDependencyResolver()MavenDependencyResolver(java.lang.String repositoryUrl, java.lang.String repositoryId, java.lang.String repositoryUserName, java.lang.String repositoryPassword)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.ExecutorServicecreateExecutorService()protected MavenArtifactFetchercreateMavenFetcher(java.lang.String repositoryUrl, java.lang.String repositoryUserName, java.lang.String repositoryPassword, java.io.File localRepositoryDir, java.util.concurrent.ExecutorService executorService)java.net.URLgetLocalArtifactUrl(org.robolectric.internal.dependency.DependencyJar dependency)java.net.URL[]getLocalArtifactUrls(org.robolectric.internal.dependency.DependencyJar dependency)java.net.URL[]getLocalArtifactUrls(org.robolectric.internal.dependency.DependencyJar... dependencies)Get an array of local artifact URLs for the given dependencies.protected java.io.FilegetLocalRepositoryDir()Locates the local maven repo.
-
-
-
Method Detail
-
getLocalArtifactUrls
public java.net.URL[] getLocalArtifactUrls(org.robolectric.internal.dependency.DependencyJar dependency)
- Specified by:
getLocalArtifactUrlsin interfaceorg.robolectric.internal.dependency.DependencyResolver
-
getLocalArtifactUrls
public java.net.URL[] getLocalArtifactUrls(org.robolectric.internal.dependency.DependencyJar... dependencies)
Get an array of local artifact URLs for the given dependencies. The order of the URLs is guaranteed to be the same as the input order of dependencies, i.e., urls[i] is the local artifact URL for dependencies[i].
-
getLocalArtifactUrl
public java.net.URL getLocalArtifactUrl(org.robolectric.internal.dependency.DependencyJar dependency)
- Specified by:
getLocalArtifactUrlin interfaceorg.robolectric.internal.dependency.DependencyResolver
-
getLocalRepositoryDir
protected java.io.File getLocalRepositoryDir()
Locates the local maven repo.
-
createMavenFetcher
protected MavenArtifactFetcher createMavenFetcher(java.lang.String repositoryUrl, java.lang.String repositoryUserName, java.lang.String repositoryPassword, java.io.File localRepositoryDir, java.util.concurrent.ExecutorService executorService)
-
createExecutorService
protected java.util.concurrent.ExecutorService createExecutorService()
-
-