Working in mixed teams
There's one the keeps me busy and that's working on projects (Grails Projects in particular) in mixed team environments where some developers are working on a Mac while others use Windows. Since IntelliJ stores the Location of certain - in my opinion ambient - resources in in the project files it is really hard to get along when a check-in of a Windows developer overwrites not only the location of the Grails SDK but also the location of the GIT client along with other stuff.
What's the recommended approach to fix this?
请先登录再写评论。
It seems that path variables could help in this case. Have you tried them?
Alexander.
Could you explain that a bit?
If I have correctly understood the problem, the same libraries (resources) may be installed with different paths on different computers.
Let's assume team member A has required library in C:/super-path-a/product-x/lib/library.jar, and team member B has the same in C:/super-path-b/product-x/lib/library.jar. In IDEA both go to Settings / Path variables. A sets PRODUCT_X = C:/super-path-a/product-x, B sets PRODUCT_X = C:/super-path-b/product-x. These settings are stored locally in user home.
After that once a project refers to library.jar (e.g. some module has this jar in dependencies list), this reference is written into .iml file as $PRODUCT_X$/lib/library.jar, which suits for every team member. The side effect is that some third team member will not be able to open the project until defining the PRODUCT_X variable (but he is expected to do).
For libraries (like Grails) there is an alternative solution to define a global library. It could help, if Mac and Windows resources are different even in file names (so, path variable can't help). Global library definition is stored in user home, and referred from project and modules by name. So, library definition is user-specific, and project / modules files content is common. GUI for definition may be found in Project Settings dialog.
Alexander.
Let me share how we solved this problem.
- all shared libraries are under version control (Perforce), in the
location separate from projects
- libraries are integrated into PROJECT_ROOT/libraries using Perforce
integration feature. This doesn't create a copy of a library, but
"links" to the project, so only minimally increases the size of the
repository
- referenced libraries are now become relative to PROJECT_ROOT
- any member of the team (Windows, Linux, Mac) can now checkout the
entire project from VC, along with libraries
- this does not require separate installation of libraries by each team
member
If I have three projects using the same library, I will have three
copies on my local disk, under each PROJECT_ROOT. But I don't care: disk
space is cheap, and everything is VC anyway.
br,
TomP
I see. But to make this work with Grails I would have to be able to define a Grails SDK for my project that is based on a path variable such as the already defined GRAILS_HOME path variable but unfortunately I cant seem to find a way to do this. The dialog only accepts an absolute path.
Nevermind. I've figured it out. I simply didnt expect that IntelliJ would simply perform a substring match of every path against the value of every defined path variable and replace it accordingly if a match was found.