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


Java Settings.getServer方法代码示例

本文整理汇总了Java中org.apache.maven.settings.Settings.getServer方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getServer方法的具体用法?Java Settings.getServer怎么用?Java Settings.getServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.settings.Settings的用法示例。


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

示例1: getAwsKeyPair

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
static AwsKeyPair getAwsKeyPair(String serverId, String awsAccessKey, String awsSecretAccessKey,
        Settings settings, SettingsDecrypter decrypter) throws MojoExecutionException {
    final AwsKeyPair keys;
    if (serverId != null) {
        Server server = settings.getServer(serverId);
        if (server == null) {
            throw new MojoExecutionException("serverId not found in settings: " + serverId);
        } else {
            SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(server);
            SettingsDecryptionResult result = decrypter.decrypt(request);
            keys = new AwsKeyPair(result.getServer().getUsername(),
                    result.getServer().getPassword());
        }
    } else {
        keys = new AwsKeyPair(awsAccessKey, awsSecretAccessKey);
    }
    return keys;
}
 
开发者ID:davidmoten,项目名称:aws-maven-plugin,代码行数:19,代码来源:Util.java

示例2: getRemoteRepoFromDeployment

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository repo,
                                                     final MavenEmbedder embedder) {
    RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(repo.getId(),
                                                                              repo.getLayout(),
                                                                              repo
                                                                                      .getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    Settings settings = MavenSettings.getSettings();
    Server server = settings.getServer(repo.getId());

    if (server != null) {
        Authentication authentication = embedder.getMavenSession().getRepositorySession()
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:DistributionManagementArtifactRepository.java

示例3: convertToArtifactRepository

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private RemoteRepository convertToArtifactRepository(final org.apache.maven.artifact.repository.ArtifactRepository artifactRepository) {
    final MavenEmbedder mavenEmbedder = MavenProjectLoader.newMavenEmbedder(MavenSettings.getSettings().isOffline());
    final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(artifactRepository.getId(),
                                                                                    artifactRepository.getLayout().getId(),
                                                                                    artifactRepository.getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    final Settings settings = MavenSettings.getSettings();
    final Server server = settings.getServer(artifactRepository.getId());

    if (server != null) {
        final Authentication authentication = mavenEmbedder
                .getMavenSession()
                .getRepositorySession()
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:ProjectRepositoryResolverImpl.java

示例4: getRemoteRepoFromDeployment

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private static RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository deploymentRepository,
                                                            final RepositorySystemSession mavenSession) {
    final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(deploymentRepository.getId(),
                                                                                    deploymentRepository.getLayout(),
                                                                                    deploymentRepository.getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    final Settings settings = MavenSettings.getSettings();
    final Server server = settings.getServer(deploymentRepository.getId());

    if (server != null) {
        final Authentication authentication = mavenSession
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:RepositoryResolverTestUtils.java

示例5: ServerCredentials

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
/**
 * Public ctor.
 * @param settings Maven settings
 * @param name Name of server ID
 * @throws MojoFailureException If some error
 */
protected ServerCredentials(@NotNull final Settings settings,
    @NotNull final String name)
    throws MojoFailureException {
    final Server server = settings.getServer(name);
    if (server == null) {
        throw new MojoFailureException(
            String.format("Server '%s' is absent in settings.xml", name)
        );
    }
    this.key = server.getUsername().trim();
    if (!this.key.matches("[A-Z0-9]{20}")) {
        throw new MojoFailureException(
            String.format(
                "Key '%s' for server '%s' is not a valid AWS key",
                this.key, name
            )
        );
    }
    this.secret = server.getPassword().trim();
    if (!this.secret.matches("[a-zA-Z0-9\\+/]{40}")) {
        throw new MojoFailureException(
            String.format(
                "Secret '%s' for server '%s' is not a valid AWS secret",
                this.secret, name
            )
        );
    }
    Logger.info(
        ServerCredentials.class,
        "Using server '%s' with AWS key '%s'",
        name, this.key
    );
}
 
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:40,代码来源:ServerCredentials.java

示例6: getServerSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public Server getServerSettings(String serverId) {
	MavenSession mavenSession = getMavenSession();
	Settings settings = mavenSession.getSettings();
	Server server = settings.getServer(serverId);
	return server;
}
 
开发者ID:link-intersystems,项目名称:maven,代码行数:7,代码来源:AbstractMavenContextMojo.java

示例7: getServer

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
/**
 * Get server credential from Maven settings by server Id.
 *
 * @param settings Maven settings object.
 * @param serverId Server Id.
 * @return Server object if it exists in settings. Otherwise return null.
 */
public static Server getServer(final Settings settings, final String serverId) {
    if (settings == null || StringUtils.isEmpty(serverId)) {
        return null;
    }
    return settings.getServer(serverId);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:14,代码来源:Utils.java


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