protected Set<String> resolveTargetLanguages(BundleSet bundleSet) throws MojoFailureException {
    Set<String> targetLanguages = bundleSet.getTargetLanguages();
    if (targetLanguages == null) {
      ServiceClient client = getServiceClient();
      String srcLang = bundleSet.getSourceLanguage();
      if (srcLang == null) {
        srcLang = "en";
      }
      // targetLanguages is not specified. Default to all available languages.
      try {
        Map<String, Set<String>> activeMTLangs = client.getConfiguredMTLanguages();
        targetLanguages = activeMTLangs.get(srcLang);
      } catch (ServiceException e) {
        targetLanguages = Collections.emptySet();
        throw new MojoFailureException("Globalization Pipeline service error", e);
      }

      getLog()
          .info(
              "The configuration parameter 'targetLanguages' is not specified."
                  + " Using currently active target languages: "
                  + targetLanguages);
    }
    return Collections.unmodifiableSet(targetLanguages);
  }