/**
   * Test that POM interpolation uses the property values from the dominant profile source (POM vs.
   * profiles.xml vs. settings.xml). This boils down to the proper order of profile injection and
   * interpolation, i.e. interpolate after profiles from all sources are injected.
   */
  public void testitMNG4107() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4107");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.addCliOption("--settings");
    verifier.addCliOption("settings.xml");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    Properties props = verifier.loadProperties("target/pom.properties");

    assertEquals("applied", props.getProperty("project.properties.pomProfile"));
    assertEquals("applied", props.getProperty("project.properties.settingsProfile"));
    assertEquals("settings", props.getProperty("project.properties.pomVsSettings"));
    assertEquals("settings", props.getProperty("project.properties.pomVsSettingsInterpolated"));

    if (matchesVersionRange("(,3.0-alpha-1)")) {
      // MNG-4060, profiles.xml support dropped
      assertEquals("applied", props.getProperty("project.properties.profilesProfile"));
      assertEquals("profiles", props.getProperty("project.properties.pomVsProfiles"));
      assertEquals("profiles", props.getProperty("project.properties.pomVsProfilesInterpolated"));
      assertEquals("settings", props.getProperty("project.properties.profilesVsSettings"));
      assertEquals(
          "settings", props.getProperty("project.properties.profilesVsSettingsInterpolated"));
    }
  }
  /**
   * Verify that a project-level plugin dependency class/resource can be loaded from both the plugin
   * classloader and the context classloader available to the plugin.
   */
  public void testit0087() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/it0087");
    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.deleteArtifacts("org.apache.maven.its.it0087");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    verifier.addCliOption("--settings");
    verifier.addCliOption("settings.xml");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    Properties pclProps = verifier.loadProperties("target/pcl.properties");
    assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassA"));
    assertNotNull(pclProps.getProperty("org.apache.maven.plugin.coreit.ClassB"));
    assertNotNull(pclProps.getProperty("org.apache.maven.its.it0087.IT0087"));
    assertNotNull(pclProps.getProperty("src/main/java/org/apache/maven/its/it0087/IT0087.java"));
    assertEquals(
        "1", pclProps.getProperty("src/main/java/org/apache/maven/its/it0087/IT0087.java.count"));

    Properties tcclProps = verifier.loadProperties("target/tccl.properties");
    assertEquals(pclProps, tcclProps);
  }
  /** Test that the CLI parameter -l can be used to direct logging to a file. */
  public void testit() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-3183");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.addCliOption("-l");
    verifier.addCliOption("maven.log");
    verifier.setLogFileName("stdout.txt");
    new File(testDir, "stdout.txt").delete();
    new File(testDir, "maven.log").delete();
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    List<String> stdout = verifier.loadLines("stdout.txt", "UTF-8");

    for (Iterator<String> it = stdout.iterator(); it.hasNext(); ) {
      String line = it.next();
      if (line.startsWith("+") || line.startsWith("EMMA")) {
        it.remove();
      }
    }

    assertEquals(Collections.EMPTY_LIST, stdout);

    List<String> log = verifier.loadLines("maven.log", "UTF-8");

    assertFalse(log.isEmpty());
  }
  /**
   * Verify that overriding a transitive compile time dependency as provided in a WAR ensures it is
   * not included.
   */
  public void testitMNG1233() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-1233");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.deleteArtifacts("org.apache.maven.its.it0083");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    verifier.addCliOption("--settings");
    verifier.addCliOption("settings.xml");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    Collection<String> compileArtifacts = verifier.loadLines("target/compile.txt", "UTF-8");
    assertTrue(
        compileArtifacts.toString(),
        compileArtifacts.contains("org.apache.maven.its.it0083:direct-dep:jar:0.1"));
    assertTrue(
        compileArtifacts.toString(),
        compileArtifacts.contains("org.apache.maven.its.it0083:trans-dep:jar:0.1"));

    Collection<String> runtimeArtifacts = verifier.loadLines("target/runtime.txt", "UTF-8");
    assertTrue(
        runtimeArtifacts.toString(),
        runtimeArtifacts.contains("org.apache.maven.its.it0083:direct-dep:jar:0.1"));
    assertFalse(
        runtimeArtifacts.toString(),
        runtimeArtifacts.contains("org.apache.maven.its.it0083:trans-dep:jar:0.1"));
  }
  /**
   * Verify that dependency resolution prefers newer local snapshots over outdated remote snapshots
   * that use the new metadata format.
   */
  public void testit() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4955");

    Verifier verifier = newVerifier(new File(testDir, "dep").getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.deleteArtifacts("org.apache.maven.its.mng4955");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.addCliOption("-s");
    verifier.addCliOption("settings.xml");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    List<String> classpath = verifier.loadLines("target/classpath.txt", "UTF-8");

    File jarFile = new File(classpath.get(1).toString());
    assertEquals("eeff09b1b80e823eeb2a615b1d4b09e003e86fd3", ItUtils.calcHash(jarFile, "SHA-1"));
  }
 private void configureProcessor(ProcessorTestCase child, Verifier verifier) {
   if (child.processor.getCompilerId() != null) {
     verifier.addCliOption("-Pgenerate-via-compiler-plugin");
     verifier.addCliOption("-Dcompiler-id=" + child.processor.getCompilerId());
   } else {
     verifier.addCliOption("-Pgenerate-via-processor-plugin");
   }
 }
  private void doExecute(ProcessorTestCase child, Description description) throws Exception {
    File destination = extractTest(child, description);
    PrintStream originalOut = System.out;

    final Verifier verifier;
    if (Boolean.getBoolean(SYS_PROP_DEBUG)) {
      if (child.processor.getToolchain() == null) {
        // when not using toolchains for a test, then the compiler is executed within the Maven JVM.
        // So make
        // sure we fork a new JVM for that, and let that new JVM use the command 'mvnDebug' instead
        // of 'mvn'
        verifier = new Verifier(destination.getCanonicalPath(), null, true, true);
        verifier.setDebugJvm(true);
      } else {
        verifier = new Verifier(destination.getCanonicalPath());
        verifier.addCliOption("-Pdebug-forked-javac");
      }
    } else {
      verifier = new Verifier(destination.getCanonicalPath());
    }

    List<String> goals = new ArrayList<String>(3);

    goals.add("clean");

    try {
      configureToolchains(child, verifier, goals, originalOut);
      configureProcessor(child, verifier);

      verifier.addCliOption(
          "-Dcompiler-source-target-version=" + child.processor.getSourceTargetVersion());

      if ("1.8".equals(child.processor.getSourceTargetVersion())
          || "1.9".equals(child.processor.getSourceTargetVersion())) {
        verifier.addCliOption("-Dmapstruct-artifact-id=mapstruct-jdk8");
      } else {
        verifier.addCliOption("-Dmapstruct-artifact-id=mapstruct");
      }

      if (Boolean.getBoolean(SYS_PROP_DEBUG)) {
        originalOut.print("Processor Integration Test: ");
        originalOut.println("Listening for transport dt_socket at address: 8000 (in some seconds)");
      }

      goals.add("test");

      addAdditionalCliArguments(child, verifier);

      originalOut.println("executing " + child.processor.name().toLowerCase());

      verifier.executeGoals(goals);
      verifier.verifyErrorFreeLog();
    } finally {
      verifier.resetStreams();
    }
  }
  private void configureToolchains(
      ProcessorTestCase child, Verifier verifier, List<String> goals, PrintStream originalOut) {
    if (child.processor.getToolchain() != null) {
      verifier.addCliOption("--toolchains");
      verifier.addCliOption(TOOLCHAINS_FILE.getPath().replace('\\', '/'));

      Toolchain toolchain = child.processor.getToolchain();

      verifier.addCliOption("-Dtoolchain-jdk-vendor=" + toolchain.getVendor());
      verifier.addCliOption("-Dtoolchain-jdk-version=" + toolchain.getVersionRangeString());

      goals.add("toolchains:toolchain");
    }
  }
  @Test
  public void testPomlessBuildExtension() throws Exception {
    Verifier verifier = getVerifier("testsetversionpomless", false);
    String newVersion = "2.0.0";
    verifier.addCliOption("-DnewVersion=" + newVersion);
    verifier.executeGoal(
        "org.eclipse.tycho:tycho-versions-plugin:" + getTychoVersion() + ":set-version");
    verifier.verifyErrorFreeLog();
    File baseDir = new File(verifier.getBasedir());

    PomFile rootPom = PomFile.read(new File(baseDir, "pom.xml"), false);
    Assert.assertEquals(newVersion, rootPom.getVersion());

    DefaultBundleReader reader = new DefaultBundleReader();
    OsgiManifest bundleManifest =
        reader.loadManifest(new File(baseDir, "bundle1/META-INF/MANIFEST.MF"));
    Assert.assertEquals(newVersion, bundleManifest.getBundleVersion());

    OsgiManifest testBundleManifest =
        reader.loadManifest(new File(baseDir, "bundle1.tests/META-INF/MANIFEST.MF"));
    Assert.assertEquals(newVersion, testBundleManifest.getBundleVersion());

    Feature feature = Feature.read(new File(baseDir, "feature/feature.xml"));
    Assert.assertEquals(newVersion, feature.getVersion());
  }
