org.codehaus.plexus.archiver.manager.ArchiverManager Java Examples

The following examples show how to use org.codehaus.plexus.archiver.manager.ArchiverManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StagerMojo.java    From helidon-build-tools with Apache License 2.0 6 votes vote down vote up
StagingContextImpl(File baseDir,
                   File outputDir,
                   Log log,
                   RepositorySystem repoSystem,
                   RepositorySystemSession repoSession,
                   List<RemoteRepository> remoteRepos,
                   ArchiverManager archiverManager) {

    this.baseDir = baseDir;
    this.outputDir = outputDir;
    this.log = log;
    this.repoSystem = repoSystem;
    this.repoSession = repoSession;
    this.remoteRepos = remoteRepos;
    this.archiverManager = Objects.requireNonNull(archiverManager, "archiverManager is null");
}
 
Example #2
Source File: AbstractGeneratorTask.java    From gradle-plugins with MIT License 5 votes vote down vote up
private MojoScanner getMojoScanner() {
    Map<String, MojoDescriptorExtractor> extractors = new TreeMap<>();
    JavaAnnotationsMojoDescriptorExtractor mojoDescriptorExtractor = new JavaAnnotationsMojoDescriptorExtractor();

    DefaultMojoAnnotationsScanner delegate = new DefaultMojoAnnotationsScanner();
    delegate.enableLogging(new PlexusLoggerWrapper(getLogger()));
    MojoAnnotationScannerWrapper mojoAnnotationsScanner = new MojoAnnotationScannerWrapper(delegate);
    mojoAnnotationsScanner.setSourceDirectories(sourceDirectories);
    mojoAnnotationsScanner.setClassesDirectories(classesDirectories);

    ArtifactResolver artifactResolver = new DefaultArtifactResolver();
    DefaultArtifactFactory artifactFactory = new DefaultArtifactFactory();
    ArchiverManager archiverManager = new DefaultArchiverManager();

    Map<String, Object> values = new HashMap<>();
    values.put("mojoAnnotationsScanner", mojoAnnotationsScanner);
    values.put("artifactResolver", artifactResolver);
    values.put("artifactFactory", artifactFactory);
    values.put("archiverManager", archiverManager);

    try {
        Class<JavaAnnotationsMojoDescriptorExtractor> clazz = JavaAnnotationsMojoDescriptorExtractor.class;
        for (Map.Entry<String, Object> entry : values.entrySet()) {
            Field declaredField = clazz.getDeclaredField(entry.getKey());
            declaredField.setAccessible(true);
            declaredField.set(mojoDescriptorExtractor, entry.getValue());
        }
    } catch (IllegalAccessException | NoSuchFieldException e) {
        throw new RuntimeException(e);
    }

    extractors.put("java-annotations", mojoDescriptorExtractor);
    DefaultMojoScanner defaultMojoScanner = new DefaultMojoScanner(extractors);
    defaultMojoScanner.enableLogging(new PlexusLoggerWrapper(getLogger()));
    return defaultMojoScanner;
}
 
Example #3
Source File: AbstractGeneratorTask.java    From gradle-plugins with MIT License 5 votes vote down vote up
private MojoScanner getMojoScanner() {
    Map<String, MojoDescriptorExtractor> extractors = new TreeMap<>();
    JavaAnnotationsMojoDescriptorExtractor mojoDescriptorExtractor = new JavaAnnotationsMojoDescriptorExtractor();

    DefaultMojoAnnotationsScanner delegate = new DefaultMojoAnnotationsScanner();
    delegate.enableLogging(new PlexusLoggerWrapper(getLogger()));
    MojoAnnotationScannerWrapper mojoAnnotationsScanner = new MojoAnnotationScannerWrapper(delegate);
    mojoAnnotationsScanner.setSourceDirectories(sourceDirectories);
    mojoAnnotationsScanner.setClassesDirectories(classesDirectories);

    ArtifactResolver artifactResolver = new DefaultArtifactResolver();
    DefaultArtifactFactory artifactFactory = new DefaultArtifactFactory();
    ArchiverManager archiverManager = new DefaultArchiverManager();

    Map<String, Object> values = new HashMap<>();
    values.put("mojoAnnotationsScanner", mojoAnnotationsScanner);
    values.put("artifactResolver", artifactResolver);
    values.put("artifactFactory", artifactFactory);
    values.put("archiverManager", archiverManager);

    try {
        Class<JavaAnnotationsMojoDescriptorExtractor> clazz = JavaAnnotationsMojoDescriptorExtractor.class;
        for (Map.Entry<String, Object> entry : values.entrySet()) {
            Field declaredField = clazz.getDeclaredField(entry.getKey());
            declaredField.setAccessible(true);
            declaredField.set(mojoDescriptorExtractor, entry.getValue());
        }
    } catch (IllegalAccessException | NoSuchFieldException e) {
        throw new RuntimeException(e);
    }

    extractors.put("java-annotations", mojoDescriptorExtractor);
    DefaultMojoScanner defaultMojoScanner = new DefaultMojoScanner(extractors);
    defaultMojoScanner.enableLogging(new PlexusLoggerWrapper(getLogger()));
    return defaultMojoScanner;
}