org.apache.maven.plugin.resources.remote.AggregateProcessRemoteResourcesMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-remote-resources-plugin Show documentation
Show all versions of maven-remote-resources-plugin Show documentation
Process resources packaged in JARs that have been deployed to
a remote repository. The primary use case being satisfied is the consistent
inclusion of common resources in a large set of projects. Maven projects at
Apache use this plug-in to satisfy licensing requirements at Apache where
each project must include license and notice files for each release.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugin.resources.remote;
import javax.inject.Inject;
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.shared.filtering.MavenFileFilter;
import org.codehaus.plexus.resource.ResourceManager;
import org.eclipse.aether.RepositorySystem;
/**
*
* Pull down resourceBundles containing remote resources and process the resources contained inside. When that is done,
* the resources are injected into the current (in-memory) Maven project, making them available to the process-resources
* phase.
*
*
* Resources that end in ".vm" are treated as Velocity templates. For those, the ".vm" is stripped off for the final
* artifact name and it's fed through Velocity to have properties expanded, conditions processed, etc...
*
* Resources that don't end in ".vm" are copied "as is".
*/
@Mojo(
name = "aggregate",
defaultPhase = LifecyclePhase.GENERATE_RESOURCES,
aggregator = true,
requiresDependencyResolution = ResolutionScope.TEST,
threadSafe = true)
public class AggregateProcessRemoteResourcesMojo extends AbstractProcessRemoteResourcesMojo {
@Inject
public AggregateProcessRemoteResourcesMojo(
RepositorySystem repoSystem,
MavenFileFilter fileFilter,
ResourceManager locator,
ProjectBuilder projectBuilder,
ArtifactHandlerManager artifactHandlerManager) {
super(repoSystem, fileFilter, locator, projectBuilder, artifactHandlerManager);
}
@Override
protected Set getAllDependencies() {
LinkedHashSet result = new LinkedHashSet<>();
for (MavenProject mavenProject : mavenSession.getProjects()) {
result.addAll(mavenProject.getArtifacts());
}
return result;
}
@Override
protected Set getDirectDependencies() {
LinkedHashSet result = new LinkedHashSet<>();
for (MavenProject mavenProject : mavenSession.getProjects()) {
result.addAll(mavenProject.getDependencyArtifacts());
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy