SPRING Roo 项目 - 版本控制中应保留哪些内容
我正在开始一个 spring roo 项目,并注意到有许多文件,例如
AspectJ (.aj) 文件 - 我认为这些文件很重要,因为它们包含大量代码。但不确定我们是否安装了 roo,是否还需要将它们添加到版本控制中。或者它们可以每次生成,我想不是。但想从已经完成此操作的人那里得到。
log.roo - 我想这是非常重要的文件,我将保留它,因为它可以重新生成我的项目。
eclipse .classpath/.project 文件 - 我总是将它们保留在版本控制中,只是为了让设置对我可用。但不确定什么是最佳实践,因为我总是面临由于开发机器本地路径而导致的类路径问题。
单元测试文件 - 我希望将它们保留在版本控制中。我浏览了 ST 上的这个帖子 但请分享您对此的想法。
目标目录内容 - 我认为可能将其保留为版本控制中的空目录可能会很好,但希望对此有更多想法。
I am starting on a spring roo Project and noticed that there are many files such as
AspectJ (.aj) files - I think these are important files since they contain lot of code. But not sure if we have roo installed do we still need to add these to version control. Or they can be generated everytime, I guess not. But would like to here from people who have done this.
log.roo - I guess this is very important file I will keep this since it can regenerate my project.
eclipse .classpath/.project files - I always keep them in version control just to keep setup available for me. But not sure what is the best practice since I always faced the classpath problems due to dev machine local paths.
Unit Test files - I will want to keep them in version control. I browsed this thread on ST But do share your thoughts on this.
target directory content - I am thinking may be keeping this as empty directory in version control can be good, but would like to get more thoughts on it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
其中一些文件必须处于版本控制中,其余文件可以,但不是必须如此。一般来说,将所有内容添加到版本控制中会让事情变得更容易。让我解释一下:
这些文件不需要处于版本控制中,因为它们可以由 roo 重新生成。不过,我建议将它们放入,以便使用 STS 的人员可以简单地检查该项目并开始工作,甚至不需要安装 Spring Roo。
同样,不是必需的,但可能是一个好主意,以便您可以重新创建项目,或者只是记录已完成的操作。
如果您要在项目中使用 STS,则这些文件是必需的。如果没有它们,您将无法轻松地将项目导入 STS。当然,Spring Roo 可以在很大程度上重新生成这些文件,但它需要在命令行上运行一些东西才能在 STS 中使用它们。
我认为出于链接问题中指定的所有原因不将这些文件添加到版本控制中是愚蠢的。
在此处的所有内容中,这是我建议忽略的唯一目录。目标目录包含构建工件,而不是项目工件。
Some of these files must be in version control and the rest can be, but don't have to. In general, it would make things easier to add everything to version control. Let me explain:
These don't need to be in version control because they can be regenerated by roo. However, I'd recommend putting them in so that someone working with STS can simply check out the project and start working without even requiring Spring Roo to be installed.
Again, not required, but probably a good idea so that you can recreate the project, or simply have a record of what has been done.
These are required if you are to use STS with your project. You cannot easily import your project into STS without them. Of course, Spring Roo can largely regenerate these files, but it requires running something on the command line before being able to use them in STS.
I think it is silly not to add these to version control for all the reasons specified in the linked question.
Out of everything here, this is the only directory I'd recommend leaving out. The target directory contains build artifacts, not project artifacts.
我同意安德鲁的观点,但以下例外除外。
您应该添加 /src 文件夹的全部内容。虽然它包含 Spring Roo 生成的工件,但这些工件是项目源,如果没有它们,您将无法使用 CI 工具构建项目。
您绝对应该将 pom.xml 添加到版本控制中。我认为这个 Maven 的 POM 是 Spring Roo 生成的最重要的工件之一。使用 POM,您可以在其他 Maven 任务(例如构建和报告)中配置 IDE 项目设置。
因此,如果您拥有这两部分(/src 和 pom.xml),那么您就拥有了可构建的项目,任何团队成员都可以轻松地将其与任何 Java IDE 一起使用。
我不同意安德鲁的观点,你应该存储 .classpath/.project 文件。它们与 IDE 密切相关,对于 IntelliJ IDEA 或 NetBeans 用户来说毫无用处。最好在使用 Spring Roo
或 Maven
检查源代码后生成这些文件。它们是等效的。
当然,您不应该添加任何 /target 或 /bin 文件夹。
所以只需添加/src、pom.xml 和log.roo 即可。就够了。
I agreed with Andrew except the following exceptions.
You should add all the content of the /src folder. Although it contains Spring Roo generated artifacts but these artifacts are project sources and your can't build project without them using CI tools.
You definitely should add pom.xml to the version control. I consider this Maven's POM as one of the most important artifacts generated by the Spring Roo. Using POM you can configure your IDE projects settings among other Maven tasks (building and reporting for example).
So if you have these two parts (/src and pom.xml) you have buildable project which can be used with any Java IDE easily by any team member.
And I don't agree with Andrew that you should store .classpath/.project files. They are strongly IDE related and useless for IntelliJ IDEA or NetBeans users. It is better to generate these files after checking out sources using Spring Roo's
or Maven's
They are equivalent.
And of course you shouldn't add any /target or /bin folders.
So just add /src, pom.xml and log.roo. It is enought.