Example #1
0
 public RepositoryPolicy toRepositoryPolicy() {
   RepositoryPolicy result = new RepositoryPolicy();
   result.setEnabled(myEnabled);
   result.setUpdatePolicy(myUpdatePolicy);
   result.setChecksumPolicy(myChecksumPolicy);
   return result;
 }
Example #2
0
 public static org.apache.maven.model.RepositoryPolicy fromSettingsRepositoryPolicy(
     org.apache.maven.settings.RepositoryPolicy settingsRepositoryPolicy) {
   org.apache.maven.model.RepositoryPolicy modelRepositoryPolicy =
       new org.apache.maven.model.RepositoryPolicy();
   if (settingsRepositoryPolicy != null) {
     modelRepositoryPolicy.setEnabled(settingsRepositoryPolicy.isEnabled());
     modelRepositoryPolicy.setUpdatePolicy(settingsRepositoryPolicy.getUpdatePolicy());
     modelRepositoryPolicy.setChecksumPolicy(settingsRepositoryPolicy.getChecksumPolicy());
   }
   return modelRepositoryPolicy;
 }
  public void updatePom() throws Exception {
    File mavenProjectPomLocation = project.getFile("pom.xml").getLocation().toFile();
    MavenProject mavenProject = MavenUtils.getMavenProject(mavenProjectPomLocation);

    boolean pluginExists =
        MavenUtils.checkOldPluginEntry(
            mavenProject,
            "org.wso2.maven",
            "wso2-esb-template-plugin",
            MavenConstants.WSO2_ESB_TEMPLATE_VERSION);
    if (pluginExists) {
      return;
    }

    Plugin plugin =
        MavenUtils.createPluginEntry(
            mavenProject,
            "org.wso2.maven",
            "wso2-esb-template-plugin",
            MavenConstants.WSO2_ESB_TEMPLATE_VERSION,
            true);

    PluginExecution pluginExecution = new PluginExecution();
    pluginExecution.addGoal("pom-gen");
    pluginExecution.setPhase("process-resources");
    pluginExecution.setId("template");

    Xpp3Dom configurationNode = MavenUtils.createMainConfigurationNode();
    Xpp3Dom artifactLocationNode = MavenUtils.createXpp3Node(configurationNode, "artifactLocation");
    artifactLocationNode.setValue(".");
    Xpp3Dom typeListNode = MavenUtils.createXpp3Node(configurationNode, "typeList");
    typeListNode.setValue("${artifact.types}");
    pluginExecution.setConfiguration(configurationNode);

    plugin.addExecution(pluginExecution);
    Repository repo = new Repository();
    repo.setUrl("http://maven.wso2.org/nexus/content/groups/wso2-public/");
    repo.setId("wso2-nexus");

    RepositoryPolicy releasePolicy = new RepositoryPolicy();
    releasePolicy.setEnabled(true);
    releasePolicy.setUpdatePolicy("daily");
    releasePolicy.setChecksumPolicy("ignore");

    repo.setReleases(releasePolicy);

    if (!mavenProject.getRepositories().contains(repo)) {
      mavenProject.getModel().addRepository(repo);
      mavenProject.getModel().addPluginRepository(repo);
    }

    MavenUtils.saveMavenProject(mavenProject, mavenProjectPomLocation);
  }
Example #4
0
  public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy(
      org.apache.maven.model.RepositoryPolicy policy) {
    boolean enabled = true;

    String updatePolicy = null;

    String checksumPolicy = null;

    if (policy != null) {
      enabled = policy.isEnabled();

      if (policy.getUpdatePolicy() != null) {
        updatePolicy = policy.getUpdatePolicy();
      }
      if (policy.getChecksumPolicy() != null) {
        checksumPolicy = policy.getChecksumPolicy();
      }
    }

    return new ArtifactRepositoryPolicy(enabled, updatePolicy, checksumPolicy);
  }
Example #5
0
 public Policy(RepositoryPolicy policy) {
   myEnabled = policy.isEnabled();
   myUpdatePolicy = policy.getUpdatePolicy();
   myChecksumPolicy = policy.getChecksumPolicy();
 }