当前位置: 首页>>代码示例>>Java>>正文


Java LocalRepository类代码示例

本文整理汇总了Java中org.sonatype.aether.repository.LocalRepository的典型用法代码示例。如果您正苦于以下问题:Java LocalRepository类的具体用法?Java LocalRepository怎么用?Java LocalRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LocalRepository类属于org.sonatype.aether.repository包,在下文中一共展示了LocalRepository类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newRepositorySystemSession

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public static RepositorySystemSession newRepositorySystemSession(
    RepositorySystem system, String localRepoPath) {
  Validate.notNull(localRepoPath, "localRepoPath should have a value");

  MavenRepositorySystemSession session = new MavenRepositorySystemSession();

  LocalRepository localRepo = new LocalRepository(resolveLocalRepoPath(localRepoPath));
  session.setLocalRepositoryManager(system.newLocalRepositoryManager(localRepo));

  if (logger.isDebugEnabled()) {
    session.setTransferListener(new TransferListener());
    session.setRepositoryListener(new RepositoryListener());
  }
  // uncomment to generate dirty trees
  // session.setDependencyGraphTransformer( null );

  return session;
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:19,代码来源:Booter.java

示例2: format

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
private static String format( LocalRepository localRepository, List<RemoteRepository> remoteRepositories )
{
    String repos = "[";

    if ( localRepository != null )
    {
        repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
    }

    if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
    {
        for ( RemoteRepository repository : remoteRepositories )
        {
            repos += ", ";

            if ( repository != null )
            {
                repos += repository.getId() + " (" + repository.getUrl() + ")";
            }
        }
    }

    repos += "]";

    return repos;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:NoPluginFoundForPrefixException.java

示例3: newRepositorySystemSession

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public static RepositorySystemSession newRepositorySystemSession(
    RepositorySystem system, String localRepoPath) {
  MavenRepositorySystemSession session = new MavenRepositorySystemSession();

  // find homedir
  String home = System.getenv("ZEPPELIN_HOME");
  if (home == null) {
    home = System.getProperty("zeppelin.home");
  }
  if (home == null) {
    home = "..";
  }

  String path = home + "/" + localRepoPath;

  LocalRepository localRepo =
      new LocalRepository(new File(path).getAbsolutePath());
  session.setLocalRepositoryManager(system.newLocalRepositoryManager(localRepo));

  // session.setTransferListener(new ConsoleTransferListener());
  // session.setRepositoryListener(new ConsoleRepositoryListener());

  // uncomment to generate dirty trees
  // session.setDependencyGraphTransformer( null );

  return session;
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:28,代码来源:Booter.java

示例4: newRepositorySystemSession

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public static RepositorySystemSession newRepositorySystemSession( RepositorySystem system, File localRepoDir )
{
    MavenRepositorySystemSession session = new MavenRepositorySystemSession();

    LocalRepository localRepo = new LocalRepository(localRepoDir);
    session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );

    session.setTransferListener( new TransferListener() );
    session.setRepositoryListener( new RepositoryListener() );

    return session;
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:13,代码来源:MavenClasspathBuilder.java

示例5: newMavenRepositorySystemSession

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system )
{
    MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );

    LocalRepository localRepo = new LocalRepository( "target/local-repo" );
    session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );

    session.setTransferListener( new ConsoleTransferListener() );
    session.setRepositoryListener( new ConsoleRepositoryListener() );

    return session;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:13,代码来源:AbstractRepositoryTestCase.java

示例6: PluginVersionResolutionException

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public PluginVersionResolutionException( String groupId, String artifactId, LocalRepository localRepository,
                                         List<RemoteRepository> remoteRepositories, String baseMessage )
{
    super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\' from the repositories "
        + format( localRepository, remoteRepositories ) + ": " + baseMessage );

    this.groupId = groupId;
    this.artifactId = artifactId;
    this.baseMessage = baseMessage;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:11,代码来源:PluginVersionResolutionException.java

示例7: LegacyLocalRepositoryManager

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
private LegacyLocalRepositoryManager( ArtifactRepository delegate )
{
    if ( delegate == null )
    {
        throw new IllegalArgumentException( "local repository delegate missing" );
    }
    this.delegate = delegate;

    ArtifactRepositoryLayout layout = delegate.getLayout();
    repo =
        new LocalRepository( new File( delegate.getBasedir() ),
                             ( layout != null ) ? layout.getClass().getSimpleName() : "legacy" );

    /*
     * NOTE: "invoker:install" vs "appassembler:assemble": Both mojos use the artifact installer to put an artifact
     * into a repository. In the first case, the result needs to be a proper local repository that one can use for
     * local artifact resolution. In the second case, the result needs to precisely obey the path information of the
     * repository's layout to allow pointing at artifacts within the repository. Unfortunately,
     * DefaultRepositoryLayout does not correctly describe the layout of a local repository which unlike a remote
     * repository never uses timestamps in the filename of a snapshot artifact. The discrepancy gets notable when a
     * remotely resolved snapshot artifact gets passed into pathOf(). So producing a proper local artifact path
     * using DefaultRepositoryLayout requires us to enforce usage of the artifact's base version. This
     * transformation however contradicts the other use case of precisely obeying the repository's layout. The below
     * flag tries to detect which use case applies to make both plugins happy.
     */
    realLocalRepo = ( layout instanceof DefaultRepositoryLayout ) && "local".equals( delegate.getId() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:28,代码来源:LegacyLocalRepositoryManager.java

示例8: main

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public static void main(String[] args) throws DependencyResolutionException {
    Injector injector = Guice.createInjector(
        new RepositorySystemModule() {
            @Override
            public List<RemoteRepository> getRemoteRepositories(ExtensionList<RemoteRepositoryDecorator> decorators) {
                try {
                    List<RemoteRepository> repos = super.getRemoteRepositories(decorators);

                    // use our real local repository as one of the remote repositories,
                    // so that this process runs quickly.
                    File local = new File(new File(System.getProperty("user.home")), ".m2/repository");
                    repos.add(0,new RemoteRepository("local","default",local.toURL().toExternalForm()));

                    repos.add(new RemoteRepository("repo.jenkins-ci.org","default","http://repo.jenkins-ci.org/public/"));
                    return repos;
                } catch (MalformedURLException e) {
                    throw new Error(e);
                }
            }
        }
    );

    // we tell Aether that our local repository is elsewhere, so that we can capture everything
    File dir = new File(args[0]);
    dir.mkdirs();
    injector.getInstance(LocalRepositorySetting.class).set(
            new LocalRepository(dir));

    // resolve away
    RepositoryService rs = injector.getInstance(RepositoryService.class);
    DependencyResult result = rs.resolveDependencies(
            new GAV(BeesLoader.MAIN.groupId, BeesLoader.MAIN.artifactId, args[1]));

    // generate maven-metadata.xml files. necessary for resolving LATEST version label.
    for (ArtifactResult ar : result.getArtifactResults()) {
        writeMetadata(ar.getArtifact(),dir);
    }
}
 
开发者ID:ndeloof,项目名称:bees-cli-bootstrap,代码行数:39,代码来源:Assembler.java

示例9: configure

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
@Override
protected void configure() {
    // NettyAsyncHttpProvider prints some INFO-level messages. suppress them
    Logger.getLogger("com.ning.http.client.providers.netty.NettyAsyncHttpProvider").setLevel(Level.WARNING);
    LoggerFactory.getLogger(NettyAsyncHttpProvider.class);

    bind(LocalRepository.class).toProvider(LocalRepositorySetting.class);
    bind(MavenRepositorySystemSession.class).toProvider(MavenRepositorySystemSessionFactory.class);
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:10,代码来源:RepositorySystemModule.java

示例10: readVersions

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
                                 ArtifactRepository repository, VersionResult result )
{
    Versioning versioning = null;

    FileInputStream fis = null;
    try
    {
        if ( metadata != null )
        {
            SyncContext syncContext = syncContextFactory.newInstance( session, true );

            try
            {
                syncContext.acquire( null, Collections.singleton( metadata ) );

                if ( metadata.getFile() != null && metadata.getFile().exists() )
                {
                    fis = new FileInputStream( metadata.getFile() );
                    org.apache.maven.artifact.repository.metadata.Metadata m =
                        new MetadataXpp3Reader().read( fis, false );
                    versioning = m.getVersioning();

                    /*
                     * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata
                     * of the local repository. This is especially troublesome during snapshot resolution so we try
                     * to handle that gracefully.
                     */
                    if ( versioning != null && repository instanceof LocalRepository)
                    {
                        if ( versioning.getSnapshot() != null && versioning.getSnapshot().getBuildNumber() > 0 )
                        {
                            Versioning repaired = new Versioning();
                            repaired.setLastUpdated( versioning.getLastUpdated() );
                            Snapshot snapshot = new Snapshot();
                            snapshot.setLocalCopy( true );
                            repaired.setSnapshot( snapshot );
                            versioning = repaired;

                            throw new IOException( "Snapshot information corrupted with remote repository data"
                                + ", please verify that no remote repository uses the id '" + repository.getId()
                                + "'" );
                        }
                    }
                }
            }
            finally
            {
                syncContext.release();
            }
        }
    }
    catch ( Exception e )
    {
        invalidMetadata( session, trace, metadata, repository, e );
        result.addException( e );
    }
    finally
    {
        IOUtil.close(fis);
    }

    return ( versioning != null ) ? versioning : new Versioning();
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:65,代码来源:VersionResolverImpl.java

示例11: readVersions

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
                                 ArtifactRepository repository, VersionResult result )
{
    Versioning versioning = null;

    FileInputStream fis = null;
    try
    {
        if ( metadata != null )
        {
            SyncContext syncContext = syncContextFactory.newInstance( session, true );

            try
            {
                syncContext.acquire( null, Collections.singleton( metadata ) );

                if ( metadata.getFile() != null && metadata.getFile().exists() )
                {
                    fis = new FileInputStream( metadata.getFile() );
                    org.apache.maven.artifact.repository.metadata.Metadata m =
                        new MetadataXpp3Reader().read( fis, false );
                    versioning = m.getVersioning();

                    /*
                     * NOTE: Users occasionally misuse the id "local" for remote repos which screws up the metadata
                     * of the local repository. This is especially troublesome during snapshot resolution so we try
                     * to handle that gracefully.
                     */
                    if ( versioning != null && repository instanceof LocalRepository )
                    {
                        if ( versioning.getSnapshot() != null && versioning.getSnapshot().getBuildNumber() > 0 )
                        {
                            Versioning repaired = new Versioning();
                            repaired.setLastUpdated( versioning.getLastUpdated() );
                            Snapshot snapshot = new Snapshot();
                            snapshot.setLocalCopy( true );
                            repaired.setSnapshot( snapshot );
                            versioning = repaired;

                            throw new IOException( "Snapshot information corrupted with remote repository data"
                                + ", please verify that no remote repository uses the id '" + repository.getId()
                                + "'" );
                        }
                    }
                }
            }
            finally
            {
                syncContext.release();
            }
        }
    }
    catch ( Exception e )
    {
        invalidMetadata( session, trace, metadata, repository, e );
        result.addException( e );
    }
    finally
    {
        IOUtil.close( fis );
    }

    return ( versioning != null ) ? versioning : new Versioning();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:65,代码来源:DefaultVersionResolver.java

示例12: NoPluginFoundForPrefixException

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public NoPluginFoundForPrefixException( String prefix, List<String> pluginGroups, LocalRepository localRepository,
                                        List<RemoteRepository> remoteRepositories )
{
    super( "No plugin found for prefix '" + prefix + "' in the current project and in the plugin groups "
        + pluginGroups + " available from the repositories " + format( localRepository, remoteRepositories ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:7,代码来源:NoPluginFoundForPrefixException.java

示例13: getRepository

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public LocalRepository getRepository()
{
    return repo;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:LegacyLocalRepositoryManager.java

示例14: set

import org.sonatype.aether.repository.LocalRepository; //导入依赖的package包/类
public void set(LocalRepository localRepository) {
    this.localRepository = localRepository;
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:4,代码来源:LocalRepositorySetting.java


注:本文中的org.sonatype.aether.repository.LocalRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。