开发者

How can a team share an eclipse project when their work environment is different?

开发者 https://www.devze.com 2023-03-06 02:22 出处:网络
When sharing a project with team members through version control, it is customary to include the .project in the source under version control.This makes sure that others on the team get all the depend

When sharing a project with team members through version control, it is customary to include the .project in the source under version control. This makes sure that others on the team get all the dependencies and resources for the project. But the .project uses full/rooted paths to the resource, and not all members of a team will be working in the same environment. Even if all the members are on the same platform, the paths can often be in the user's home directory.

For the .classpath file, we can get around this problem by using build path varia开发者_如何学Pythonbles. Each member defines the path to location of dependent libraries on their system, and the .classpath only refers to the variable.

This is a particular concern for Grails project - when we add a plugin, it updates the .project accordingly.


IMO resources themselves should not be part of the project at all. There is excellent plugin called m2eclipse which simplifies such tasks using Maven. It will immensely simplify your dependency management. All you'd have to keep in your version control system, besides your source code, is project configuration (pom.xml) - all the dependencies will be downloaded and cached automatically no matter what environment developer works in. There a lot more advantages in this approach - just read up on it :)

UPDATE: Just noticed "grails" tag on your question. if you're using Groovy - Maven can be replaced with Gradle. STS is probably the best Eclipse build to use if you're coding in Groovy. Next version of STS will have Gradle support.


General Approach

As others have mentioned, you should not keep the IDE files in VCS, you should keep an IDE-agnostic description of the project in VCS and generate the IDE-specific project files from them.


Java-Maven Example

Keep the pom.xml file(s) in VCS and generate the Eclipse files by running mvn eclipse:eclipse


Grails Example

A Grails project is described by application.properties and grails-app/conf/BuildConfig.groovy. These files are present in every Grails application. You can generate the Eclipse project descriptions from them by running:

grails integrate-with --eclipse

This command also supports other tools such as IntelliJ and Textmate


I don't think its standard practice to include the project file. I personally tell my VCS to ignore all IDE files, and just use VCS for the source. I include at the root level a README telling others how to configure the project (e.g. jars are in lib)


The resource links feature that you are referring to also has ability to use path variables. These are defined under Preferences -> General -> Workspace -> Linked Resources.


You could try keeping the project files in a shared Dropbox with an agreed upon path for each developer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号