我正在以下列方式使用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模型。这是一个罕见的用例,但我认为并行实现是可用的,因为多核处理器已经存在了几十年。怎么用?
答案 0 :(得分:-1)
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
答案 1 :(得分:-3)
您可以在同步方案中引用此POM.xml和项目以进行群集感知,动态和可伸缩并行处理
https://github.com/mulesoft-consulting/dynamic-parallel-processing/blob/master/pom.xml