I am going to optimize time of building our projects. One of the most time-consuming thing is a compilation of the projects.
我要优化我们项目建设的时间。最耗时的事情之一是汇编项目。
Due to known problem of the maven mentioned in particular here: Maven incremental building we have to use mvn clean before every building process.
由于这里提到的maven的已知问题:maven增量构建,我们必须在每次构建过程之前使用mvn clean。
I have investigated this question and found out two approaches:
我研究了这个问题,发现了两种方法:
- Incremental-build-plugin Maven Mojo
- Incremental-build-plugin Maven魔力
- Maven 2 Reactor Plugin
- Maven 2反应堆插件
I have tested Incremental-build-plugin Maven Mojo and it looks pretty good. As I see Maven 2 Reactor Plugin implements almost the same functionality but the special command should be specified to achieve results (mvn reactor:make for instance).
我已经测试了增量构建插件Maven Mojo,它看起来很不错。正如我看到的Maven 2反应器插件实现了几乎相同的功能,但是应该指定特殊的命令来实现结果(例如mvn反应器:make)。
So I have made conclusion that Maven 2 Reactor Plugin is more convenient only for developers if they are going to optimize time of the buildings on their local computers. But I have some hesitation because Maven 2 Reactor Plugin is hosted and (as I think) is supported as official maven plugin, but Incremental-build-plugin Maven Mojo is hosted on java.net.
因此我得出的结论是,Maven 2反应器插件只有在开发人员优化本地计算机上的建筑时间时才更方便。但是我有点犹豫,因为Maven 2反应器插件是托管的,并且(我认为)作为官方的Maven插件被支持,但是增量构建插件Maven Mojo是托管在java.net上的。
And my questions are:
和我的问题是:
- Are my conclusions that these two plugins solve almost the same problem right?
- 我的结论是这两个插件解决了几乎相同的问题,对吗?
- Do anybody has any experience using both of these plugin and able to give any feed back about them?
- 有谁有使用这两个插件的经验,并能提供任何关于他们的反馈吗?
- Do you have other ideas of optimization of the building?
- 你对建筑的优化有其他想法吗?
3 个解决方案
#1
3
Both plugins mentioned above won't speed up your compile time for your usecase. if you want to speed up your compile time I'd propose you update to maven 3 with parallel build support.
上面提到的两个插件都不会提高usecase的编译时间。如果您想加快编译时间,我建议您使用并行构建支持更新到maven 3。
However, what is done with the plugins described above can also be achieved out of the box with maven3, except the svn related features of the reactor plugin. for this you'd need jenkins as mentioned in the previous post.
然而,使用上述插件所做的事情也可以通过maven3直接实现,除了svn相关的反应器插件特性。为此,您需要前面提到的jenkins。
useful maven 3 features to speed up your build:
有用的maven 3特性可以加速您的构建:
mvn clean compile -T 3 (using three threads for paralell builds)
mvn -amd -pl groupid:arifactId (builds the specified projects and all dependent artifacs)
#2
0
The reactor plugin is more for when you want to build only a subset of your modules within a build, the incremental plugin is more aimed at only building those modules which have changed since the last compile.
反应器插件更适合当你想在构建中只构建模块的子集时,增量插件更倾向于只构建自上次编译以来发生变化的模块。
While I can see you using either to the same effect, you probably are more interested in the incremental build plugin from what you have said. Whether you can use the two together to make sure you only build the modules/dependencies you need if they have uncompiled changes I don't know.
虽然我可以看到您使用这两种方法来达到相同的效果,但是您可能对增量构建插件更感兴趣。我不知道您是否可以同时使用这两个模块来确保您只构建需要的模块/依赖项,如果它们有未编译的更改的话。
PS - I think the clean bug has been fixed in the latest incremental build plugin release.
我认为这个干净的bug已经在最新的增量构建插件版本中得到了修复。
#3
-1
Have you tried using Jenkins (or Hudson)? It's pretty nice and managing many small, dependent projects. It's also very easy to set up on a server. I would recommend at least trying it. To set up a server and configure 20 maven projects only takes a few minutes.
你试过使用Jenkins(或Hudson)吗?它非常棒,可以管理许多小型的、依赖的项目。在服务器上设置也很容易。我建议至少尝试一下。设置一个服务器并配置20个maven项目只需要几分钟。
The thing I like about it is that it'll monitor your source control and execute a build every X minutes, and it will successively build any upstream projects automatically.
我喜欢它的一点是,它将监视您的源代码控制并每X分钟执行一次构建,并且它将连续地自动构建任何上游项目。
#1
3
Both plugins mentioned above won't speed up your compile time for your usecase. if you want to speed up your compile time I'd propose you update to maven 3 with parallel build support.
上面提到的两个插件都不会提高usecase的编译时间。如果您想加快编译时间,我建议您使用并行构建支持更新到maven 3。
However, what is done with the plugins described above can also be achieved out of the box with maven3, except the svn related features of the reactor plugin. for this you'd need jenkins as mentioned in the previous post.
然而,使用上述插件所做的事情也可以通过maven3直接实现,除了svn相关的反应器插件特性。为此,您需要前面提到的jenkins。
useful maven 3 features to speed up your build:
有用的maven 3特性可以加速您的构建:
mvn clean compile -T 3 (using three threads for paralell builds)
mvn -amd -pl groupid:arifactId (builds the specified projects and all dependent artifacs)
#2
0
The reactor plugin is more for when you want to build only a subset of your modules within a build, the incremental plugin is more aimed at only building those modules which have changed since the last compile.
反应器插件更适合当你想在构建中只构建模块的子集时,增量插件更倾向于只构建自上次编译以来发生变化的模块。
While I can see you using either to the same effect, you probably are more interested in the incremental build plugin from what you have said. Whether you can use the two together to make sure you only build the modules/dependencies you need if they have uncompiled changes I don't know.
虽然我可以看到您使用这两种方法来达到相同的效果,但是您可能对增量构建插件更感兴趣。我不知道您是否可以同时使用这两个模块来确保您只构建需要的模块/依赖项,如果它们有未编译的更改的话。
PS - I think the clean bug has been fixed in the latest incremental build plugin release.
我认为这个干净的bug已经在最新的增量构建插件版本中得到了修复。
#3
-1
Have you tried using Jenkins (or Hudson)? It's pretty nice and managing many small, dependent projects. It's also very easy to set up on a server. I would recommend at least trying it. To set up a server and configure 20 maven projects only takes a few minutes.
你试过使用Jenkins(或Hudson)吗?它非常棒,可以管理许多小型的、依赖的项目。在服务器上设置也很容易。我建议至少尝试一下。设置一个服务器并配置20个maven项目只需要几分钟。
The thing I like about it is that it'll monitor your source control and execute a build every X minutes, and it will successively build any upstream projects automatically.
我喜欢它的一点是,它将监视您的源代码控制并每X分钟执行一次构建,并且它将连续地自动构建任何上游项目。