Repository Management with Nexus
21.10. Defining Custom Repository Types

When you need to introduce a custom repository type, you should implement the Repository interface. The following example extends the HostedRepository class and adds a repository type with the path prefix "sample".
Creating a Custom Repository Type Interface.
package org.sample.plugin;
import org.sonatype.nexus.plugins.RepositoryType;
import org.sonatype.nexus.proxy.repository.HostedRepository;
@RepositoryType( pathPrefix="sample" )
public interface SampleRepository extends HostedRepository {
String boo();
}
If you want to implement a custom repository type, you should reference the nexus-proxy module as dependency which contains the AbstractRepository class which is a useful super-class for repository implementations. To implement the SampleRepository interface, you can then extend the AbstractRepository as shown in the following example.
Creating a Custom Repository Type Implementation.
package org.sample.plugin;
public class DefaultSampleRepository extends AbstractRepository
implements SampleRepository {
.... implement it
}
Your newly introduced repository type will appear under http://localhost:8081/nexus/content/sample/.
