try {
org.apache.maven.artifact.versioning.VersionRange vr = org.apache.maven.artifact.versioning.VersionRange.createFromVersionSpec(dep.getVersion());
List<Restriction> restrictions = vr.getRestrictions();
if(restrictions.size() == 1) {
Restriction r = restrictions.get(0);
Version lower = r.getLowerBound() == null
? Version.MIN
: Version.create(r.getLowerBound().toString());
Version upper = r.getUpperBound() == null
? Version.MAX
: Version.create(r.getUpperBound().toString());
Dependency forgeDep = new Dependency();
String dgid = mavenProject.getGroupId();
String downer = dgid.substring(dgid.lastIndexOf('.') + 1);
forgeDep.setName(ModuleName.create(downer, dep.getArtifactId(), true));
forgeDep.setVersionRequirement(VersionRange.create(
lower, r.isLowerBoundInclusive(), upper, r.isUpperBoundInclusive()));
if(forgeDeps == null)
forgeDeps = new ArrayList<Dependency>();
forgeDeps.add(forgeDep);
}