Search in sources :

Example 1 with ComponentDependency

use of org.codehaus.plexus.component.repository.ComponentDependency in project intellij-community by JetBrains.

the class CustomPluginDescriptorCache method patchedClone.

private static PluginDescriptor patchedClone(PluginDescriptor pluginDescriptor) {
    if (pluginDescriptor == null)
        return null;
    PluginDescriptor clone = clone(pluginDescriptor);
    clone.setDependencies(new ArrayList<ComponentDependency>(pluginDescriptor.getDependencies()));
    return clone;
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) ComponentDependency(org.codehaus.plexus.component.repository.ComponentDependency)

Example 2 with ComponentDependency

use of org.codehaus.plexus.component.repository.ComponentDependency in project kotlin by JetBrains.

the class ExecuteKotlinScriptMojo method getThisPluginAsDependency.

private File getThisPluginAsDependency() {
    ComponentDependency dep = new ComponentDependency();
    dep.setGroupId(plugin.getGroupId());
    dep.setArtifactId(plugin.getArtifactId());
    dep.setVersion(plugin.getVersion());
    return getDependencyFile(dep);
}
Also used : ComponentDependency(org.codehaus.plexus.component.repository.ComponentDependency)

Example 3 with ComponentDependency

use of org.codehaus.plexus.component.repository.ComponentDependency in project intellij-plugins by JetBrains.

the class RepositoryReplicatorMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    final String localRepositoryBasedir = session.getLocalRepository().getBasedir();
    File localRepositoryFile = new File(localRepositoryBasedir);
    localRepositoryBasedirLength = localRepositoryBasedir.length();
    try {
        final PluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptor(session.getTopLevelProject().getPlugin("org.sonatype.flexmojos:flexmojos-maven-plugin"), session.getCurrentProject().getRemotePluginRepositories(), session.getRepositorySession());
        final File compilerLibsDirectory = new File(outputDirectory, "../build-gant/compiler-libs");
        //noinspection ResultOfMethodCallIgnored
        compilerLibsDirectory.mkdirs();
        for (ComponentDependency dependency : pluginDescriptor.getDependencies()) {
            if (dependency.getGroupId().equals("com.adobe.flex.compiler") && dependency.getType().equals("jar")) {
                final String artifactId = dependency.getArtifactId();
                if (artifactId.equals("adt") || artifactId.equals("asdoc") || artifactId.equals("digest") || artifactId.equals("fcsh") || artifactId.equals("fdb") || artifactId.equals("optimizer") || artifactId.equals("swcdepends")) {
                    continue;
                }
                copyIfLastModifiedNotEquals(new File(localRepositoryFile, "com/adobe/flex/compiler/" + artifactId + "/" + dependency.getVersion() + "/" + artifactId + "-" + dependency.getVersion() + ".jar"), new File(compilerLibsDirectory, artifactId + ".jar"));
            }
        }
    } catch (Exception e) {
        throw new MojoExecutionException("Cannot find flemxojos maven plugin", e);
    }
    if (outputDirectory.exists()) {
        try {
            FileUtils.deleteDirectory(outputDirectory);
        } catch (IOException e) {
            throw new MojoExecutionException("", e);
        }
    }
    //noinspection ResultOfMethodCallIgnored
    outputDirectory.mkdirs();
    for (MavenProject project : session.getProjects()) {
        // skip projects artifacts
        copiedArtifacts.add(project.getArtifact());
        try {
            copyProjectArtifacts(localRepositoryFile, project);
        } catch (IOException e) {
            throw new MojoExecutionException("", e);
        }
        for (Plugin plugin : project.getBuildPlugins()) {
            if (plugin.getGroupId().startsWith("org.apache.maven")) {
                continue;
            }
            try {
                resolveAndCopyArtifact(repositorySystem.createPluginArtifact(plugin));
            } catch (IOException e) {
                throw new MojoExecutionException("", e);
            }
        }
    }
    for (MavenProject project : session.getProjects()) {
        try {
            copyParentPom(project.getParent());
        } catch (IOException e) {
            throw new MojoExecutionException("", e);
        }
    }
}
Also used : PluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MavenProject(org.apache.maven.project.MavenProject) IOException(java.io.IOException) File(java.io.File) ComponentDependency(org.codehaus.plexus.component.repository.ComponentDependency) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException) Plugin(org.apache.maven.model.Plugin)

Aggregations

ComponentDependency (org.codehaus.plexus.component.repository.ComponentDependency)3 PluginDescriptor (org.apache.maven.plugin.descriptor.PluginDescriptor)2 File (java.io.File)1 IOException (java.io.IOException)1 Plugin (org.apache.maven.model.Plugin)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 MavenProject (org.apache.maven.project.MavenProject)1