Example usage for org.apache.maven.repository.internal MavenAetherModule MavenAetherModule

List of usage examples for org.apache.maven.repository.internal MavenAetherModule MavenAetherModule

Introduction

In this page you can find the example usage for org.apache.maven.repository.internal MavenAetherModule MavenAetherModule.

Prototype

MavenAetherModule

Source Link

Usage

From source file:com.simpligility.maven.provisioner.DemoAetherModule.java

License:Open Source License

@Override
protected void configure() {
    install(new MavenAetherModule());
    // alternatively, use the Guice Multibindings extensions
    bind(RepositoryConnectorFactory.class).annotatedWith(Names.named("basic"))
            .to(BasicRepositoryConnectorFactory.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("file")).to(FileTransporterFactory.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("http")).to(HttpTransporterFactory.class);
}

From source file:io.fares.aether.AetherExtendedConfigurationModule.java

License:Apache License

@Override
protected void configure() {
    install(new MavenAetherModule());
    bind(RepositoryConnectorFactory.class).annotatedWith(Names.named("basic"))
            .to(BasicRepositoryConnectorFactory.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("file")).to(FileTransporterFactory.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("http")).to(HttpTransporterFactory.class);

}

From source file:io.tesla.aether.guice.maven.MavenBehaviourModule.java

License:Open Source License

public void configure(Binder binder) {
    binder.install(new MavenAetherModule());
    binder.bind(RemoteRepository.class).toProvider(MavenBehaviourRepositoryProvider.class);
    binder.bind(RepositorySystemSession.class).toProvider(MavenBehaviourSystemSessionProvider.class);
}

From source file:io.tesla.aether.guice.TeslaAetherModule.java

License:Open Source License

public void configure(Binder binder) {
    binder.install(new MavenAetherModule());
    binder.bind(ModelBuilder.class).toInstance(new DefaultModelBuilderFactory().newInstance());
    binder.bind(RemoteRepository.class).toProvider(RemoteRepositoryProvider.class);
    binder.bind(RepositorySystem.class).toProvider(RepositorySystemProvider.class);
    binder.bind(RepositorySystemSession.class).toProvider(RepositorySystemSessionProvider.class);
}

From source file:org.metaservice.core.maven.MavenPomParser.java

License:Apache License

private ModelResolver makeModelResolver() {
    try {//from  w  ww .  j  a  va  2  s.  c o  m

        Injector injector = Guice.createInjector(new MavenAetherModule(), new AbstractModule() {
            @Override
            protected void configure() {
                Multibinder<RepositoryConnectorFactory> multibinder = Multibinder.newSetBinder(binder(),
                        RepositoryConnectorFactory.class);
                multibinder.addBinding().to(FileRepositoryConnectorFactory.class);
                multibinder.addBinding().to(WagonRepositoryConnectorFactory.class);

                //fake wagon configurator
                bind(WagonConfigurator.class).toInstance(new WagonConfigurator() {
                    @Override
                    public void configure(Wagon wagon, Object configuration) throws Exception {
                    }
                });

                //fake wagon provider
                //todo test for reusage?
                bind(WagonProvider.class).toInstance(new WagonProvider() {
                    @Override
                    public Wagon lookup(String roleHint) throws Exception {
                        return new HttpWagon();
                    }

                    @Override
                    public void release(Wagon wagon) {
                    }
                });

            }
        });
        Class c = Class.forName("org.apache.maven.repository.internal.DefaultModelResolver");
        Constructor ct = c.getConstructor(new Class[] { RepositorySystemSession.class, RequestTrace.class,
                String.class, ArtifactResolver.class, RemoteRepositoryManager.class, List.class });
        ct.setAccessible(true);

        //todo handle resoultion repositories
        // maybe using standard configuration files and dynamic reading of repositories in pom?
        RemoteRepository.Builder b = new RemoteRepository.Builder("central", "default",
                "http://repo1.maven.org/maven2");

        DefaultRepositorySystemSession systemSession = MavenRepositorySystemUtils.newSession();
        systemSession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
                .newInstance(systemSession, new LocalRepository("/foo")));

        return (org.apache.maven.model.resolution.ModelResolver) ct.newInstance(systemSession, null, null,
                injector.getInstance(ArtifactResolver.class),
                injector.getInstance(RemoteRepositoryManager.class), Arrays.asList(b.build()));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:org.metaservice.manager.maven.MavenGuiceModule.java

License:Apache License

@Override
protected void configure() {
    install(new MavenAetherModule());
    // alternatively, use the Guice Multibindings extensions
    bind(RepositoryConnectorFactory.class).annotatedWith(Names.named("basic"))
            .to(BasicRepositoryConnectorFactory.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("file")).to(FileTransporterFactory.class);
    bind(TransporterFactory.class).annotatedWith(Names.named("http")).to(HttpTransporterFactory.class);
    bind(org.eclipse.aether.spi.log.LoggerFactory.class).to(Slf4jLoggerFactory.class);
}