Example usage for org.apache.maven.repository.legacy.resolver.transform ArtifactTransformationManager getArtifactTransformations

List of usage examples for org.apache.maven.repository.legacy.resolver.transform ArtifactTransformationManager getArtifactTransformations

Introduction

In this page you can find the example usage for org.apache.maven.repository.legacy.resolver.transform ArtifactTransformationManager getArtifactTransformations.

Prototype

List<ArtifactTransformation> getArtifactTransformations();

Source Link

Usage

From source file:org.fusesource.mop.MOPRepository.java

License:Open Source License

@SuppressWarnings("unchecked")
public PlexusContainer getContainer() {
    if (container == null) {
        try {//from w ww . j  a  v  a  2  s .c om
            //Map commons logging to plexus log level:
            int plexusLogLevel = org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
            if (Logger.isDebug()) {
                plexusLogLevel = org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
            }

            ClassWorld classWorld = new ClassWorld("plexus.core",
                    Thread.currentThread().getContextClassLoader());
            ContainerConfiguration configuration = new DefaultContainerConfiguration()
                    .setClassWorld(classWorld);
            container = new DefaultPlexusContainer(configuration);
            container.getLoggerManager().setThreshold(plexusLogLevel);

            try {
                ArtifactTransformationManager transformer;
                transformer = (ArtifactTransformationManager) getContainer()
                        .lookup(ArtifactTransformationManager.class);
                LocalSnapshotArtifactTransformation transform = new LocalSnapshotArtifactTransformation();
                transform.setLocalRepoId(RepositorySystem.DEFAULT_LOCAL_REPO_ID);
                transformer.getArtifactTransformations().add(transform);
            } catch (ComponentLookupException e) {
                warn("Error setting local snaphost resolution transformer, your .m2 snapshot updates may not be resolved correctly!",
                        e);
            }

        } catch (PlexusContainerException e) {
            throw new RuntimeException(e);
        }
    }
    return container;
}