Skip to content

Commit

Permalink
Fix #876 - [2.7.1][regression] Neither raw version nor format was
Browse files Browse the repository at this point in the history
specified
  • Loading branch information
laeubi committed Apr 12, 2022
1 parent 23c5a50 commit caab4a6
Showing 1 changed file with 19 additions and 4 deletions.
Expand Up @@ -76,8 +76,8 @@ public Feature expandReferences(Feature feature, TargetPlatform targetPlatform)
String version = pluginRef.getVersion();
if ("0.0.0".equals(version)) {
ImportRef importRef = pluginImports.get(pluginRef.getId());
if (importRef != null) {
version = importRef.getVersion() + "|" + importRef.getMatch();
if (isVersionedRef(importRef)) {
version = String.format("%s|%s", importRef.getVersion(), importRef.getMatch());
}
}
ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef, version);
Expand All @@ -94,8 +94,8 @@ public Feature expandReferences(Feature feature, TargetPlatform targetPlatform)
String version = featureRef.getVersion();
if ("0.0.0".equals(version)) {
ImportRef importRef = featureImports.get(featureRef.getId());
if (importRef != null) {
version = importRef.getVersion() + "|" + importRef.getMatch();
if (isVersionedRef(importRef)) {
version = String.format("%s|%s", importRef.getVersion(), importRef.getMatch());
}
}
ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef, version);
Expand All @@ -105,6 +105,21 @@ public Feature expandReferences(Feature feature, TargetPlatform targetPlatform)
return feature;
}

private boolean isVersionedRef(ImportRef importRef) {
if (importRef == null) {
return false;
}
String version = importRef.getVersion();
if (version == null || version.isEmpty()) {
return false;
}
String match = importRef.getMatch();
if (match == null || match.isEmpty()) {
return false;
}
return true;
}

private ArtifactKey resolvePluginReference(TargetPlatform targetPlatform, PluginRef pluginRef, String version)
throws MojoFailureException {
try {
Expand Down

0 comments on commit caab4a6

Please sign in to comment.