- All Superinterfaces:
AutoCloseable
Maven client API to work with maven artifacts.
To access get an instance of the client use MavenClientProvider.discoverProvider(ClassLoader) which will resolve the
implementation through SPI by loading an instance of MavenClientProvider that must be in the classpath.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptiongetEffectiveModel(File artifactFile, Optional<File> temporaryFolder) Creates the effective pom model by reading the pom inside the artifact.getRawPomModel(File artifactFile) Creates the pom model by reading the pom inside the artifact.resolveArtifactDependencies(File artifactFile, boolean includeTestDependencies, boolean includeProvidedDependencies, Optional<File> localRepositoryLocationSupplier, Optional<File> temporaryFolder) Resolves the artifact dependencies for an artifact.resolveArtifactDependencies(File artifactFile, boolean includeTestDependencies, boolean includeProvidedDependencies, Optional<File> localRepositoryLocationSupplier, Optional<MavenReactorResolver> mavenReactorResolver, Optional<File> temporaryFolder) Resolves the artifact dependencies for an artifact.resolveArtifactDependencies(List<BundleDescriptor> dependencies, Optional<File> localRepositoryLocationSupplier, Optional<MavenReactorResolver> mavenReactorResolver) Resolves the artifact dependencies from the list for the given descriptor.resolveBundleDescriptor(BundleDescriptor bundleDescriptor) Retrieves theBundleDependencyfor aBundleDescriptor.resolveBundleDescriptorDependencies(boolean includeTestDependencies, boolean includeProvidedDependencies, BundleDescriptor bundleDescriptor) Resolves dependencies of a bundle.resolveBundleDescriptorDependencies(boolean includeTestDependencies, BundleDescriptor bundleDescriptor) Resolves dependencies of a bundle.resolvePluginBundleDescriptorsDependencies(List<BundleDescriptor> bundleDescriptors) Resolve the effective list of plugins.resolveVersionRange(BundleDescriptor bundleDescriptor) Resolves for a bundle descriptor with a version range the available versions from remote repositories.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
getMavenConfiguration
MavenConfiguration getMavenConfiguration()- Returns:
- the maven configuration of this client
-
resolveVersionRange
Resolves for a bundle descriptor with a version range the available versions from remote repositories.- Parameters:
bundleDescriptor- descriptor of the artifact- Returns:
- a
VersionRangeResult
-
resolveArtifactDependencies
List<BundleDependency> resolveArtifactDependencies(File artifactFile, boolean includeTestDependencies, boolean includeProvidedDependencies, Optional<File> localRepositoryLocationSupplier, Optional<File> temporaryFolder) Resolves the artifact dependencies for an artifact. While resolving the dependencies for an artifact it will also take into account theMavenConfiguration.getActiveProfiles()andMavenConfiguration.getInactiveProfiles().- Parameters:
artifactFile- the artifact file to resolve the dependencies for. It may be an exploded archive following the mule deployable artifact structure or a compressed artifact following the maven conventions.includeTestDependencies- true if the test dependencies must be included in the list of direct dependencies, false otherwise.includeProvidedDependencies- true if the provided dependencies must be included in the list of direct dependencies, false otherwise.localRepositoryLocationSupplier- a supplier of the local repository folder location. It may be empty in which case the one of the provided maven configuration will be used.temporaryFolder- to be used if the file is compressed. If present, it will be used as target to extract required files. Otherwise, files will be handled in memory.- Returns:
- the list of dependencies of the artifact.
-
resolveArtifactDependencies
List<BundleDependency> resolveArtifactDependencies(File artifactFile, boolean includeTestDependencies, boolean includeProvidedDependencies, Optional<File> localRepositoryLocationSupplier, Optional<MavenReactorResolver> mavenReactorResolver, Optional<File> temporaryFolder) Resolves the artifact dependencies for an artifact. While resolving the dependencies for an artifact it will also take into account theMavenConfiguration.getActiveProfiles()andMavenConfiguration.getInactiveProfiles().- Parameters:
artifactFile- the artifact file to resolve the dependencies for. It may be an exploded archive following the mule deployable artifact structure or a compressed artifact following the maven conventions.includeTestDependencies- true if the test dependencies must be included in the list of direct dependencies, false otherwise.includeProvidedDependencies- true if the provided dependencies must be included in the list of direct dependencies, false otherwise.localRepositoryLocationSupplier- a supplier of the local repository folder location. It may be empty in which case the one of the provided maven configuration will be used.mavenReactorResolver-MavenReactorResolverto look for artifacts first.temporaryFolder- to be used if the file is compressed. If present, it will be used as target to extract required files. Otherwise, files will be handled in memory.- Returns:
- the list of dependencies of the artifact.
-
resolveArtifactDependencies
List<BundleDependency> resolveArtifactDependencies(List<BundleDescriptor> dependencies, Optional<File> localRepositoryLocationSupplier, Optional<MavenReactorResolver> mavenReactorResolver) Resolves the artifact dependencies from the list for the given descriptor. It is assumed that all the dependencies defined in the list will be treated as compile scope. The remote repositories and local repository defined from MavenConfiguration will be considered on this resolution. The dependencies will be collected and resolved with the remote repositories defined for the MavenConfiguration. The reactor parameter allows to use this as a way to resolve an artifact dependency such a mule-plugin in the same way that it is resolved when declared in an application/domain (without provided and test scope dependencies for the mule-plugin). In case of resolving mule-plugin dependencies, clients of this API should traverse transitive dependencies on each BundleDependency to collect the list of dependencies.- Parameters:
dependencies- list of dependencies to be resolved, all treated as compile scope.localRepositoryLocationSupplier- a supplier of the local repository folder location. It may be empty in which case the one of the provided maven configuration will be used.mavenReactorResolver-MavenReactorResolverto look for artifacts first.- Returns:
- the list of the requested dependencies resolved with their transitive dependencies and these also with their transitive dependencies and so on.
-
resolveBundleDescriptorDependencies
List<BundleDependency> resolveBundleDescriptorDependencies(boolean includeTestDependencies, BundleDescriptor bundleDescriptor) Resolves dependencies of a bundle.MavenConfiguration.getActiveProfiles()andMavenConfiguration.getInactiveProfiles()will not be considered when resolving the dependencies and building the pom model.- Parameters:
includeTestDependencies- true if the test dependencies must be included in the list, false otherwise.bundleDescriptor- descriptor of the artifact- Returns:
- the list of dependencies of the artifact
-
resolveBundleDescriptorDependencies
List<BundleDependency> resolveBundleDescriptorDependencies(boolean includeTestDependencies, boolean includeProvidedDependencies, BundleDescriptor bundleDescriptor) Resolves dependencies of a bundle.MavenConfiguration.getActiveProfiles()andMavenConfiguration.getInactiveProfiles()will not be considered when resolving the dependencies and building the pom model.- Parameters:
includeTestDependencies- true if the test dependencies must be included in the list, false otherwise.includeProvidedDependencies- true if the provided dependencies must be included in the list of direct dependencies, false otherwise.bundleDescriptor- descriptor of the artifact- Returns:
- the list of dependencies of the artifact
-
resolveBundleDescriptor
Retrieves theBundleDependencyfor aBundleDescriptor.- Parameters:
bundleDescriptor- the bundle descriptor.- Returns:
- the resolved
BundleDependency
-
resolvePluginBundleDescriptorsDependencies
List<BundleDependency> resolvePluginBundleDescriptorsDependencies(List<BundleDescriptor> bundleDescriptors) Resolve the effective list of plugins.- Parameters:
bundleDescriptors- a list of plugins to resolve the effective list of plugins considering their dependencies- Returns:
- the effective list of plugins.
-
getRawPomModel
Creates the pom model by reading the pom inside the artifact. It won't solve the effective pom meaning that, for instance, properties defined in parent pom will not be lookup to resolve the pom values.The artifact can be a compressed file or an exploded artifact. The only requirement is that it contains the expected maven structure.
- Parameters:
artifactFile- the compressed artifact- Returns:
- the effective pom model
-
getEffectiveModel
Creates the effective pom model by reading the pom inside the artifact. Properties defined in the pom file will be resolved.The artifact can be a compressed file or an exploded artifact. The only requirement is that it contains the expected maven structure.
- Parameters:
artifactFile- the compressed artifacttemporaryFolder- a folder to be used for creating temporary files.- Returns:
-