diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/InstallableUnitResolver.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/InstallableUnitResolver.java index 6edba2fa89..ebf25dac8c 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/InstallableUnitResolver.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/InstallableUnitResolver.java @@ -275,7 +275,7 @@ private static IInstallableUnit findUnits(Unit unitReference, IQueryable findUnit(Unit unitReference, IQueryable units) throws TargetDefinitionSyntaxException { - Version version = parseVersion(unitReference); + VersionRange version = parseVersion(unitReference); // the createIUQuery treats 0.0.0 version as "any version", and all other versions as exact versions IQuery matchingIUQuery = QueryUtil.createIUQuery(unitReference.getId(), version); @@ -285,9 +285,9 @@ private static IQueryResult findUnit(Unit unitReference, IQuer return queryResult; } - private static Version parseVersion(Unit unitReference) throws TargetDefinitionSyntaxException { + private static VersionRange parseVersion(Unit unitReference) throws TargetDefinitionSyntaxException { try { - return Version.parseVersion(unitReference.getVersion()); + return VersionRange.create(unitReference.getVersion()); } catch (IllegalArgumentException e) { throw new TargetDefinitionSyntaxException(NLS.bind("Cannot parse version \"{0}\" of unit \"{1}\"", unitReference.getVersion(), unitReference.getId()), e); diff --git a/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java index e4bd84a9db..42fa355732 100644 --- a/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java +++ b/tycho-targetplatform/src/main/java/org/eclipse/tycho/targetplatform/TargetDefinitionFile.java @@ -755,6 +755,9 @@ private static IULocation parseIULocation(Element dom) { for (Element unitDom : getChildren(dom, "unit")) { String id = unitDom.getAttribute("id"); String version = unitDom.getAttribute("version"); + if (version == null || version.isBlank()) { + version = "0.0.0"; + } units.add(new Unit(id, version)); } final List repositories = new ArrayList<>();