[GRADLE-1844] Idea plugin: Using a pathVariable breaks library references Created: 19/Oct/11  Updated: 04/Jan/13  Resolved: 13/Feb/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-5
Fix Version/s: 1.0-milestone-8

Type: Bug
Reporter: Adrian Abraham Assignee: René Gröschke (Inactive)
Resolution: Fixed Votes: 3


 Description   

I'm using the Idea plugin to generate IML/IPR files for my project. Without a pathVariable set, everything is fine: libraries show up in the IML file as .../thing.jar. When I set one, Gradle ends up resolving the symlink and putting the "real" filename in the IML file: .../fd32786786e2adb664d5ecc965da47629dca14b. The file is technically correct; however, Idea ignores it since it doesn't end in ".jar".

Here's the simplest possible script I could make to replicate the problem:

build.gradle
apply plugin: 'java'
apply plugin: 'idea'

repositories {
  mavenCentral()
}

dependencies {
  compile 'commons-codec:commons-codec:1.3'
}

idea {
  pathVariables("GRADLE_USER_HOME": gradle.gradleUserHomeDir)
}

When run (it doesn't need any other files), it'll generate an IML with a bad library reference (the "real" filestore path). Comment out the pathVariables line and rerun the idea target, and the IML file will have the good ("pretty") reference to the jar symlink.



 Comments   
Comment by Sten Roger Sandvik [ 13/Jan/12 ]

This is probably an easy fix. Have looked at the code and will try to see if I could fix this issue. But if anyone has some pointers I would like to hear about them.

For now I have fixed up my gradle script to do the following:

idea {
  module {
    iml {
      withXml { provider ->
        provider.node.depthFirst().root.each {
	  it.@url = it.@url.replace(gradle.gradleUserHomeDir.toString(), '$GRADLE_USER_HOME$')
	}
      }
    }
  }
}
Comment by Szczepan Faber [ 13/Jan/12 ]

Mentioned on the forums also: http://forums.gradle.org/gradle/topics/problem_with_path_variables_and_idea_plugin?utm_content=topic_link&utm_medium=email&utm_source=reply_notification

This is a regression introduced in M5 and it feels we should fix it soonish instead of waiting for the final call on how we structure the artifact cache (and if we go for the in-project cache directory).

Comment by René Gröschke (Inactive) [ 13/Feb/12 ]

had a closer look on that issue:

  • broken with M5 & M7
  • fixed for M6 & upcoming M8
Generated at Wed Jun 30 12:05:53 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.