/**
   * overwite the default builders with the builders required by RAD6.
   *
   * @param packaging packaging-type (jar,war,ejb,ear)
   */
  protected void fillDefaultBuilders(String packaging) {
    super.fillDefaultBuilders(packaging);

    ArrayList buildcommands = new ArrayList();
    if (Constants.PROJECT_PACKAGING_EAR.equals(packaging)) {
      buildcommands.add(COM_IBM_ETOOLS_VALIDATION_VALIDATIONBUILDER);
      buildcommands.add(COM_IBM_SSE_MODEL_STRUCTUREDBUILDER);
    } else if (Constants.PROJECT_PACKAGING_WAR.equals(packaging)) {
      buildcommands.add(COM_IBM_WTP_MIGRATION_MIGRATION_BUILDER);
      buildcommands.add(ORG_ECLIPSE_JDT_CORE_JAVABUILDER);
      buildcommands.add(COM_IBM_ETOOLS_J2EE_UI_LIB_DIR_BUILDER);
      buildcommands.add(COM_IBM_ETOOLS_WEBTOOLS_ADDITIONS_LINKSBUILDER);
      buildcommands.add(COM_IBM_ETOOLS_WEBPAGE_TEMPLATE_TEMPLATEBUILDER);
      buildcommands.add(COM_IBM_ETOOLS_SITEEDIT_SITE_NAV_BUILDER);
      buildcommands.add(COM_IBM_ETOOLS_SITEEDIT_SITE_UPDATE_BUILDER);
      buildcommands.add(COM_IBM_ETOOLS_VALIDATION_VALIDATIONBUILDER);
      buildcommands.add(COM_IBM_WTP_J2EE_LIB_COPY_BUILDER);
      buildcommands.add(COM_IBM_ETOOLS_WEBTOOLS_ADDITIONS_JSPCOMPILATIONBUILDER);
      buildcommands.add(COM_IBM_SSE_MODEL_STRUCTUREDBUILDER);
    } else if (Constants.PROJECT_PACKAGING_EJB.equals(packaging)) {
      buildcommands.add(ORG_ECLIPSE_JDT_CORE_JAVABUILDER);
      buildcommands.add(COM_IBM_ETOOLS_VALIDATION_VALIDATIONBUILDER);
      buildcommands.add(COM_IBM_WTP_J2EE_LIB_COPY_BUILDER);
      buildcommands.add(COM_IBM_SSE_MODEL_STRUCTUREDBUILDER);
    } else if (isJavaProject()) {
      buildcommands.add(ORG_ECLIPSE_JDT_CORE_JAVABUILDER);
      buildcommands.add(COM_IBM_SSE_MODEL_STRUCTUREDBUILDER);
    }
    setBuildcommands(buildcommands);
  }
  /**
   * make room for a Manifest file. use a generated resource for JARS and for WARS use the manifest
   * in the webapp/meta-inf directory.
   *
   * @throws MojoExecutionException
   */
  private void addManifestResource(EclipseWriterConfig config) throws MojoExecutionException {
    if (isJavaProject()) {
      // special case must be done first because it can add stuff to the classpath that will be
      // written by the superclass
      new RadManifestWriter().init(getLog(), config).write();
    }

    if (isJavaProject()
        && !Constants.PROJECT_PACKAGING_EAR.equals(packaging)
        && !Constants.PROJECT_PACKAGING_WAR.equals(packaging)
        && !Constants.PROJECT_PACKAGING_EJB.equals(packaging)
        && !NO_GENERATED_RESOURCE_DIRNAME.equals(this.generatedResourceDirName)) {

      String generatedResourceDir =
          this.project.getBasedir().getAbsolutePath()
              + File.separatorChar
              + this.generatedResourceDirName;

      String metainfDir = generatedResourceDir + File.separatorChar + "META-INF";

      new File(metainfDir).mkdirs();

      final Resource resource = new Resource();

      getLog().debug("Adding " + this.generatedResourceDirName + " to resources");

      resource.setDirectory(generatedResourceDir);

      this.executedProject.addResource(resource);
    }

    if (Constants.PROJECT_PACKAGING_WAR.equals(packaging)) {
      new File(getWebContentBaseDirectory(config) + File.separatorChar + "META-INF").mkdirs();
    }
  }
Beispiel #3
0
  /**
   * Delete all jars in the project that were required by rad6.
   *
   * @throws MojoExecutionException only if a file exists and can't be deleted
   */
  private void handleLibs() throws MojoExecutionException {
    String packaging = this.project.getPackaging();

    if (Constants.PROJECT_PACKAGING_EAR.equals(packaging)) {
      handleEarLibs();
    } else if (Constants.PROJECT_PACKAGING_WAR.equals(packaging)) {
      handleWarLibs();
    }
  }
  /**
   * overwite the default natures with the natures required by RAD6.
   *
   * @param packaging packaging-type (jar,war,ejb,ear)
   */
  protected void fillDefaultNatures(String packaging) {
    super.fillDefaultNatures(packaging);

    ArrayList projectnatures = new ArrayList();
    if (Constants.PROJECT_PACKAGING_EAR.equals(packaging)) {
      projectnatures.add(COM_IBM_WTP_J2EE_EARNATURE);
    } else if (Constants.PROJECT_PACKAGING_WAR.equals(packaging)) {
      projectnatures.add(COM_IBM_WTP_WEB_WEB_NATURE);
      projectnatures.add(ORG_ECLIPSE_JDT_CORE_JAVANATURE);
      projectnatures.add(COM_IBM_ETOOLS_SITEEDIT_WEB_SITE_NATURE);
      projectnatures.add(COM_IBM_ETOOLS_WEBPAGE_TEMPLATE_TEMPLATENATURE);
    } else if (Constants.PROJECT_PACKAGING_EJB.equals(packaging)) {
      projectnatures.add(COM_IBM_WTP_EJB_EJBNATURE);
      projectnatures.add(ORG_ECLIPSE_JDT_CORE_JAVANATURE);
    } else if (isJavaProject()) {
      projectnatures.add(ORG_ECLIPSE_JDT_CORE_JAVANATURE);
    }
    setProjectnatures(projectnatures);
  }