diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-06-18 23:01:26 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-06-18 23:01:26 +0200 |
commit | 5456b9fee0c6cf7ce585e344e3cc150ed0981bad (patch) | |
tree | 3f8f28b028df1f7a9d97402a018393061ac6eb36 | |
parent | e95c1cd27dce8c161e08b16fd865a95f8316cf63 (diff) | |
download | archiva-5456b9fee0c6cf7ce585e344e3cc150ed0981bad.tar.gz archiva-5456b9fee0c6cf7ce585e344e3cc150ed0981bad.zip |
Removing sisu bridge from maven projects
9 files changed, 74 insertions, 34 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml b/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml index 0ff32437c..29d22e62a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml +++ b/archiva-modules/archiva-maven/archiva-maven-indexer/pom.xml @@ -130,6 +130,11 @@ </exclusions> </dependency> + <dependency> + <groupId>org.eclipse.sisu</groupId> + <artifactId>org.eclipse.sisu.plexus</artifactId> + </dependency> + <dependency> <groupId>javax.inject</groupId> diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml b/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml index 383cb9519..03f3589a6 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml +++ b/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml @@ -162,6 +162,25 @@ <groupId>org.apache.maven.resolver</groupId> <artifactId>maven-resolver-spi</artifactId> </dependency> + <dependency> + <groupId>org.apache.maven.indexer</groupId> + <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + <exclusions> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.eclipse.sisu</groupId> + <artifactId>org.eclipse.sisu.plexus</artifactId> + </dependency> <dependency> <groupId>org.apache.maven.resolver</groupId> @@ -190,12 +209,12 @@ <artifactId>httpclient</artifactId> </dependency> - +<!-- <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-plexus-bridge</artifactId> </dependency> - +--> <dependency> <groupId>org.apache.archiva</groupId> @@ -251,12 +270,7 @@ <artifactId>archiva-components-spring-quartz</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.maven.indexer</groupId> - <artifactId>indexer-core</artifactId> - <classifier>shaded-lucene</classifier> - <scope>test</scope> - </dependency> + <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-core</artifactId> diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java index 3b4f51daf..a83c3e13d 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/dependency/tree/Maven3DependencyTreeBuilder.java @@ -23,8 +23,6 @@ import org.apache.archiva.admin.model.beans.NetworkProxy; import org.apache.archiva.admin.model.beans.ProxyConnector; import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.common.utils.VersionUtil; import org.apache.archiva.maven2.model.TreeEntry; import org.apache.archiva.metadata.maven.MavenMetadataReader; @@ -38,7 +36,11 @@ import org.apache.archiva.repository.metadata.RepositoryMetadataException; import org.apache.archiva.repository.metadata.base.MetadataTools; import org.apache.archiva.repository.storage.StorageAsset; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.handler.manager.DefaultArtifactHandlerManager; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; import org.apache.maven.bridge.MavenRepositorySystem; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.RepositorySystemSession; @@ -70,9 +72,6 @@ public class Maven3DependencyTreeBuilder { private Logger log = LoggerFactory.getLogger( Maven3DependencyTreeBuilder.class ); - @Inject - private PlexusSisuBridge plexusSisuBridge; - private MavenRepositorySystem mavenRepositorySystem; @Inject @@ -98,9 +97,28 @@ public class Maven3DependencyTreeBuilder @PostConstruct public void initialize() - throws PlexusSisuBridgeException + throws RuntimeException + { + try + { + mavenRepositorySystem = initMaven( ); + } + catch ( IllegalAccessException e ) + { + throw new RuntimeException( "Could not initialize maven" ); + } + } + + MavenRepositorySystem initMaven() throws IllegalAccessException { - mavenRepositorySystem = plexusSisuBridge.lookup(MavenRepositorySystem.class); + MavenRepositorySystem system = new MavenRepositorySystem( ); + DefaultArtifactHandlerManager afm = new DefaultArtifactHandlerManager( ); + DefaultRepositoryLayout layout = new DefaultRepositoryLayout( ); + FieldUtils.writeField( system, "artifactHandlerManager", afm, true); + Map<String, ArtifactRepositoryLayout> map = new HashMap<>( ); + map.put( "defaultRepositoryLayout", layout ); + FieldUtils.writeField( system, "layouts", map, true); + return system; } diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/resources/META-INF/spring-context.xml index 3b9fb1788..a01350626 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/resources/META-INF/spring-context.xml @@ -29,7 +29,7 @@ <context:annotation-config/> <context:component-scan base-package="org.apache.archiva.repository.maven.dependency.tree,org.apache.archiva.repository.maven.metadata.storage, - org.apache.archiva.repository.maven.content"/> + org.apache.archiva.repository.maven.content,org.apache.maven.index"/> diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/dependency/tree/DependencyTreeBuilderTestMaven3.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/dependency/tree/DependencyTreeBuilderTestMaven3.java index c65cfb218..c4fa8db2d 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/dependency/tree/DependencyTreeBuilderTestMaven3.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven/dependency/tree/DependencyTreeBuilderTestMaven3.java @@ -19,7 +19,6 @@ package org.apache.archiva.repository.maven.dependency.tree; */ import junit.framework.TestCase; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; @@ -49,9 +48,6 @@ public class DependencyTreeBuilderTestMaven3 @Named( "dependencyTreeBuilder#maven3" ) private Maven3DependencyTreeBuilder builder; - @Inject - private PlexusSisuBridge plexusSisuBridge; - private static final String TEST_REPO_ID = "test"; private static final String TEST_VERSION = "1.2.1"; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 3c10dcdd6..f3e8737e8 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -27,7 +27,6 @@ import org.apache.archiva.checksum.ChecksumUtil; import org.apache.archiva.checksum.StreamingChecksum; import org.apache.archiva.common.filelock.DefaultFileLockManager; import org.apache.archiva.common.filelock.FileLockManager; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.common.utils.VersionUtil; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -189,7 +188,6 @@ public class ArchivaDavResourceFactory @Inject public ArchivaDavResourceFactory( ApplicationContext applicationContext, ArchivaConfiguration archivaConfiguration ) - throws PlexusSisuBridgeException { this.archivaConfiguration = archivaConfiguration; this.applicationContext = applicationContext; diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java index a1e30da1f..450a3b92e 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java @@ -28,8 +28,6 @@ import org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator; import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.common.filelock.FileLockManager; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.FileTypes; @@ -129,9 +127,6 @@ public class ArchivaDavResourceFactoryTest ApplicationContext applicationContext; @Inject - PlexusSisuBridge plexusSisuBridge; - - @Inject DefaultManagedRepositoryAdmin defaultManagedRepositoryAdmin; @Inject @@ -239,7 +234,7 @@ public class ArchivaDavResourceFactoryTest repoRequest = repoRequestControl.createMock( MavenRepositoryRequestInfo.class ); resourceFactory = - new OverridingArchivaDavResourceFactory( applicationContext, plexusSisuBridge, archivaConfiguration ); + new OverridingArchivaDavResourceFactory( applicationContext, archivaConfiguration ); resourceFactory.setArchivaConfiguration( archivaConfiguration ); proxyRegistry.getAllHandler().get(RepositoryType.MAVEN).clear(); proxyRegistry.getAllHandler().get(RepositoryType.MAVEN).add(new OverridingRepositoryProxyHandler(this)); @@ -728,9 +723,8 @@ public class ArchivaDavResourceFactoryTest extends ArchivaDavResourceFactory { - OverridingArchivaDavResourceFactory( ApplicationContext applicationContext, PlexusSisuBridge plexusSisuBridge, + OverridingArchivaDavResourceFactory( ApplicationContext applicationContext, ArchivaConfiguration archivaConfiguration ) - throws PlexusSisuBridgeException { super( applicationContext, archivaConfiguration ); } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedDavResourceFactory.java index 0390913a8..5aadd4653 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/UnauthenticatedDavResourceFactory.java @@ -19,8 +19,6 @@ package org.apache.archiva.webdav; * under the License. */ -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.jackrabbit.webdav.DavException; import org.apache.jackrabbit.webdav.DavServletRequest; @@ -39,9 +37,8 @@ public class UnauthenticatedDavResourceFactory { @Inject - public UnauthenticatedDavResourceFactory( ApplicationContext applicationContext, PlexusSisuBridge plexusSisuBridge, + public UnauthenticatedDavResourceFactory( ApplicationContext applicationContext, ArchivaConfiguration archivaConfiguration ) - throws PlexusSisuBridgeException { super( applicationContext, archivaConfiguration ); } @@ -933,6 +933,24 @@ <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> <version>${maven3x.version}</version> + <exclusions> + <exclusion> + <groupId>com.google.inject</groupId> + <artifactId>guice</artifactId> + </exclusion> + <exclusion> + <groupId>org.eclipse.sisu</groupId> + <artifactId>org.eclipse.sisu.plexus</artifactId> + </exclusion> + <exclusion> + <groupId>org.eclipse.sisu</groupId> + <artifactId>org.eclipse.sisu.inject</artifactId> + </exclusion> + <exclusion> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> |