You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/11/21 09:55:39 UTC

[GitHub] [netbeans] lbownik commented on a diff in pull request #4985: Use Project Dictated JVM for Gradle Discovery

lbownik commented on code in PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#discussion_r1027795678


##########
extide/gradle/src/org/netbeans/modules/gradle/loaders/LegacyProjectLoader.java:
##########
@@ -472,8 +474,20 @@ private static NbProjectInfo retrieveProjectInfo(NbGradleProjectImpl projectImpl
             offline.addFlag(GradleCommandLine.Flag.OFFLINE);
         }
 
+        File javaHome = null;
+        GradleJavaPlatformProvider jvmProvider = projectImpl.getLookup().lookup(GradleJavaPlatformProvider.class);
+        try {
+            if (jvmProvider != null) {
+                javaHome = jvmProvider.getJavaHome();
+                LOG.log(Level.FINE, "Using JAVA_HOME=''{0}'' for project info load for: {1}", new Object[]{javaHome, projectImpl});
+            }
+        } catch (FileNotFoundException ex) {
+            LOG.log(Level.WARNING, "JAVA_HOME for project " + projectImpl + " not found.", ex);
+        }
+
         if (goOnline == GoOnline.NEVER || goOnline == GoOnline.ON_DEMAND) {
             BuildActionExecuter<NbProjectInfo> action = createInfoAction(pconn, offline, token, pl);
+            action.setJavaHome(javaHome);

Review Comment:
   what if javaHome variable is null here?



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists