davydotcom commented on code in PR #15995:
URL: https://github.com/apache/grails-core/pull/15995#discussion_r3606024258


##########
grails-core/src/main/groovy/org/apache/grails/core/plugins/DefaultPluginDiscovery.java:
##########
@@ -418,16 +418,36 @@ private void loadDelayedPlugins() {
                     delayedLoadPlugins.add(plugin);
                 } else {
                     failedPlugins.put(plugin.getName(), plugin);
-                    LOG.error(
-                            "ERROR: Plugin [{}] cannot be loaded because its 
dependencies [{}}] cannot be resolved",
-                            plugin.getName(),
-                            plugin.getDependsOnNames()
-                    );
+                    logUnresolvedDependencies(plugin);
                 }
             }
         }
     }
 
+    private void logUnresolvedDependencies(PluginInfo plugin) {
+        var unresolvedDependencies = new ArrayList<String>();
+        for (var name : plugin.getDependsOnNames()) {
+            var requiredVersion = 
plugin.getMetadata().getDependentVersion(name);
+            var dependency = findPlugin(name);
+            if (dependency == null) {
+                unresolvedDependencies.add(
+                        "dependency [" + name + "] with required version [" + 
requiredVersion + "] is missing"
+                );
+            } else if 
(!GrailsVersionUtils.isValidVersion(dependency.getPluginVersion(), 
requiredVersion)) {
+                unresolvedDependencies.add(
+                        "dependency [" + name + "] has version [" + 
dependency.getPluginVersion() +
+                                "] but requires [" + requiredVersion + "]"
+                );
+            }
+        }
+        LOG.warn(

Review Comment:
   Please keep this at ERROR rather than WARN.
   
   Unresolved dependencies already put the plugin in `failedPlugins`; that is a 
load failure, and the previous code logged it with `LOG.error`. A clearer 
message is welcome, but the severity should stay ERROR so it isn’t lost when 
WARN is filtered.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to