Removing sisu bridge from maven projects

This commit is contained in:
Martin Stockhammer 2020-06-18 23:01:26 +02:00
parent e95c1cd27d
commit 5456b9fee0
9 changed files with 74 additions and 34 deletions

View File

@ -130,6 +130,11 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>

View File

@ -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>

View File

@ -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
{
mavenRepositorySystem = plexusSisuBridge.lookup(MavenRepositorySystem.class);
try
{
mavenRepositorySystem = initMaven( );
}
catch ( IllegalAccessException e )
{
throw new RuntimeException( "Could not initialize maven" );
}
}
MavenRepositorySystem initMaven() throws IllegalAccessException
{
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;
}

View File

@ -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"/>

View File

@ -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";

View File

@ -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;

View File

@ -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;
@ -128,9 +126,6 @@ public class ArchivaDavResourceFactoryTest
@Inject
ApplicationContext applicationContext;
@Inject
PlexusSisuBridge plexusSisuBridge;
@Inject
DefaultManagedRepositoryAdmin defaultManagedRepositoryAdmin;
@ -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 );
}

View File

@ -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 );
}

18
pom.xml
View File

@ -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>