public int compareTo(Dependency dependency) {
        if (this.groupId != dependency.groupId) {
            if (this.groupId == null) return -1;
            if (! this.groupId.equals(dependency.groupId)) {
                return this.groupId.compareTo(dependency.groupId);
            }
        }
        if (this.artifactId != dependency.artifactId) {
            if (this.artifactId == null) return -1;
            if (! this.artifactId.equals(dependency.artifactId)) {
                return this.artifactId.compareTo(dependency.artifactId);
            }
        }
        // ignore type
        if (this.version != dependency.version) {
            if (this.version == null) return -1;
            if (! this.version.equals(dependency.version)) {
                return this.version.compareTo(dependency.version);
            }
        }
        return 0;
    }