本文整理汇总了Java中org.apache.maven.model.RepositoryPolicy.setUpdatePolicy方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryPolicy.setUpdatePolicy方法的具体用法?Java RepositoryPolicy.setUpdatePolicy怎么用?Java RepositoryPolicy.setUpdatePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.RepositoryPolicy
的用法示例。
在下文中一共展示了RepositoryPolicy.setUpdatePolicy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemoteRepositories
import org.apache.maven.model.RepositoryPolicy; //导入方法依赖的package包/类
protected List<ArtifactRepository> getRemoteRepositories()
throws Exception
{
File repoDir = new File( getBasedir(), "src/test/remote-repo" ).getAbsoluteFile();
RepositoryPolicy policy = new RepositoryPolicy();
policy.setEnabled( true );
policy.setChecksumPolicy( "ignore" );
policy.setUpdatePolicy( "always" );
Repository repository = new Repository();
repository.setId( RepositorySystem.DEFAULT_REMOTE_REPO_ID );
repository.setUrl( "file://" + repoDir.toURI().getPath() );
repository.setReleases( policy );
repository.setSnapshots( policy );
return Arrays.asList( repositorySystem.buildArtifactRepository( repository ) );
}
示例2: getRemoteRepositories
import org.apache.maven.model.RepositoryPolicy; //导入方法依赖的package包/类
protected List<ArtifactRepository> getRemoteRepositories()
throws InvalidRepositoryException
{
File repoDir = new File( getBasedir(), "src/test/remote-repo" ).getAbsoluteFile();
RepositoryPolicy policy = new RepositoryPolicy();
policy.setEnabled( true );
policy.setChecksumPolicy( "ignore" );
policy.setUpdatePolicy( "always" );
Repository repository = new Repository();
repository.setId( RepositorySystem.DEFAULT_REMOTE_REPO_ID );
repository.setUrl( "file://" + repoDir.toURI().getPath() );
repository.setReleases( policy );
repository.setSnapshots( policy );
return Arrays.asList( repositorySystem.buildArtifactRepository( repository ) );
}
示例3: convertToMavenPolicy
import org.apache.maven.model.RepositoryPolicy; //导入方法依赖的package包/类
private static RepositoryPolicy convertToMavenPolicy(MavenRepositoryPolicy policy) {
RepositoryPolicy result = new RepositoryPolicy();
result.setChecksumPolicy(policy.getChecksumPolicy());
result.setEnabled(policy.isEnabled());
result.setUpdatePolicy(policy.getUpdatePolicy());
return result;
}
示例4: getGlobalRepositoryFromPreference
import org.apache.maven.model.RepositoryPolicy; //导入方法依赖的package包/类
protected Repository getGlobalRepositoryFromPreference() {
String repoURL =
preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
GLOBAL_REPOSITORY_URL, null, null);
if (repoURL != null) {
Repository repo = new Repository();
repo.setUrl(repoURL);
repo.setId(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
GLOBAL_REPOSITORY_ID, null, null));
RepositoryPolicy releasePolicy = new RepositoryPolicy();
String releaseEnabled =
preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
RELEASES_ENABLED, null, null);
releasePolicy.setEnabled(releaseEnabled != null);
releasePolicy.setUpdatePolicy(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
RELEASES_UPDATE_POLICY, null, null));
releasePolicy.setChecksumPolicy(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
RELEASES_CHECKSUM_POLICY, null, null));
repo.setReleases(releasePolicy);
RepositoryPolicy snapshotPolicy = new RepositoryPolicy();
String snapshotsEnabled =
preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
SNAPSHOTS_ENABLED, null, null);
snapshotPolicy.setEnabled(snapshotsEnabled != null);
snapshotPolicy.setUpdatePolicy(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
SNAPSHOTS_UPDATE_POLICY, null, null));
snapshotPolicy.setChecksumPolicy(preferencesService.getString("org.wso2.developerstudio.eclipse.platform.ui",
SNAPSHOTS_CHECKSUM_POLICY, null, null));
repo.setSnapshots(snapshotPolicy);
return repo;
}
return null;
}
示例5: mergeRepositoryPolicy_UpdatePolicy
import org.apache.maven.model.RepositoryPolicy; //导入方法依赖的package包/类
protected void mergeRepositoryPolicy_UpdatePolicy( RepositoryPolicy target, RepositoryPolicy source,
boolean sourceDominant, Map<Object, Object> context )
{
String src = source.getUpdatePolicy();
if ( src != null )
{
if ( sourceDominant || target.getUpdatePolicy() == null )
{
target.setUpdatePolicy( src );
target.setLocation( "updatePolicy", source.getLocation( "updatePolicy" ) );
}
}
}
示例6: getMavenReleaseRepo
import org.apache.maven.model.RepositoryPolicy; //导入方法依赖的package包/类
public MavenRepository getMavenReleaseRepo(
String repoUrl, boolean isReleaseEnabled, boolean isSnapshotEnabled,
InputStream pomStream
) throws Exception {
//PlexusContainer container = new DefaultPlexusContainer();
//ArtifactRepositoryFactory artifactRepoFactory = container.lookup(ArtifactRepositoryFactory.class);
DeploymentRepository releaseToRepo = new DeploymentRepository();
releaseToRepo.setId("central"); //$NON-NLS-1$
releaseToRepo.setLayout("default"); //$NON-NLS-1$
releaseToRepo.setUrl(repoUrl);
RepositoryPolicy pol = new RepositoryPolicy();
pol.setEnabled(isReleaseEnabled);
pol.setUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
pol.setChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE);
releaseToRepo.setReleases(pol);
RepositoryPolicy pol2 = new RepositoryPolicy();
pol2.setEnabled(isSnapshotEnabled);
pol2.setUpdatePolicy(ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS);
pol2.setChecksumPolicy(ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE);
releaseToRepo.setSnapshots(pol2);
MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);
DistributionManagement dm = new DistributionManagement();
dm.setSnapshotRepository(releaseToRepo);
mavenProject.setDistributionManagement(dm);
//List<ArtifactRepository> remoteArtifactRepositories = new ArrayList<ArtifactRepository>();
//remoteArtifactRepositories.add(releaseToRepo);
//mavenProject.setRemoteArtifactRepositories(remoteArtifactRepositories);
//org.apache.maven.artifact.repository.Authentication authentication
// = new org.apache.maven.artifact.repository.Authentication("user","pw");
//mavenRepo.setAuthentication(authentication);
MavenRepository repo = getMavenRepository(mavenProject);
return repo;
}