public void execute()

in yetus-maven-plugin/src/main/java/org/apache/yetus/maven/plugin/fileops/CreateSymLinkMojo.java [71:98]


  public void execute() throws MojoExecutionException {
    if (target == null) {
      throw new MojoExecutionException("target of symlink is undefined.");
    }

    if (newLink == null) {
      throw new MojoExecutionException("newLink of symlink is undefined.");
    }

    Path targetPath = Paths.get(target);
    Path newLinkPath = Paths.get(newLink);

    if (!newLinkPath.isAbsolute()) {
      newLinkPath = Paths.get(basedir, newLink);
    }

    try {
        Files.createSymbolicLink(newLinkPath, targetPath);
    } catch (FileAlreadyExistsException x) {
      if (!ignoreExist) {
        throw new MojoExecutionException("Unable to create "
            + newLinkPath.toString() + ": " + targetPath.toString() + " " + x);
      }
    } catch (Exception x) {
      throw new MojoExecutionException("Unable to create "
          + newLinkPath.toString() + ": " + targetPath.toString() + " " + x);
    }
  }