public class CAppDependencyResolver extends Object
| Constructor and Description |
|---|
CAppDependencyResolver() |
| Modifier and Type | Method and Description |
|---|---|
static void |
collectDependentCAppFiles(File projectDir,
File dependenciesDir,
File carFile,
ArrayList<File> cAppFiles,
Set<String> visited,
CARMojo carMojo)
Recursively collects dependent CAPP files from the given .car file.
|
static File |
fetchCarFileFromMavenRepo(File projectDir,
File dependenciesDir,
String groupId,
String artifactId,
String version,
CARMojo carMojo)
Attempts to fetch a \`.car\` file for the specified groupId, artifactId, and version from the local Maven repository.
|
static File |
findCarFileInDependencies(File dependenciesDir,
String artifactId,
String version)
Finds a \`.car\` file in the given dependencies directory that matches the specified groupId, artifactId, and version.
|
static ArrayList<File> |
getResolvedDependentCAppFiles(File projectDir,
File dependenciesDir,
String artifactId,
String version,
CARMojo carMojo)
Retrieves a list of resolved dependent CApp \(.car\) files from the dependencies directory.
|
static List<CAppDependency> |
getTopLevelCAppDependencies(org.apache.maven.project.MavenProject project)
Retrieves the list of top-level CApp dependencies from the given Maven project.
|
static void |
handleConfigPropertiesFile(File srcDir,
File targetDir)
Handles the `config.properties` file by copying it from the source directory to the target directory.
|
static boolean |
isFatCarEnabled(org.apache.maven.project.MavenProject project)
Checks if the fat.car.enable property is set to true in the Maven project's properties.
|
static void |
mergePropertiesFiles(File sourceFile,
File targetFile)
Merges the contents of two properties files.
|
static void |
resolveDependencies(CARMojo carMojo,
org.apache.maven.project.MavenProject project,
String archiveDir,
List<ArtifactDependency> dependencies,
List<ArtifactDependency> metaDependencies)
Resolves CApp (Carbon Application) dependencies for the given Maven project.
|
static void |
unzipFile(File zipFile,
File extractDir)
Unzips the given .zip file into the specified extraction directory.
|
static void |
updateArtifactDependencies(File artifactDependencyFile,
List<ArtifactDependency> artifactDependencies,
CARMojo carMojo)
Updates the list of artifact dependencies by reading and parsing the specified artifact dependency file.
|
public static void resolveDependencies(CARMojo carMojo, org.apache.maven.project.MavenProject project, String archiveDir, List<ArtifactDependency> dependencies, List<ArtifactDependency> metaDependencies) throws Exception
carMojo - The CARMojo instance used for logging and project context.project - The Maven project for which dependencies are being resolved.archiveDir - The directory where dependencies should be extracted/copied.dependencies - The list of artifact dependencies to update.Exceptionpublic static boolean isFatCarEnabled(org.apache.maven.project.MavenProject project)
project - The Maven project to check for the fat.car.enable property.public static void handleConfigPropertiesFile(File srcDir, File targetDir) throws IOException
srcDir - The source directory containing the `config.properties` file.targetDir - The target directory where the `config.properties` file will be copied or merged.IOException - If an error occurs during file operations.public static void mergePropertiesFiles(File sourceFile, File targetFile) throws IOException
sourceFile - The source properties file to merge from.targetFile - The target properties file to merge into.IOExceptionpublic static void updateArtifactDependencies(File artifactDependencyFile, List<ArtifactDependency> artifactDependencies, CARMojo carMojo) throws Exception
artifactDependencyFile - The XML file containing artifact dependency definitions.artifactDependencies - The list to update with new artifact dependencies.carMojo - The CARMojo instance used for logging.Exceptionpublic static void unzipFile(File zipFile, File extractDir) throws IOException
zipFile - The .zip file to be extracted.extractDir - The directory where the contents of the .zip file will be extracted.IOException - If an error occurs during file extraction.public static ArrayList<File> getResolvedDependentCAppFiles(File projectDir, File dependenciesDir, String artifactId, String version, CARMojo carMojo) throws Exception
projectDir - The project directorydependenciesDir - The directory containing dependency .car files.carMojo - The CARMojo instance used for logging and project context.Exceptionpublic static void collectDependentCAppFiles(File projectDir, File dependenciesDir, File carFile, ArrayList<File> cAppFiles, Set<String> visited, CARMojo carMojo) throws Exception
projectDir - The project directory where the .car file is located.dependenciesDir - The directory containing dependency .car files.carFile - The .car file to process.cAppFiles - The list to collect resolved CAPP files.visited - A set to track already processed dependencies to avoid cycles.carMojo - The `CARMojo` instance used for logging and project context.Exceptionpublic static File findCarFileInDependencies(File dependenciesDir, String artifactId, String version)
dependenciesDir - The directory containing dependency \`.car\` files.artifactId - The artifact ID of the dependency.version - The version of the dependency.public static File fetchCarFileFromMavenRepo(File projectDir, File dependenciesDir, String groupId, String artifactId, String version, CARMojo carMojo) throws Exception
projectDir - The project directory where the Maven project is located.dependenciesDir - The directory where the dependency \`.car\` file should be copied.groupId - The group ID of the dependency.artifactId - The artifact ID of the dependency.version - The version of the dependency.Exceptionpublic static List<CAppDependency> getTopLevelCAppDependencies(org.apache.maven.project.MavenProject project)
project - The Maven project to extract dependencies from.Copyright © 2025 WSO2. All rights reserved.