For us, each developer generates their IDEA projects (whenever things change
in a way that causes a problem for them).  Therefore, having the username in
the path is not an issue.  Many years ago (long before Gradle, back in IDEA
4 or so days) we tried to share the project files from source control.  Due
to a combination of limitations (for one, our source control software at the
time sucked!) this did not work well.  In those days we used Ant for our
build, so we wrote Ant tasks that would generate IDEA projects.  This solved
duplication of information (dependencies declared in Ant and IDEA) and the
issues we had with sharing the IDEA projects.  We just never looked back as
this has worked for us.  So, when we switched to Gradle, we wrote code in
Gradle to generate our IDEA tasks.  Truth be told, I have not yet switched
to use Gradle's idea-plugin because of a few more missing features that I'm
waiting on Hans to incorporate into the plugin.  However, I don't think
we'll care about paths in IDEA since we don't share the projects.

Anyway, that's why we do it the way we do.  All our developers are happier
being able when to decide to have the project regenerated (this ancient
history matters for us since most of our developers have been with the
company for 8 or more years, so they lived this history).


On Fri, Jul 16, 2010 at 10:42 AM, Dan Tanner <[email protected]> wrote:

> Hmmm...I wonder why it's not a problem for you guys.  My build.gradle
> looks just like the example...
> ideaProject {
>        javaVersion = '1.6'
>         withXml { root ->
>        root.component.find { i...@name == 'VcsDirectoryMappings'
> }.mappi...@vcs = 'hg4idea'
>    }
> }
>
> An example dependency path in my generated iml file looks like this:
> <root
> url="jar://$MODULE_DIR$/../../Users/dtanner/.gradle/cache/javax.activation/activation/sources/activation-1.1-sources.jar!/"/>
>
> Having the username in the path is a problem in a team environment if
> we store the .ipr and .iml files in source control.  Looking at the
> code, it's creating a relative path to the .gradle cache directory,
> which is set to project.gradle.gradleUserHomeDir + '/cache', and it
> doesn't appear to be configurable.
>
> I tried a couple things with post-processing the xml, but I hit some
> snags.  e.g. Here were some ideas I kicked around.
>    whenConfigured { module ->
>        module.dependencies.classes.each { path ->
>                        // replace the path with a value that uses a
> team-shared
> IDEA-defined variable
>                }
>    }
>
> OR...
>
>        withXml { root ->
>                def urlAttributes = root.depthFirst().'@url'
>                urlAttributes.each { a ->
>                        if (a?.contains('$MODULE_DIR$/../../${user.home}'))
> {
>                                // replace a with a value that uses a
> team-shared IDEA-defined variable
>                        }
>                }
>        }
>
>
> So before I go further down this path...am I making this harder than
> it needs to be?  i.e. What's different about your situations that's
> it's not a problem for others?  Thanks again for your help guys.
>
>

-- 
John Murph
Automated Logic Research Team

Reply via email to