code: public void unarchive(String baseDir) throws MojoExecutionException {
      try (FileInputStream fis = new FileInputStream(archive);
          TarArchiveInputStream tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(fis))) {
        TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
        while (tarEntry != null) {
          // Create a file for this tarEntry
          final File destPath = new File(baseDir + File.separator + tarEntry.getName());
          if (tarEntry.isDirectory()) {
            destPath.mkdirs();
          }
          else {
            destPath.createNewFile();
            destPath.setExecutable(true);
            try (BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath))) {
              IOUtils.copy(tarIn, bout);
            }
          }
          tarEntry = tarIn.getNextTarEntry();
        }
      }
      catch (IOException ex) {
        throw new MojoExecutionException("Could not extract archive: " + archive.getAbsolutePath(), ex);
      }
  
      // delete archive after extraction
      archive.delete();
    }
docs: Unarchives the archive into the base dir
  @param baseDir Base dir
  @throws MojoExecutionException Mojo execution exception