use of org.mule.tools.api.classloader.model.ArtifactCoordinates in project mule by mulesoft.
the class DeployableFileBuilder method createClassLoaderModelJsonFile.
private File createClassLoaderModelJsonFile(AbstractDependencyFileBuilder dependencyFileBuilder) {
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(dependencyFileBuilder.getGroupId(), dependencyFileBuilder.getArtifactId(), dependencyFileBuilder.getVersion(), dependencyFileBuilder.getType(), dependencyFileBuilder.getClassifier());
ClassLoaderModel classLoaderModel = new ClassLoaderModel("1.0", artifactCoordinates);
List<Artifact> artifactDependencies = new LinkedList<>();
List<AbstractDependencyFileBuilder> dependencies = dependencyFileBuilder.getDependencies();
for (AbstractDependencyFileBuilder fileBuilderDependency : dependencies) {
artifactDependencies.add(getArtifact(fileBuilderDependency));
}
classLoaderModel.setDependencies(artifactDependencies);
Path repository = Paths.get(getTempFolder(), REPOSITORY_FOLDER, dependencyFileBuilder.getArtifactFileRepositoryFolderPath());
if (repository.toFile().exists()) {
repository.toFile().delete();
} else {
if (!repository.toFile().mkdirs()) {
throw new IllegalStateException("Cannot create artifact folder inside repository");
}
}
return serializeToFile(classLoaderModel, repository.toFile());
}
use of org.mule.tools.api.classloader.model.ArtifactCoordinates in project mule by mulesoft.
the class DeployableFileBuilder method getClassLoaderModelFile.
private File getClassLoaderModelFile() {
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(getGroupId(), getArtifactId(), getVersion());
ClassLoaderModel classLoaderModel = new ClassLoaderModel("1.0", artifactCoordinates);
List<Artifact> artifactDependencies = new LinkedList<>();
for (AbstractDependencyFileBuilder fileBuilderDependency : getDependencies()) {
artifactDependencies.add(getArtifact(fileBuilderDependency));
}
classLoaderModel.setDependencies(artifactDependencies);
File destinationFolder = Paths.get(getTempFolder()).resolve(META_INF).resolve(MULE_ARTIFACT).toFile();
if (!destinationFolder.exists()) {
assertThat(destinationFolder.mkdirs(), is(true));
}
return serializeToFile(classLoaderModel, destinationFolder);
}
Aggregations