conan-io / conan-clion-plugin

CLion C/C++ IDE plugin for Conan Package Manager
Apache License 2.0
100 stars 27 forks source link

NullPointerException on attempt to match profiles #71

Open Maririri opened 5 years ago

Maririri commented 5 years ago

version: 1.2.0 During the first 'conan install' it seems like it couldn't match Cmake and Conan profiles

java.lang.NullPointerException at conan.actions.ActionUtils.lambda$matchProfilesAndInstall$1(ActionUtils.java:63) at java.base/java.util.HashMap.forEach(HashMap.java:1336) at conan.actions.ActionUtils.matchProfilesAndInstall(ActionUtils.java:62) at conan.actions.ActionUtils.runInstall(ActionUtils.java:42) at conan.actions.InstallAction.actionPerformed(InstallAction.java:23) at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:266) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:283) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:257) at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:192) at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:155) at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:432) at java.desktop/java.awt.Component.processEvent(Component.java:6416) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4858) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:906) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:844) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:776) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:422) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

jgsogo commented 5 years ago

Hi, @Maririri. I will need a little bit more information. Was it the first time running Conan too? Maybe it is because the ~/.conan/profiles folder didn't exist yet (or the folder was empty). I need to reproduce it but it should be easy to fix.

Thanks for reporting (and using the plugin)


If that was the case, you will need to create a profile using the command line (conan profile new --detect default), or by hand creating a file in the ~/.conan/profiles folder.

NickPadilla commented 4 years ago

Hi! I just want to say that I would like to reuse our profiles for others to run.. or maybe for a CI build system. I have created my profiles in the project root. I think we should allow either configuring where to look for the profiles or to look at both source root and ~/.conan/profiles.

EDIT>> I have tried to perform an Install from the Conan window and it brings up the 'Match between CMake and Conan Profiles'. There are no Conan Profiles to choose from, even though I did use the conan profile -new to create the profile. I did use a relative path so it created the profile in the project root.

jgsogo commented 4 years ago

Hi, @NickPadilla

Right now, the plugin uses an existing Conan installation (you can choose the path to the executable in the configuration), and this executable will use the profiles found at ~/.conan/profiles (unless you change it with the environment variable CONAN_USER_HOME, but I agree it is not easy to handle an environment variable with the CLion plugin, this should be something to add to the settings https://github.com/conan-io/conan-clion-plugin/issues/22).

Also, we should probably move the profile matching to the settings windows and add a way to match against local profiles. I'll add a specific issue for that.

Thanks for your suggestion