private void setArtifactFile()

in maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java [225:251]


    private void setArtifactFile(Artifact artifact, File workingDir, File srcFile, boolean createUnpackableFile)
            throws IOException {
        if (workingDir == null) {
            throw new IllegalArgumentException("The workingDir must be set.");
        }

        String fileName = getFormattedFileName(artifact, false);

        File theFile = new File(workingDir, fileName);
        theFile.getParentFile().mkdirs();

        if (srcFile == null) {
            theFile.createNewFile();
        } else if (createUnpackableFile) {
            try {
                createUnpackableFile(artifact, theFile);
            } catch (NoSuchArchiverException e) {
                throw new IOException("NoSuchArchiverException: " + e.getMessage());
            } catch (ArchiverException e) {
                throw new IOException("ArchiverException: " + e.getMessage());
            }
        } else {
            FileUtils.copyFile(srcFile, theFile);
        }

        artifact.setFile(theFile);
    }