|
26 | 26 | import java.util.Map; |
27 | 27 | import java.util.stream.Collectors; |
28 | 28 |
|
| 29 | +import org.osgi.framework.FrameworkUtil; |
29 | 30 | import org.osgi.service.component.annotations.Activate; |
30 | 31 | import org.osgi.service.component.annotations.Component; |
31 | 32 | import org.osgi.service.component.annotations.Deactivate; |
|
34 | 35 | import org.slf4j.LoggerFactory; |
35 | 36 |
|
36 | 37 | import com.google.inject.AbstractModule; |
| 38 | +import com.google.inject.Guice; |
| 39 | +import com.google.inject.Injector; |
37 | 40 | import com.google.inject.Module; |
38 | 41 |
|
39 | 42 | import org.eclipse.aether.repository.RemoteRepository; |
|
42 | 45 | import org.eclipse.core.runtime.IProgressMonitor; |
43 | 46 | import org.eclipse.core.runtime.NullProgressMonitor; |
44 | 47 | import org.eclipse.core.runtime.Status; |
| 48 | +import org.eclipse.sisu.space.BeanScanning; |
| 49 | +import org.eclipse.sisu.space.BundleClassSpace; |
| 50 | +import org.eclipse.sisu.space.ClassSpace; |
| 51 | +import org.eclipse.sisu.space.SpaceModule; |
| 52 | +import org.eclipse.sisu.wire.WireModule; |
45 | 53 |
|
46 | 54 | import org.codehaus.plexus.ContainerConfiguration; |
47 | 55 | import org.codehaus.plexus.DefaultContainerConfiguration; |
|
54 | 62 | import org.apache.maven.RepositoryUtils; |
55 | 63 | import org.apache.maven.archetype.catalog.Archetype; |
56 | 64 | import org.apache.maven.archetype.common.ArchetypeArtifactManager; |
| 65 | +import org.apache.maven.archetype.common.DefaultArchetypeArtifactManager; |
| 66 | +import org.apache.maven.archetype.downloader.Downloader; |
57 | 67 | import org.apache.maven.archetype.exception.UnknownArchetype; |
58 | 68 | import org.apache.maven.archetype.metadata.ArchetypeDescriptor; |
59 | 69 | import org.apache.maven.archetype.metadata.RequiredProperty; |
@@ -117,7 +127,19 @@ protected void configure() { |
117 | 127 | .setAutoWiring(true) // |
118 | 128 | .setJSR250Lifecycle(true) // |
119 | 129 | .setName("plexus"); //$NON-NLS-1$ |
| 130 | + |
| 131 | + ClassSpace space = new BundleClassSpace(FrameworkUtil.getBundle(ArchetypeArtifactManager.class)); |
| 132 | + Injector injector = Guice.createInjector(logginModule, |
| 133 | + new WireModule(new SpaceModule(space, BeanScanning.INDEX, false))); |
| 134 | + ArchetypeArtifactManager mgr1 = injector.getInstance(DefaultArchetypeArtifactManager.class); |
| 135 | + try { |
| 136 | + ArchetypeArtifactManager mgr2 = injector.getInstance(ArchetypeArtifactManager.class); |
| 137 | + } catch(Exception ex) { |
| 138 | + //TODO: doesn't work? |
| 139 | + } |
120 | 140 | container = new DefaultPlexusContainer(cc, logginModule); |
| 141 | + Downloader downloader = container.lookup(Downloader.class); |
| 142 | + //TODO: a Downloader can be created, but isn't injected into the fields of a created archetypeArtifactManager |
121 | 143 | archetypeArtifactManager = container.lookup(ArchetypeArtifactManager.class); |
122 | 144 | archetypeDataSourceMap = container.lookupMap(ArchetypeDataSource.class); |
123 | 145 | addArchetypeCatalogFactory( |
|
0 commit comments