简体   繁体   中英

How to setup a Java maven project for multiple developers to use easily

What do people think is the best way of setting up a Java, maven-2 web project so a new developer can come on board easily?

Do you checkin you project settings, .classpath, .project .settings folder etc into source control and use variables?

Or

Is it better to just checkin code and use the maven eclipse plugin to generate project settings?

Keep in mind these are multi module projects, with different facets so the project meta data could be quite complex

Never ever ever check in any .* file in a maven project. It will mess things up whenever any developer turns on or off any eclipse builder or nature.

If you need to enforce common configuration, use the additionalConfig flag of the Maven Eclipse Plugin

This is controversial, and normally depend on a person's own judgment.

Personally I like to check in all IDE configuration files, especially if all team members are using the same IDE. This way you can use IDE's UI to manage project configuration, such as formatting and other code editing settings without need to manually tweak Maven's plugin configuration, which is too easy to break.

It depends on your environment. If your developers use similar machines in terms of OS and disk partition, workspace location, framework(s) location, etc, then I don't think you will have a problem with checked-in settings, in fact, as some have stated here, it can simplify the process of on-boarding.

However, I've always worked in environments where everyone has his own individualized settings, some people used macs, some were on windows or linux, etc. Disk partitions were not the same neither was the way everyone organized their workspaces. In that kind of an environment committing project settings can cause really big pains. We've always added them to SVN ignore list. We use a screencast to make on-boarding quicker.

check out everything with m2-eclipse should pose no problems at all; at least for us. So don't use SVN perspective, but in new project there is also an option under Maven to choose Check out maven project from CSV.

We do not checkin files like .project , .classpath and .settings in our VCS for the reasons given by @seanizer: avoiding hell.

So here is how we handle things:

  • we use m2eclipse or the maven eclipse plugin to derive what can be derived from the POM
  • we use a dedicated build-tools Maven module to hold files such as our
    • checkstyle.xml as suggested by the Checkstyle Multimodule configuration
    • codestyle-eclipse.xml (Eclipse Formatter profile ready to import)
    • codetemplates-eclipse.xml (Eclipse Codes Templates ready to import)
  • we document how to setup the development environment using the above files in our Wiki

All this is highly inspired by what Vincent Massol is doing at XWiki (see their Java Code Style page and their svn for a concrete example).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM