use of org.apache.maven.artifact.Artifact in project jangaroo-tools by CoreMedia.
the class UnpackJarResourcesMojo method unpack.
public void unpack(File target) throws ArchiverException {
unarchiver.setOverwrite(false);
unarchiver.setFileSelectors(new FileSelector[] { new MetaInfResourcesFileSelector() });
Set<Artifact> dependencies = getArtifacts();
for (Artifact dependency : dependencies) {
getLog().debug("Dependency: " + dependency);
if (!dependency.isOptional() && "jar".equals(dependency.getType())) {
unpack(unarchiver, dependency, target);
}
}
}
use of org.apache.maven.artifact.Artifact in project kotlin by JetBrains.
the class ExecuteKotlinScriptMojo method getDependencyFile.
private File getDependencyFile(ComponentDependency dep) {
ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler(dep.getType());
Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), null, dep.getType(), null, artifactHandler);
return getArtifactFile(artifact);
}
use of org.apache.maven.artifact.Artifact in project kotlin by JetBrains.
the class ExecuteKotlinScriptMojo method getKotlinRuntimeDependencies.
private List<File> getKotlinRuntimeDependencies() throws MojoExecutionException {
Artifact stdlibDep = null;
Artifact runtimeDep = null;
ArrayList<File> files = new ArrayList<File>(2);
for (Artifact dep : project.getArtifacts()) {
if (dep.getArtifactId().equals("kotlin-stdlib")) {
files.add(getArtifactFile(dep));
stdlibDep = dep;
}
if (dep.getArtifactId().equals("kotlin-runtime")) {
files.add(getArtifactFile(dep));
runtimeDep = dep;
}
if (stdlibDep != null && runtimeDep != null)
break;
}
if (stdlibDep == null) {
throw new MojoExecutionException("Unable to find kotlin-stdlib artifacts among project dependencies");
}
return files;
}
use of org.apache.maven.artifact.Artifact in project kotlin by JetBrains.
the class ExecuteKotlinScriptMojo method getDependencyFile.
private File getDependencyFile(Dependency dep) {
ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler(dep.getType());
Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), null, dep.getType(), null, artifactHandler);
return getArtifactFile(artifact);
}
use of org.apache.maven.artifact.Artifact 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;
}
Aggregations