private TargetAndParents parseTargetLine(String line) {
        String[] targetAndParents = line.trim().split(":", 2);

        String target = targetAndParents[0].trim();
        String parentLine = targetAndParents.length > 1 ? targetAndParents[1].trim() : "";

        String[] parents;
        if (parentLine.isEmpty()) {
            parents = new String[0];
        } else {
            parents = parentLine.split("[ ]+");
        }

        if (!isValidTargetName(target)) {
            throw new IllegalStateException("Invalid target name: " + target);
        }

        for (String parentTarget : parents) {
            if (!isValidTargetName(parentTarget)) {
                throw new IllegalStateException("Invalid parent target name: " + parentTarget +
                        " of target: " + target);
            }
        }

        return new TargetAndParents(target, Arrays.asList(parents));
    }