use of org.apache.maven.model.Dependency in project sling by apache.
the class ArtifactDefinition method toDependencyList.
public List<Dependency> toDependencyList(String scope) {
ArrayList<Dependency> depList = new ArrayList<Dependency>();
if (bundles == null) {
Dependency dep = new Dependency();
dep.setArtifactId(artifactId);
dep.setGroupId(groupId);
dep.setVersion(version);
if (type != null) {
dep.setType(type);
}
dep.setClassifier(classifier);
dep.setScope(scope);
depList.add(dep);
} else {
for (ArtifactDefinition bundle : bundles) {
depList.addAll(bundle.toDependencyList(scope));
}
}
return depList;
}
use of org.apache.maven.model.Dependency in project sling by apache.
the class StartMojo method findLaunchpadJar.
/**
* Finds the launchpad.jar artifact of the project being built.
*
* @return the launchpad.jar artifact
* @throws MojoFailureException if a launchpad.jar artifact was not found
*/
private File findLaunchpadJar() throws MojoFailureException, MojoExecutionException {
// If a launchpad JAR is specified, use it
if (launchpadJar != null) {
getLog().info("Using launchpad jar from '" + launchpadJar + "' given as configuration parameter!");
return launchpadJar;
}
// If a launchpad dependency is configured, resolve it
if (launchpadDependency != null) {
getLog().info("Using launchpad dependency '" + launchpadDependency + "' given as configuration parameter!");
return getArtifact(launchpadDependency).getFile();
}
// If the current project is a slingstart project, use its JAR artifact
if (this.project.getPackaging().equals(BuildConstants.PACKAGING_SLINGSTART)) {
File jarFile = project.getArtifact().getFile();
if (jarFile != null && jarFile.exists()) {
getLog().info("Using launchpad jar being generated as this project's primary artifact: '" + jarFile + "'!");
return jarFile;
} else {
jarFile = new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + ".jar");
if (jarFile.exists()) {
getLog().info("Using launchpad jar being generated as this project's primary artifact: '" + jarFile + "'!");
return jarFile;
}
}
}
// In case there was a provisioning model found but this is not a slingstart project, the JAR might be attached already through goal "package"
for (Artifact attachedArtifact : project.getAttachedArtifacts()) {
// find the attached artifact with classifier "standalone"
if (BuildConstants.TYPE_JAR.equals(attachedArtifact.getType()) && BuildConstants.CLASSIFIER_APP.equals(attachedArtifact.getClassifier())) {
getLog().info("Using launchpad jar being attached as additional project artifact: '" + attachedArtifact.getFile() + "'!");
return attachedArtifact.getFile();
}
}
// Last chance: use the first declared dependency with type "slingstart"
final Set<Artifact> dependencies = this.project.getDependencyArtifacts();
for (final Artifact dep : dependencies) {
if (BuildConstants.PACKAGING_SLINGSTART.equals(dep.getType())) {
final Dependency d = new Dependency();
d.setGroupId(dep.getGroupId());
d.setArtifactId(dep.getArtifactId());
d.setVersion(dep.getVersion());
d.setScope(Artifact.SCOPE_RUNTIME);
d.setType(BuildConstants.TYPE_JAR);
getLog().info("Using launchpad jar from first dependency of type 'slingstart': '" + d + "'!");
return getArtifact(d).getFile();
}
}
// Launchpad has not been found, throw an exception
throw new MojoFailureException("Could not find the launchpad jar. " + "Either specify the 'launchpadJar' configuration or use this inside a slingstart project.");
}
use of org.apache.maven.model.Dependency in project kotlin by JetBrains.
the class KotlinCompileMojoBase method getCompilerPluginClassPaths.
private List<String> getCompilerPluginClassPaths() {
ArrayList<String> result = new ArrayList<String>();
List<File> files = new ArrayList<File>();
for (Dependency dependency : mojoExecution.getPlugin().getDependencies()) {
Artifact artifact = system.createDependencyArtifact(dependency);
ArtifactResolutionResult resolved = system.resolve(new ArtifactResolutionRequest().setArtifact(artifact));
for (Artifact resolvedArtifact : resolved.getArtifacts()) {
File file = resolvedArtifact.getFile();
if (file != null && file.exists()) {
files.add(file);
}
}
}
for (File file : files) {
result.add(file.getAbsolutePath());
}
return result;
}
use of org.apache.maven.model.Dependency in project gradle by gradle.
the class MavenPomFileGenerator method addDependencyManagement.
private void addDependencyManagement(MavenDependency dependency, String scope) {
Dependency mavenDependency = new Dependency();
mavenDependency.setGroupId(dependency.getGroupId());
mavenDependency.setArtifactId(dependency.getArtifactId());
mavenDependency.setVersion(mapToMavenSyntax(dependency.getVersion()));
mavenDependency.setScope(scope);
DependencyManagement dependencyManagement = getModel().getDependencyManagement();
if (dependencyManagement == null) {
dependencyManagement = new DependencyManagement();
getModel().setDependencyManagement(dependencyManagement);
}
dependencyManagement.addDependency(mavenDependency);
}
use of org.apache.maven.model.Dependency in project drools by kiegroup.
the class AbstractKieCiTest method dependencyWithScope.
protected Dependency dependencyWithScope(String groupId, String artifactId, String version, String scope) {
Dependency dep1 = new Dependency();
dep1.setGroupId(groupId);
dep1.setArtifactId(artifactId);
dep1.setVersion(version);
dep1.setScope(scope);
return dep1;
}
Aggregations