public void setMarker()

in src/main/java/org/apache/maven/plugins/dependency/utils/markers/DefaultFileMarkerHandler.java [94:123]


    public void setMarker() throws MojoExecutionException {
        File marker = getMarkerFile();
        // create marker file
        try {
            marker.getParentFile().mkdirs();
        } catch (NullPointerException e) {
            // parent is null, ignore it.
        }
        try {
            marker.createNewFile();
        } catch (IOException e) {
            throw new MojoExecutionException("Unable to create Marker: " + marker.getAbsolutePath(), e);
        }

        // update marker file timestamp
        try {
            long ts;
            if (this.artifact != null && this.artifact.getFile() != null) {
                ts = this.artifact.getFile().lastModified();
            } else {
                ts = System.currentTimeMillis();
            }
            if (!marker.setLastModified(ts)) {
                throw new MojoExecutionException(
                        "Unable to update last modified timestamp on marker file " + marker.getAbsolutePath());
            }
        } catch (Exception e) {
            throw new MojoExecutionException("Unable to update Marker timestamp: " + marker.getAbsolutePath(), e);
        }
    }