我正在使用 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 的斯坦福 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
关于java - 如何并行化 maven-assembly-plugin?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45148408/