Java Code Examples for org.apache.maven.artifact.repository.MavenArtifactRepository#setLayout()

The following examples show how to use org.apache.maven.artifact.repository.MavenArtifactRepository#setLayout() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryUtils.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
public static ArtifactRepository convertFromMavenSettingsRepository(Repository repository)
{
   MavenArtifactRepository result = new MavenArtifactRepository();
   result.setId(repository.getId());
   result.setUrl(repository.getUrl());

   String layout = repository.getLayout();
   if ("default".equals(layout))
      result.setLayout(new DefaultRepositoryLayout());
   else if ("p2".equals(layout))
      result.setLayout(new P2ArtifactRepositoryLayout());

   RepositoryPolicy releases = repository.getReleases();
   if (releases != null)
      result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
               releases.getChecksumPolicy()));

   RepositoryPolicy snapshots = repository.getSnapshots();
   if (snapshots != null)
      result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
               snapshots.getUpdatePolicy(),
               snapshots.getChecksumPolicy()));

   return result;
}
 
Example 2
Source File: RepositoryUtils.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
public static ArtifactRepository toArtifactRepository(String id, String url, String layout,
         boolean containsReleases,
         boolean containsSnapshots)
{
   MavenArtifactRepository result = new MavenArtifactRepository();
   result.setId(id);
   result.setUrl(url);

   if (layout == null || layout.isEmpty() || "default".equals(layout))
   {
      result.setLayout(new DefaultRepositoryLayout());
   }
   else if ("p2".equals(layout))
   {
      result.setLayout(new P2ArtifactRepositoryLayout());
   }
   result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(containsReleases,
            ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER,
            ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN));
   result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(containsSnapshots,
            ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY,
            ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN));
   return result;

}
 
Example 3
Source File: DependencyResolver.java    From spring-init with Apache License 2.0 5 votes vote down vote up
private ArtifactRepository repo(String id, String url, boolean releases,
		boolean snapshots) {
	MavenArtifactRepository repository = new MavenArtifactRepository();
	repository.setLayout(new DefaultRepositoryLayout());
	repository.setId(id);
	repository.setUrl(url);
	ArtifactRepositoryPolicy enabled = new ArtifactRepositoryPolicy();
	enabled.setEnabled(true);
	ArtifactRepositoryPolicy disabled = new ArtifactRepositoryPolicy();
	disabled.setEnabled(false);
	repository.setReleaseUpdatePolicy(releases ? enabled : disabled);
	repository.setSnapshotUpdatePolicy(snapshots ? enabled : disabled);
	return repository;
}
 
Example 4
Source File: DependencyResolver.java    From spring-cloud-function with Apache License 2.0 5 votes vote down vote up
private ArtifactRepository repo(String id, String url, boolean releases,
		boolean snapshots) {
	MavenArtifactRepository repository = new MavenArtifactRepository();
	repository.setLayout(new DefaultRepositoryLayout());
	repository.setId(id);
	repository.setUrl(url);
	ArtifactRepositoryPolicy enabled = new ArtifactRepositoryPolicy();
	enabled.setEnabled(true);
	ArtifactRepositoryPolicy disabled = new ArtifactRepositoryPolicy();
	disabled.setEnabled(false);
	repository.setReleaseUpdatePolicy(releases ? enabled : disabled);
	repository.setSnapshotUpdatePolicy(snapshots ? enabled : disabled);
	return repository;
}