use of io.fabric8.deployer.dto.DependencyDTO in project fabric8 by jboss-fuse.
the class AbstractProfileMojo method addProjectArtifactBundle.
protected void addProjectArtifactBundle(ProjectRequirements requirements) throws MojoFailureException {
DependencyDTO rootDependency = requirements.getRootDependency();
if (rootDependency != null) {
// we need url with type, so when we deploy war files the mvn url is correct
StringBuilder urlBuffer = new StringBuilder(rootDependency.toBundleUrl());
String apparentType = rootDependency.getType();
String apparentClassifier = rootDependency.getClassifier();
for (String omit : OMITTED_BUNDLE_TYPES) {
if (omit.equals(apparentType)) {
apparentType = null;
break;
}
}
handleArtifactBundleType(urlBuffer, apparentType);
handleArtifactBundleClassifier(urlBuffer, apparentClassifier);
String urlString = urlBuffer.toString();
if (!requirements.getBundles().contains(urlString)) {
requirements.getBundles().add(urlString);
}
}
}
use of io.fabric8.deployer.dto.DependencyDTO in project fabric8 by jboss-fuse.
the class CreateProfileZipMojo method generateZip.
protected void generateZip() throws DependencyTreeBuilderException, MojoExecutionException, IOException, MojoFailureException {
ProjectRequirements requirements = new ProjectRequirements();
DependencyDTO rootDependency = null;
if (isIncludeArtifact()) {
rootDependency = loadRootDependency();
requirements.setRootDependency(rootDependency);
}
configureRequirements(requirements);
if (isIncludeArtifact()) {
addProjectArtifactBundle(requirements);
}
File profileBuildDir = createProfileBuildDir(requirements.getProfileId());
boolean hasConfigDir = profileConfigDir.isDirectory();
if (hasConfigDir) {
copyProfileConfigFiles(profileBuildDir, profileConfigDir);
} else {
getLog().info("The profile configuration files directory " + profileConfigDir + " doesn't exist, so not copying any additional project documentation or configuration files");
}
// to avoid generating dummy profiles for parent poms
if (hasConfigDir || rootDependency != null || notEmpty(requirements.getBundles()) || notEmpty(requirements.getFeatures()) || notEmpty(requirements.getFeatureRepositories())) {
if (includeReadMe) {
copyReadMe(project.getFile().getParentFile(), profileBuildDir);
}
if (generateSummaryFile) {
String description = project.getDescription();
if (Strings.isNotBlank(description)) {
File summaryMd = new File(profileBuildDir, "Summary.md");
summaryMd.getParentFile().mkdirs();
if (!summaryMd.exists()) {
byte[] bytes = description.getBytes();
Files.copy(new ByteArrayInputStream(bytes), new FileOutputStream(summaryMd));
}
}
}
if (isIncludeArtifact()) {
writeProfileRequirements(requirements, profileBuildDir);
}
generateFabricAgentProperties(requirements, new File(profileBuildDir, "io.fabric8.agent.properties"));
// only generate if its a WAR project
if ("war".equals(project.getPackaging())) {
generateFabricContextPathProperties(requirements, new File(profileBuildDir, Constants.WEB_CONTEXT_PATHS_PID + ".properties"));
}
Zips.createZipFile(getLog(), buildDir, outputFile);
projectHelper.attachArtifact(project, artifactType, artifactClassifier, outputFile);
getLog().info("Created profile zip file: " + outputFile);
}
}
use of io.fabric8.deployer.dto.DependencyDTO in project fabric8 by jboss-fuse.
the class CreateScriptMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
DependencyDTO rootDependency = loadRootDependency();
ProjectRequirements requirements = new ProjectRequirements();
requirements.setRootDependency(rootDependency);
configureRequirements(requirements);
addProjectArtifactBundle(requirements);
generateScript(requirements, outputFile);
projectHelper.attachArtifact(project, artifactType, artifactClassifier, outputFile);
} catch (MojoExecutionException e) {
throw e;
} catch (Exception e) {
throw new MojoExecutionException("Error executing", e);
}
}
Aggregations