Search in sources :

Example 1 with ExclusionsDependencyFilter

use of org.eclipse.aether.util.filter.ExclusionsDependencyFilter in project grails-maven by grails.

the class AbstractGrailsMojo method resolveBuildDependencies.

protected List<File> resolveBuildDependencies() throws MojoExecutionException {
    try {
        /*
                 * Get the Grails dependencies from the plugin's POM file first.
                */
        final MavenProject pluginProject = getPluginProject();
        /*
                * Add the plugin's dependencies and the project using the plugin's dependencies to the list
                * of unresolved dependencies.  This is done so they can all be resolved at the same time so
                * that we get the benefit of Maven's conflict resolution.
                */
        Set<File> jars = new HashSet<File>();
        // calculate the Grails version to use from the dependency or grailsVersion setting
        String grailsVersion = establishGrailsVersion();
        String groovyVersion = establishGroovyVersion();
        if (grailsVersion != null) {
            String scriptsId = "org.grails:grails-scripts:" + grailsVersion;
            String bootstrapId = "org.grails:grails-bootstrap:" + grailsVersion;
            String groovyId = "org.codehaus.groovy:groovy-all:" + groovyVersion;
            jars.addAll(resolveArtifactIds(Arrays.asList(scriptsId, bootstrapId, groovyId)));
        }
        jars.addAll(resolveArtifacts(pluginProject, COMPILE_PLUS_RUNTIME_SCOPE, new ExclusionsDependencyFilter(Arrays.asList("org.grails:grails-bootstrap", "org.codehaus.groovy:groovy-all", "org.codehaus.groovy:groovy"))));
        findAndAddToolsJar(jars);
        addExtraClassPathEntries(jars);
        return new ArrayList<File>(jars);
    } catch (final Exception e) {
        throw new MojoExecutionException("Failed to create classpath for Grails execution.", e);
    }
}
Also used : ExclusionsDependencyFilter(org.eclipse.aether.util.filter.ExclusionsDependencyFilter) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) File(java.io.File) ArtifactResolutionException(org.eclipse.aether.resolution.ArtifactResolutionException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ArtifactResolutionException (org.eclipse.aether.resolution.ArtifactResolutionException)1 ExclusionsDependencyFilter (org.eclipse.aether.util.filter.ExclusionsDependencyFilter)1