IntelliJ not pulling in Grails 3 private dependencies

别来无恙 提交于 2019-12-13 01:28:58

问题


I'm struggling to get IntelliJ 15 Ultimate Edition to work with Grails 3 private dependencies. Basically I have a repository (artifactory) where my private plugins are published. My application compiles/runs/pulls in all the plugins correctly but IntelliJ just doesn't pick up the dependencies. As you can imagine this is a nightmare for code autocompletion etc.

Here's output from the gradle overview in IntelliJ

And here is the config for the plugins in build.gradle - these environment variables are definitely set - I've also tried to include the credentials in ~/.m2/settings.xml but still not working.

repositories {
    maven {
        url "http://maven.hidden.co/plugins-release-local"
        credentials {
            username System.getenv('REPO_USERNAME')
            password System.getenv('REPO_PASSWORD')
        }
    }
}

Please help. I'm going insane.


回答1:


I think all you need to do is refresh your dependencies by clicking the refresh icon as shown below in the red circle.




回答2:


I don't have IDEA 15 (I have 14), but did you do 'Refresh all Gradle Projects'?




回答3:


This was entirely my fault. I was relying on OS X environment variables set by .profile and .bash_profile to be present in IntelliJ when they are not. I had to use another mechanism to get these environment variables into IntelliJ.

I created a file Library/LaunchAgents/environment.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>
    launchctl setenv REPO_USERNAME xxx
    launchctl setenv REPO_PASSWORD xxx
    </string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

This set the environment fields for me system wide and I was able to load my projects correctly.



来源:https://stackoverflow.com/questions/36017971/intellij-not-pulling-in-grails-3-private-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!