protected String getProductName(final String configuration, final String sdk)
      throws MojoExecutionException {

    final String productName;

    if (this.productName != null) {
      productName = this.productName;
      getLog().info("Production name obtained from pom file");
    } else {

      try {
        productName =
            EffectiveBuildSettings.getBuildSetting(
                getXCodeContext(XCodeContext.SourceCodeLocation.WORKING_COPY, configuration, sdk),
                EffectiveBuildSettings.PRODUCT_NAME);
        getLog().info("Product name obtained from effective build settings file");

      } catch (final XCodeException ex) {
        throw new MojoExecutionException("Cannot get product name: " + ex.getMessage(), ex);
      }
    }

    if (productName == null || productName.trim().length() == 0)
      throw new MojoExecutionException("Invalid product name. Was null or empty.");

    return productName;
  }
  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {

    if (bundles == null) bundles = new HashSet<String>();

    bundles.add(project.getArtifactId());

    try {

      File projectRootDir = null;
      for (String configuration : getConfigurations()) {
        for (String sdk : getSDKs()) {
          XCodeContext context =
              getXCodeContext(XCodeContext.SourceCodeLocation.WORKING_COPY, configuration, sdk);

          projectRootDir =
              context.getProjectRootDirectory(); // TODO improve, but should be each time the same
          // directory.

          new XCodePackageManager(getLog(), archiverManager, projectHelper)
              .packageHeaders(context, project, getLog());
          final File buildDir = XCodeBuildLayout.getBuildDir(projectRootDir);
          XCodePackageManager.attachLibrary(context, buildDir, project, projectHelper, getLog());
        }
      }

      new XCodePackageManager(getLog(), archiverManager, projectHelper)
          .packageArtifacts(projectRootDir, project, bundles);
    } catch (IOException ex) {
      throw new MojoExecutionException("", ex);
    } catch (XCodeException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex);
    }
  }