本文整理汇总了Java中org.eclipse.aether.impl.DefaultServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Java DefaultServiceLocator类的具体用法?Java DefaultServiceLocator怎么用?Java DefaultServiceLocator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultServiceLocator类属于org.eclipse.aether.impl包,在下文中一共展示了DefaultServiceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DummyAetherRepository
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public DummyAetherRepository(Path baseTempDir) throws IOException {
tempDir = Files.createTempDirectory(baseTempDir, getClass().getSimpleName());
try {
jaxbContext = JAXBContext.newInstance(MutableBundle.class);
} catch (JAXBException exception) {
throw new IllegalStateException("Failed to create JAXB context.", exception);
}
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
repositorySystem = locator.getService(RepositorySystem.class);
repositorySystemSession = MavenRepositorySystemUtils.newSession();
localRepository
= new LocalRepository(Files.createTempDirectory(tempDir, "maven-repo").toFile(), SIMPLE_REPOSITORY_MANAGER);
repositorySystemSession.setLocalRepositoryManager(
repositorySystem.newLocalRepositoryManager(repositorySystemSession, localRepository)
);
}
示例2: create
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public RepositorySystem create() throws Throwable{
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
locator.addService( TransporterFactory.class, FileTransporterFactory.class );
locator.addService( TransporterFactory.class, HttpTransporterFactory.class );
final List<Throwable> ecs=new ArrayList<Throwable>();
locator.setErrorHandler( new DefaultServiceLocator.ErrorHandler()
{
@Override
public void serviceCreationFailed( Class<?> type, Class<?> impl, Throwable exception )
{
ecs.add(exception);
}
} );
RepositorySystem repositorySystem=locator.getService( RepositorySystem.class );
if (!ecs.isEmpty()){
throw ecs.get(0);
}
return repositorySystem;
}
示例3: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
private RepositorySystem newRepositorySystem() {
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service
* to ease manual wiring and using the prepopulated
* DefaultServiceLocator, we only need to register the repository
* connector and transporter factories.
*/
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(final Class<?> type, final Class<?> impl, final Throwable exception) {
exception.printStackTrace();
}
});
return locator.getService(RepositorySystem.class);
}
示例4: AetherResolver
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public AetherResolver() {
localMavenRepo = System.getProperty(LOCAL_REPO_SYS_PROP, DEFAULT_MAVEN_LOCAL);
String remoteString = System.getProperty(REMOTE_REPOS_SYS_PROP, DEFAULT_MAVEN_REMOTES);
// They are space delimited (space is illegal char in urls)
remoteMavenRepos = Arrays.asList(remoteString.split(" "));
httpProxy = System.getProperty(HTTP_PROXY_SYS_PROP);
httpsProxy = System.getProperty(HTTPS_PROXY_SYS_PROP);
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, AetherRepositoryConnectorFactory.class);
locator.addService(LocalRepositoryManagerFactory.class, TakariLocalRepositoryManagerFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler()
{
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
this.repositorySystem = locator.getService(RepositorySystem.class);
}
示例5: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public static RepositorySystem newRepositorySystem ()
{
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator ();
locator.addService ( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
locator.addService ( TransporterFactory.class, FileTransporterFactory.class );
locator.addService ( TransporterFactory.class, HttpTransporterFactory.class );
locator.setErrorHandler ( new ErrorHandler () {
@Override
public void serviceCreationFailed ( final Class<?> type, final Class<?> impl, final Throwable exception )
{
final Logger logger = LoggerFactory.getLogger ( impl );
logger.warn ( "Service creation failed: " + type.getName (), exception );
}
} );
return locator.getService ( RepositorySystem.class );
}
示例6: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public static RepositorySystem newRepositorySystem ()
{
final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator ();
locator.addService ( RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class );
locator.addService ( TransporterFactory.class, FileTransporterFactory.class );
locator.addService ( TransporterFactory.class, HttpTransporterFactory.class );
locator.setErrorHandler ( new DefaultServiceLocator.ErrorHandler () {
@Override
public void serviceCreationFailed ( final Class<?> type, final Class<?> impl, final Throwable exception )
{
exception.printStackTrace ();
}
} );
return locator.getService ( RepositorySystem.class );
}
示例7: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
private static RepositorySystem newRepositorySystem()
{
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
//locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
// @Override
// public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception)
// {
// exception.printStackTrace();
// }
//});
return locator.getService(RepositorySystem.class);
}
示例8: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public RepositorySystem newRepositorySystem() {
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
* prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter
* factories.
*/
DefaultServiceLocator defaultLocator = MavenRepositorySystemUtils.newServiceLocator();
defaultLocator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
defaultLocator.addService(TransporterFactory.class, FileTransporterFactory.class);
defaultLocator.addService(TransporterFactory.class, HttpTransporterFactory.class);
defaultLocator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
return defaultLocator.getService(RepositorySystem.class);
}
示例9: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
private static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.addService(TransporterFactory.class, ClasspathTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
logger.error("", exception);
}
});
return locator.getService(RepositorySystem.class);
}
示例10: ResolverImpl
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
/**
* Creates a new instance of {@link ResolverImpl} with the given options.
*
* @param options the options
*/
public ResolverImpl(ResolverOptions options) {
String localMavenRepo = options.getLocalRepository();
List<String> remoteMavenRepos = options.getRemoteRepositories();
String httpProxy = options.getHttpProxy();
String httpsProxy = options.getHttpsProxy();
DefaultServiceLocator locator = getDefaultServiceLocator();
system = locator.getService(RepositorySystem.class);
localRepo = new LocalRepository(localMavenRepo);
Proxy proxy = getHttpProxy(httpProxy);
Proxy secureProxy = getHttpsProxy(httpsProxy);
configureRemoteRepositories(remoteMavenRepos, proxy, secureProxy);
}
示例11: ResolverImpl
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
/**
* Creates a new instance of {@link ResolverImpl} with the given options.
*
* @param options the options
*/
public ResolverImpl(ResolverOptions options) {
String localMavenRepo = options.getLocalRepository();
List<String> remoteMavenRepos = options.getRemoteRepositories();
String httpProxy = options.getHttpProxy();
String httpsProxy = options.getHttpsProxy();
remoteSnapshotPolicy = options.getRemoteSnapshotPolicy();
DefaultServiceLocator locator = getDefaultServiceLocator();
system = locator.getService(RepositorySystem.class);
localRepo = new LocalRepository(localMavenRepo);
Proxy proxy = getHttpProxy(httpProxy);
Proxy secureProxy = getHttpsProxy(httpsProxy);
configureRemoteRepositories(remoteMavenRepos, proxy, secureProxy);
}
示例12: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
static RepositorySystem newRepositorySystem() {
/*
* Aether's components implement
* org.sonatype.aether.spi.locator.Service to ease manual wiring and
* using the prepopulated DefaultServiceLocator, we only need to
* register the repository connector factories.
*/
DefaultServiceLocator locator = new DefaultServiceLocator();
locator.addService(ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class);
locator.addService(VersionResolver.class, DefaultVersionResolver.class);
locator.addService(VersionRangeResolver.class, DefaultVersionRangeResolver.class);
locator.addService(MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class);
locator.addService(MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class);
locator.setErrorHandler(new MyErrorHandler());
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
//locator.addService(TransporterFactory.class, WagonTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
return locator.getService(RepositorySystem.class);
}
示例13: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
/**
* Initializes repository system
*
* @return repository system
*/
private static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
LOGGER.error("Failed co create service {} using implementation {}", type, impl, exception);
}
});
return locator.getService(RepositorySystem.class);
}
示例14: RepositoryConnector
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
/**
* @param file
* @param system
*/
public RepositoryConnector(File baseDir) {
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
* prepopulated DefaultServiceLocator, we only need to register the repository connector and transporter
* factories.
*/
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
// locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler()
{
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
logger.error("Could not create service {}", type, exception);
}
});
system = locator.getService(RepositorySystem.class);
session = createSession(system, baseDir);
}
示例15: newRepositorySystem
import org.eclipse.aether.impl.DefaultServiceLocator; //导入依赖的package包/类
public static RepositorySystem newRepositorySystem() {
/*
* Aether's components implement org.eclipse.aether.spi.locator.Service
* to ease manual wiring and using the prepopulated
* DefaultServiceLocator, we only need to register the repository
* connector and transporter factories.
*/
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
return locator.getService(RepositorySystem.class);
}