diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java index 440ed0ec55cc..a1d37a2b2895 100755 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2019 IBM Corporation and others. + * Copyright (c) 2014, 2024 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -44,7 +44,6 @@ public class RepositoryResolutionException extends RepositoryException { private final Map> featureConflicts; private Set resolvedPlatforms; private Set missingPlatforms; - private boolean hasVersionlessIssue; private List missingBasePlatforms; /** @@ -373,6 +372,7 @@ private String getResourceName(RepositoryResource resource) { } /** + * This states the target platforms that were used during the resolution * @return the resolvedPlatforms */ public Set getResolvedPlatforms() { @@ -380,6 +380,7 @@ public Set getResolvedPlatforms() { } /** + * This describes missspelled or unknown platform names, official names are collected by the feature metadata * @return the missingPlatforms */ public Set getMissingPlatforms() { @@ -387,6 +388,7 @@ public Set getMissingPlatforms() { } /** + * This describes base platforms like "jakartaee" that are not derived, either by passed platform values, or by other included versioned features * @return the missingBasePlatforms */ public List getMissingBasePlatforms() { diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java index f0ccc794935d..6b21239219f5 100755 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java @@ -367,6 +367,8 @@ public Collection> resolve(String toResolve) throws Rep * For example, if {@code ejbLite-3.2} is already installed and {@code resolve(Arrays.asList("cdi-2.0"))} is called, it will not return the autofeature which would be required * for {@code cdi-2.0} and {@code ejbLite-3.2} to work together. * + * @deprecated - calling this method should be replaced by passing the platform list, required to support versionless features. + * * @param toResolve A collection of the identifiers of the resources to resolve. It should be in the form:
* {name}/{version}
*

Where the {name} can be either the symbolic name, short name or lower case short name of the resource and /{version} is @@ -389,6 +391,7 @@ public Collection> resolve(String toResolve) throws Rep * * @throws RepositoryResolutionException If the resource cannot be resolved */ + @Deprecated public Collection> resolveAsSet(Collection toResolve) throws RepositoryResolutionException { return resolve(toResolve, null, ResolutionMode.DETECT_CONFLICTS); } @@ -591,8 +594,6 @@ private void recordVersionless(Result result, Repository resolverRepo) { resolvedPlatforms = result.getResolvedPlatforms(); missingPlatforms = result.getMissingPlatforms(); - if (resolvedPlatforms.isEmpty() || !missingPlatforms.isEmpty()) - hasVersionlessIssue = true; } @@ -1012,15 +1013,18 @@ private void reportErrors() throws RepositoryResolutionException { List missingBasePlatforms = new ArrayList(); - // Versionless feature issues will appear in missingTopLevelRequirements, and this will gather the associated platform unable to target. + // Versionless features can't be resolved if a corresponding platform is not derived, making the choice ambiguous, and the feature won't be included in the resolved list. - will gather the associated platform unable to target. for (String name : missingTopLevelRequirements) { ProvisioningFeatureDefinition feature = resolverRepository.getFeature(name); if (feature != null && feature.isVersionless()) { - ProvisioningFeatureDefinition firstChild = resolverRepository.findAllPossibleVersions(feature).get(0); - String plat = firstChild.getPlatformName(); - if (plat != null) {//This will add just the platform name without version - missingBasePlatforms.add(resolverRepository.getFeatureBaseName(plat)); - } + List featureChildren = resolverRepository.findAllPossibleVersions(feature); + if (!featureChildren.isEmpty() { + ProvisioningFeatureDefinition firstChild = featureChildren.get(0); + String plat = firstChild.getPlatformName(); + if (plat != null) {//This will add just the platform name without version + missingBasePlatforms.add(resolverRepository.getFeatureBaseName(plat)); + } + } } } diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverEsa.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverEsa.java index 857b965f55ef..f1cd8c9c496a 100644 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverEsa.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverEsa.java @@ -264,13 +264,12 @@ public boolean isVersionless() { return false; } - if (getSymbolicName().indexOf(".versionless.") == -1) { - return false; - } else if (getSymbolicName().indexOf(".internal.versionless.") != -1) { + if (getSymbolicName().contains(".versionless.") + && !getSymbolicName().contains(".internal.")) { + return true; + } else { return false; } - - return true; } @Override diff --git a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java index f56f2a0c90d7..422c245bdd35 100644 --- a/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java +++ b/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java @@ -258,7 +258,7 @@ public List findAllPossibleVersions(ProvisioningF publicFeature = getVersionedFeature(dependency.getSymbolicName()); if (publicFeature != null) result.add(publicFeature); - + String baseName = getFeatureBaseName(dependency.getSymbolicName()); List tolerates = dependency.getTolerates(); if (tolerates != null) { @@ -275,13 +275,13 @@ public List findAllPossibleVersions(ProvisioningF /** * - * Answer the public versioned feature based on the internal versionless linking feature + * Answer the public versioned feature based on the internal versionless linking feature, or null if can't be found * * @param versionlessLinkingFeatureName * @return ProvisioningFeatureDefinition */ private ProvisioningFeatureDefinition getVersionedFeature(String versionlessLinkingFeatureName) { - ProvisioningFeatureDefinition result = null; + ProvisioningFeatureDefinition feature = getFeature(versionlessLinkingFeatureName); if (feature != null) { //This is the versionless linking feature pointing to a public versioned feature