Esempio n. 10
0
  /**
   * tests the goal "package" after installing the archetype.
   *
   * @throws Exception
   */
  public void testPackage() throws Exception {
    final Verifier verifier = this.getPhpMavenVerifier("archetypes/doctrine");
    this.installArchetypes();

    verifier.addCliOption("-DarchetypeGroupId=org.phpmaven");
    verifier.addCliOption("-DarchetypeArtifactId=php5-doctrine-archetype");
    verifier.addCliOption("-DarchetypeVersion=2.0-SNAPSHOT");
    verifier.addCliOption("-DgroupId=org.sample");
    verifier.addCliOption("-DartifactId=my-app");
    verifier.addCliOption("-Dversion=0.0.1-SNAPSHOT");
    verifier.addCliOption("-DinteractiveMode=false");

    verifier.executeGoal("archetype:generate");
    verifier.verifyErrorFreeLog();

    verifier.assertFilePresent("my-app/pom.xml");
    verifier.assertFilePresent("my-app/src/main/php/MyApp/Entities/MyModel.php");
    verifier.assertFilePresent("my-app/src/main/php/bootstrap_doctrine.php");
    verifier.assertFilePresent("my-app/src/main/php/bootstrap.php");
    verifier.assertFilePresent("my-app/src/main/php/cli-config.php");
    verifier.assertFilePresent("my-app/src/main/php/cli-tools.php");
    verifier.assertFilePresent("my-app/src/main/php/my-app.php");
    verifier.assertFilePresent("my-app/src/main/resources/config/doctrine.ini");
    verifier.assertFilePresent("my-app/src/site/apt/index.apt");
    verifier.assertFilePresent("my-app/src/site/site.xml");

    final Verifier verifier2 = this.getVerifierWithoutPrepare("archetypes/doctrine");
    verifier2.executeGoal("package");
    verifier2.verifyErrorFreeLog();
    verifier2.assertFilePresent("my-app/target/my-app-0.0.1-SNAPSHOT.phar");
  }
  /**
   * Test that unreadable metadata from one repository does not fail the entire dependency
   * resolution.
   */
  public void testit() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4498");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.deleteArtifacts("org.apache.maven.its.mng4498");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    verifier.addCliOption("--settings");
    verifier.addCliOption("settings.xml");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    List<String> classpath = verifier.loadLines("target/classpath.txt", "UTF-8");
    assertTrue(classpath.toString(), classpath.contains("dep-0.1-SNAPSHOT.jar"));
  }
  /**
   * Verify that repositories which have both releases and snapshots disabled aren't touched when
   * looking for plugin prefix mappings.
   */
  public void testit() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4771");

    final List<String> requestedUris = Collections.synchronizedList(new ArrayList<String>());

    AbstractHandler logHandler =
        new AbstractHandler() {
          public void handle(
              String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
              throws IOException, ServletException {
            requestedUris.add(request.getRequestURI());
          }
        };

    HandlerList handlerList = new HandlerList();
    handlerList.addHandler(logHandler);
    handlerList.addHandler(new DefaultHandler());

    Server server = new Server(0);
    server.setHandler(handlerList);
    server.start();

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    try {
      verifier.setAutoclean(false);
      verifier.deleteDirectory("target");
      Properties filterProps = verifier.newDefaultFilterProperties();
      filterProps.setProperty("@port@", Integer.toString(server.getConnectors()[0].getLocalPort()));
      verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8", filterProps);
      verifier.addCliOption("-U");
      verifier.addCliOption("-s");
      verifier.addCliOption("settings.xml");
      verifier.executeGoal("mng4771:touch");
      verifier.verifyErrorFreeLog();
      fail("Build should have failed to resolve unknown prefix");
    } catch (VerificationException e) {
      assertTrue(true);
    } finally {
      verifier.resetStreams();
      server.stop();
    }

    assertTrue(requestedUris.toString(), requestedUris.isEmpty());
  }
  /**
   * Verify that plugin dependencies defined by plugin management of a parent profile are not lost
   * when the parent's main plugin management section is also present.
   */
  public void testitMNG2174() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2174");

    Verifier verifier = newVerifier(new File(testDir, "sub").getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.deleteArtifacts("org.apache.maven.its.mng2174");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    verifier.addCliOption("--settings");
    verifier.addCliOption("settings.xml");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    Properties props = verifier.loadProperties("target/pcl.properties");
    assertEquals("1", props.getProperty("mng-2174.properties.count"));
    assertNotNull(props.getProperty("mng-2174.properties"));
  }
  /** Tests that hex digits of checksums are compared without regard to case. */
  public void testitMNG2744() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-2744");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteArtifacts("org.apache.maven.its.mng2744");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    verifier.addCliOption("--settings");
    verifier.addCliOption("settings.xml");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "a", "1", "jar");
    verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "a", "1", "pom");
    verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "b", "1", "jar");
    verifier.assertArtifactPresent("org.apache.maven.its.mng2744", "b", "1", "pom");
  }
  /**
   * @param archetypeVersion
   * @throws ComponentLookupException
   * @throws PlexusContainerException
   */
  private void executeCreateArchetype(Model model) throws Exception {
    log.info("Creating project from Archetype: " + model);
    String goal = "org.apache.maven.plugins:maven-archetype-plugin:2.2:generate";
    Properties properties = new Properties();
    properties.put("archetypeGroupId", model.getGroupId());
    properties.put("archetypeArtifactId", model.getArtifactId());
    properties.put("archetypeVersion", model.getVersion());
    properties.put("groupId", "org.jboss.as.quickstarts");
    String artifactId =
        System.currentTimeMillis() + "-" + model.toString().replaceAll("[^a-zA-Z_0-9]", "");
    properties.put("artifactId", artifactId);
    properties.put("version", "0.0.1-SNAPSHOT");
    Verifier verifier = new org.apache.maven.it.Verifier(outputDir);
    verifier.setAutoclean(false);
    verifier.setSystemProperties(properties);
    verifier.setLogFileName(artifactId + "-generate.txt");

    verifier.executeGoal(goal);

    log.info("Building project from Archetype: " + model);
    Verifier buildVerifier = new Verifier(outputDir + File.separator + artifactId);
    if (onlyMavenCentral) {
      buildVerifier.addCliOption(
          "-s " + testOutputDirectory + File.separator + "settings-clear.xml");
    }
    buildVerifier.executeGoal("compile"); // buildVerifier log is inside each project
    String functionalTestsFolder =
        outputDir + File.separator + artifactId + File.separator + "functional-tests";
    if (new File(functionalTestsFolder).exists()) {
      log.info("Building functional-tests from: " + functionalTestsFolder);
      Verifier functionalTestsVerifier = new Verifier(functionalTestsFolder);
      functionalTestsVerifier.setAutoclean(cleanArchetypes);
      if (onlyMavenCentral) {
        functionalTestsVerifier.addCliOption(
            "-s " + testOutputDirectory + File.separator + "settings-clear.xml");
      }
      functionalTestsVerifier.executeGoal("compile");
    }
  }
  /**
   * @param baseDir
   * @param model
   * @throws VerificationException
   */
  private void installArchetype(File baseDir, Model model) throws VerificationException {
    log.info("Installing Archetype *****: " + model);
    Verifier installer = new Verifier(baseDir.getAbsolutePath());
    if (onlyMavenCentral) {
      installer.addCliOption("-s " + testOutputDirectory + File.separator + "settings-clear.xml");
    }
    installer.setLogFileName("install.log");
    installer.setAutoclean(cleanArchetypes);
    installer.executeGoal("install");

    // Remove install.log from inside archetype
    new File(baseDir, "install.log").delete();
  }
  private void addAdditionalCliArguments(ProcessorTestCase child, final Verifier verifier)
      throws Exception {
    if (child.cliEnhancerConstructor != null) {
      CommandLineEnhancer enhancer = child.cliEnhancerConstructor.newInstance();
      Collection<String> additionalArgs =
          enhancer.getAdditionalCommandLineArguments(child.processor);

      if (additionalArgs != null) {
        for (String arg : additionalArgs) {
          verifier.addCliOption(arg);
        }
      }
    }
  }
  /** Test that exclusions defined on a dependency apply to its transitive dependencies as well. */
  public void testit() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4208");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("target");
    verifier.addCliOption("-DtestProperty=PASSED");
    verifier.executeGoal("validate");
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    Properties props = verifier.loadProperties("target/pom.properties");
    assertEquals("PASSED", props.getProperty("project.properties.interpolatedProperty"));
  }
  /**
   * Verify that dependency resolution by an aggregator before the build has actually produced any
   * artifacts doesn't prevent later resolution of project artifacts from the reactor if the
   * aggregator originally resolved them from the remote repo.
   */
  public void testit() throws Exception {
    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-4814");

    Verifier verifier = newVerifier(testDir.getAbsolutePath());
    verifier.setAutoclean(false);
    verifier.deleteDirectory("consumer/target");
    verifier.deleteArtifacts("org.apache.maven.its.mng4814");
    verifier.addCliOption("-s");
    verifier.addCliOption("settings.xml");
    verifier.filterFile(
        "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties());
    List<String> goals = new ArrayList<String>();
    goals.add(
        "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:aggregate-test");
    goals.add("validate");
    verifier.executeGoals(goals);
    verifier.verifyErrorFreeLog();
    verifier.resetStreams();

    List<String> compile = verifier.loadLines("consumer/target/compile.txt", "UTF-8");

    assertFalse(compile.toString(), compile.contains("0.1-SNAPSHOT/producer-0.1-SNAPSHOT.jar"));
    assertTrue(compile.toString(), compile.contains("producer/pom.xml"));
  }
Esempio n. 20
0
  /**
   * tests the goal "convert-phar"
   *
   * @throws Exception
   */
  public void testGoal() throws Exception {
    final Verifier verifierDep1 = this.getPhpMavenVerifier("mojos-phar/phar-with-dep1-folders");

    // delete the pom from previous runs
    verifierDep1.deleteArtifact("org.phpmaven.test", "phar-with-dep1-folders", "0.0.1", "pom");
    verifierDep1.deleteArtifact("org.phpmaven.test", "phar-with-dep1-folders", "0.0.1", "phar");

    // execute testing
    verifierDep1.executeGoal("package");

    // verify no error was thrown
    verifierDep1.verifyErrorFreeLog();

    // reset the streams
    verifierDep1.resetStreams();

    final File phar =
        new File(new File(verifierDep1.getBasedir()), "target/phar-with-dep1-folders-0.0.1.phar");
    assertTrue(phar.exists());

    verifierDep1.setAutoclean(false);

    // to zip
    verifierDep1.addCliOption("-Dfrom=" + phar.getAbsolutePath());
    verifierDep1.addCliOption(
        "-Dto=" + phar.getAbsolutePath().substring(0, phar.getAbsolutePath().length() - 4) + "zip");

    verifierDep1.executeGoal("org.phpmaven:maven-php-plugin:convert-phar");

    // verify no error was thrown
    verifierDep1.verifyErrorFreeLog();

    // reset the streams
    verifierDep1.resetStreams();

    verifierDep1.assertFilePresent("target/phar-with-dep1-folders-0.0.1.zip");

    // to jar
    verifierDep1.getCliOptions().clear();
    verifierDep1.addCliOption(
        "-Dfrom="
            + phar.getAbsolutePath().substring(0, phar.getAbsolutePath().length() - 4)
            + "zip");
    verifierDep1.addCliOption(
        "-Dto=" + phar.getAbsolutePath().substring(0, phar.getAbsolutePath().length() - 4) + "jar");

    verifierDep1.executeGoal("org.phpmaven:maven-php-plugin:convert-phar");

    // verify no error was thrown
    verifierDep1.verifyErrorFreeLog();

    // reset the streams
    verifierDep1.resetStreams();

    verifierDep1.assertFilePresent("target/phar-with-dep1-folders-0.0.1.jar");

    // to phar
    verifierDep1.getCliOptions().clear();
    verifierDep1.addCliOption(
        "-Dfrom="
            + phar.getAbsolutePath().substring(0, phar.getAbsolutePath().length() - 4)
            + "jar");
    verifierDep1.addCliOption(
        "-Dto="
            + phar.getAbsolutePath().substring(0, phar.getAbsolutePath().length() - 4)
            + "2.phar");

    verifierDep1.executeGoal("org.phpmaven:maven-php-plugin:convert-phar");

    // verify no error was thrown
    verifierDep1.verifyErrorFreeLog();

    // reset the streams
    verifierDep1.resetStreams();

    verifierDep1.assertFilePresent("target/phar-with-dep1-folders-0.0.1.2.phar");

    verifierDep1.getCliOptions().clear();
    verifierDep1.addCliOption("-Dphar=target/phar-with-dep1-folders-0.0.1.2.phar");
    verifierDep1.executeGoal("org.phpmaven:maven-php-plugin:list-phar-files");
    @SuppressWarnings("unchecked")
    final List<String> lines =
        verifierDep1.loadFile(verifierDep1.getBasedir(), verifierDep1.getLogFileName(), false);
    boolean found1 = false;
    boolean found2 = false;
    for (final String line : lines) {
      if (line.startsWith(
          "[INFO] " + File.separatorChar + "folderA" + File.separatorChar + "MyClassA.php")) {
        found1 = true;
      }
      if (line.startsWith(
          "[INFO] " + File.separatorChar + "folderB" + File.separatorChar + "MyClassB.php")) {
        found2 = true;
      }
    }

    // verify no error was thrown
    verifierDep1.verifyErrorFreeLog();

    // reset the streams
    verifierDep1.resetStreams();

    assertTrue(found1);
    assertTrue(found2);
  }