[英]How to parallelize maven-assembly-plugin?
我通过以下方式使用maven-assumbly-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
<!-- necessary in order to avoid
`Error reading assemblies: No assembly
descriptors found.` -->
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
并注意到它在打包大型依赖项时非常慢,例如具有多个 100MB 的 Stanford CoreNLP 模型。 这是一个罕见的用例,但我认为并行实现是可用的,因为多核处理器已经存在了几十年。 如何使用它?
Maven 3.x 具有执行并行构建的能力。 命令如下:
mvn -T 4 clean install # Builds with 4 threads
mvn -T 1C clean install # 1 thread per cpu core
mvn -T 1.5C clean install # 1.5 thread per cpu core
您可以参考此POM.xml和项目以在同步方案中进行群集感知,动态和可伸缩的并行处理
https://github.com/mulesoft-consulting/dynamic-parallel-processing/blob/master/pom.xml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.