本文整理了Java中org.apache.maven.wagon.repository.Repository.<init>
方法的一些代码示例,展示了Repository.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.<init>
方法的具体详情如下:
包路径:org.apache.maven.wagon.repository.Repository
类名称:Repository
方法名:<init>
暂无
代码示例来源:origin: apache/maven
wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ),
proxyInfo( repository ) );
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
authenticationInfo( repository ) );
wagon.connect( new Repository( repository.getId(), repository.getUrl() ), proxyInfo( repository ) );
wagon.connect( new Repository( repository.getId(), repository.getUrl() ) );
代码示例来源:origin: apache/maven
private org.apache.maven.settings.Proxy getProxy( ArtifactRepository repository,
List<org.apache.maven.settings.Proxy> proxies )
{
if ( proxies != null && repository.getProtocol() != null )
{
for ( org.apache.maven.settings.Proxy proxy : proxies )
{
if ( proxy.isActive() && repository.getProtocol().equalsIgnoreCase( proxy.getProtocol() ) )
{
if ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) )
{
ProxyInfo pi = new ProxyInfo();
pi.setNonProxyHosts( proxy.getNonProxyHosts() );
org.apache.maven.wagon.repository.Repository repo =
new org.apache.maven.wagon.repository.Repository( repository.getId(), repository.getUrl() );
if ( !ProxyUtils.validateNonProxyHosts( pi, repo.getHost() ) )
{
return proxy;
}
}
else
{
return proxy;
}
}
}
}
return null;
}
代码示例来源:origin: stackoverflow.com
File repoDir = new File("test-git/.git");
// open the repository
Repository repo = new Repository(repoDir);
// find the HEAD
Commit head = repo.mapCommit(Constants.HEAD);
// retrieve the tree in HEAD
Tree tree = head.getTree();
// 1.2.0 api version here
// find a file (as a TreeEntry, which contains the blob object id)
TreeWalk treewalk = TreeWalk.forPath(repo, "b/test.txt", tree);
// use the blob id to read the file's data
byte[] data = repo.open(treewalk.getObjectId(0)).getBytes();
代码示例来源:origin: stackoverflow.com
File repoDir = new File("test-git");
// open the repository
Repository repository = new Repository(repoDir);
// find the HEAD
ObjectId lastCommitId = repository.resolve(Constants.HEAD);
// now we have to get the commit
RevWalk revWalk = new RevWalk(repository);
RevCommit commit = revWalk.parseCommit(lastCommitId);
// and using commit's tree find the path
RevTree tree = commit.getTree();
TreeWalk treeWalk = new TreeWalk(repository);
treeWalk.addTree(tree);
treeWalk.setRecursive(true);
treeWalk.setFilter(PathFilter.create(path));
if (!treeWalk.next()) {
return null;
}
ObjectId objectId = treeWalk.getObjectId(0);
ObjectLoader loader = repository.open(objectId);
// and then one can use either
InputStream in = loader.openStream()
// or
loader.copyTo(out)
代码示例来源:origin: stackoverflow.com
public class BitbucketService implements GitService {
@Override
public List<Repository> fetchRepositories() {
// Time consuming / IO consuming task.
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// Swallow exception.
}
List<Repository> result = new ArrayList<>();
result.add(new Repository("http://some-fancy-repository.com/"));
return result;
}
}
代码示例来源:origin: stackoverflow.com
public class GithubService implements GitService {
@Override
public List<Repository> fetchRepositories() {
// Time consuming / IO consuming task.
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// Swallow exception.
}
List<Repository> result = new ArrayList<>();
result.add(new Repository("http://some-fancier-repository.com/"));
return result;
}
}
代码示例来源:origin: stackoverflow.com
public ControllerTest {
@Test
public shouldDoTestOfShowView() {
Controller controller = new Controller();
Repository repository = new Repository();
ReflectionTestUtils.setField(controller, "repo", repository);
}
}
代码示例来源:origin: org.apache.maven.wagon/wagon-provider-test
protected Repository createFileRepository( String url )
{
File path = new File( url.substring( 7 ) );
path.mkdirs();
Repository repository = new Repository();
repository.setUrl( url );
return repository;
}
代码示例来源:origin: apache/maven-wagon
protected Repository createFileRepository( String url )
{
File path = new File( url.substring( 7 ) );
path.mkdirs();
Repository repository = new Repository();
repository.setUrl( url );
return repository;
}
代码示例来源:origin: stackoverflow.com
RevWalk rw = new RevWalk(new Repository(
new File("/path/to/git")));
RevCommit c = null;
AnyObjectId headId;
try {
headId = git.resolve(Constants.HEAD);
RevCommit root = rw.parseCommit(headId);
rw.sort(RevSort.REVERSE);
rw.markStart(root);
c = rw.next();
} catch (IOException e) {
e.printStackTrace();
}
代码示例来源:origin: stackoverflow.com
File repoDir = new File("test-git/.git");
// open the repository
Repository repo = new Repository(repoDir);
// find the HEAD
Commit head = repo.mapCommit(Constants.HEAD);
// retrieve the tree in HEAD
Tree tree = head.getTree();
// find a file (as a TreeEntry, which contains the blob object id)
TreeEntry entry = tree.findBlobMember("b/test.txt");
// use the blob id to read the file's data
byte[] data = repo.openBlob(entry.getId()).getBytes();
代码示例来源:origin: victims/maven-security-versions
public WagonHttpRepository(Log log,WagonManager wagonManager) throws ConnectionException, AuthenticationException, WagonConfigurationException, UnsupportedProtocolException {
this.log = log;
this.rep = new Repository(URL_REPO, URL_REPO);
this.w = wagonManager.getWagon(rep);
w.connect(rep, wagonManager.getProxy(rep.getProtocol()));
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-utils
public void deploy()
throws ComponentLookupException, ConnectionException, AuthenticationException, TransferFailedException,
ResourceDoesNotExistException, AuthorizationException
{
Repository repository = new Repository();
repository.setUrl( repositoryUrl );
wagon.connect( repository, getWagonAuthenticationInfo() );
wagon.put( fileToDeploy, artifactPath );
wagon.disconnect();
}
代码示例来源:origin: org.apache.maven.wagon/wagon-ssh-common-test
public void testConnect()
throws Exception
{
getWagon().connect( new Repository( "foo", getTestRepositoryUrl() ), getAuthInfo() );
assertTrue( true );
}
代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher
public void deploy()
throws ComponentLookupException, ConnectionException, AuthenticationException, TransferFailedException,
ResourceDoesNotExistException, AuthorizationException
{
Repository repository = new Repository();
repository.setUrl(repositoryUrl);
wagon.connect(repository, getWagonAuthenticationInfo());
wagon.put(fileToDeploy, artifactPath);
wagon.disconnect();
}
代码示例来源:origin: apache/maven-wagon
public void testConnect()
throws Exception
{
getWagon().connect( new Repository( "foo", getTestRepositoryUrl() ), getAuthInfo() );
assertTrue( true );
}
代码示例来源:origin: org.apache.maven.wagon/wagon-ssh-common-test
protected void setUp()
throws Exception
{
super.setUp();
source =
new Repository( "test", "scp://" + TestData.getUserName() + "@" + TestData.getHostname() + "/tmp/foo" );
wagon = (SshWagon) lookup( Wagon.ROLE, "scp" );
wagon.setInteractive( false );
this.okHostsProvider = new SingleKnownHostProvider( TestData.getHostname(), CORRECT_KEY );
this.failHostsProvider = new SingleKnownHostProvider( "beaver.codehaus.org", CORRECT_KEY );
this.changedHostsProvider = new SingleKnownHostProvider( TestData.getHostname(), CHANGED_KEY );
}
}
代码示例来源:origin: apache/maven-wagon
protected void setUp()
throws Exception
{
super.setUp();
source =
new Repository( "test", "scp://" + TestData.getUserName() + "@" + TestData.getHostname() + "/tmp/foo" );
wagon = (SshWagon) lookup( Wagon.ROLE, "scp" );
wagon.setInteractive( false );
this.okHostsProvider = new SingleKnownHostProvider( TestData.getHostname(), CORRECT_KEY );
this.failHostsProvider = new SingleKnownHostProvider( "beaver.codehaus.org", CORRECT_KEY );
this.changedHostsProvider = new SingleKnownHostProvider( TestData.getHostname(), CHANGED_KEY );
}
}
代码示例来源:origin: jcaddel/maven-s3-wagon
@Test
@Ignore
public void testPermissions() {
try {
AuthenticationInfo auth = new AuthenticationInfo();
auth.setUserName(USERNAME);
auth.setPassword(PASSWORD);
Repository repository = new Repository("kuali.release", "s3://deletemenow.kuali.org/release");
S3Wagon wagon = new S3Wagon();
wagon.connect(repository, auth);
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: jcaddel/maven-s3-wagon
@Test
@Ignore
public void testPermissions() {
try {
AuthenticationInfo auth = new AuthenticationInfo();
auth.setUserName(USERNAME);
auth.setPassword(PASSWORD);
Repository repository = new Repository("kuali.external", "s3://maven.kuali.org/external");
S3Wagon wagon = new S3Wagon();
wagon.connect(repository, auth);
} catch (Exception e) {
e.printStackTrace();
}
}
内容来源于网络,如有侵权,请联系作者删除!