Search code examples
mavengrailsintellij-ideagradleintellij-14

IntelliJ not pulling in Grails 3 private dependencies


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.


Solution

  • 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.