简体   繁体   English

Java Eclipse Maven版本控制

[英]Java Eclipse Maven Version Control

Which of the following files should be version controlled? 以下哪个文件应该受版本控制? And why? 为什么?

  • Class files compiled from the source code. 从源代码编译的类文件。
  • Other files generated during the build process, eg files under the target folder. 在构建过程中生成的其他文件,例如目标文件夹下的文件。
  • build.property file which contains the information about the development environment, eg file paths and database information. build.property文件,其中包含有关开发环境的信息,例如文件路径和数据库信息。
  • Files created by Eclipse, eg .project and .classpath. Eclipse创建的文件,例如.project和.classpath。

None of the above. 以上都不是。 Not only can each of those files be re-created, but they are most likely environment (dev and runtime) specific and they'll take up a lot of space in your repository. 不仅可以重新创建每个文件,而且它们很可能是特定于环境(开发和运行时)的,并且它们将占用存储库中的大量空间。

The simple rule in Maven is: Everything which is in target folder should not be put under version control and the folder itself neither, cause everything in that folder is created from the sources code src/main/ src/test etc. and from the pom.xml file itself. 在Maven中的简单规则是:目标文件夹中的所有内容都不应置于版本控制之下,文件夹本身也不应该,因为该文件夹中的所有内容都是从源代码src / main / src / test等创建的,并且来自pom .xml文件本身。

Files like .project and .classpath should not be versioned, cause they will be generated by an import of a project into Eclipse so usually no need to put them into version control furthermore they are specific to Eclipse. 像.project和.classpath这样的文件不应该被版本化,因为它们将通过将项目导入Eclipse生成,因此通常不需要将它们放入版本控制中,而且它们特定于Eclipse。 In rare situations in can be usefull to put them under version control. 在极少数情况下,可以将它们置于版本控制之下。

The build.properties files is specific for Maven 1 it might be a good idea to put it into version control. build.properties文件特定于Maven 1,将其置于版本控制中可能是个好主意。

None. 没有。 Although I would consider managing the "build.property" file as Maven Build Profiles . 虽然我会考虑将“build.property”文件作为Maven Build Profiles来管理 Thus, the file could eventually be version controlled indirectly through the pom.xml file. 因此,该文件最终可以通过pom.xml文件间接进行版本控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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