[
https://issues.apache.org/jira/browse/MASSEMBLY-875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16359035#comment-16359035
]
Stu commented on MASSEMBLY-875:
-------------------------------
Ok, I'll get this pushed to a public repo, but for now, I created an empty
project (using maven-archetype-quickstart, and deleting the tests):
{code:java}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shareplaylearn</groupId>
<artifactId>MASSEMBLY-875</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MASSEMBLY-875</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.shareplaylearn</groupId>
<artifactId>MASSEMBLY-875-lib</artifactId>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
{code}
I then created another dummy project (no source code) for the lib:
{code}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shareplaylearn</groupId>
<artifactId>MASSEMBLY-875-lib</artifactId>
<version>1.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MASSEMBLY-875-lib</name>
<url>http://maven.apache.org</url>
<!-- add deployment repo here -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<!-- Ensure that source code is packaged and deployed for inclusion
into IDEs -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-source</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>2.1.5</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.13.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
{code}
I deployed the lib to a local repo, and then built the original project.
With maven assembly 3.1.0 -> over a minute to build the final
-with-dependencies jar (close to 2 min!):
{code}
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:42 min
[INFO] Finished at: 2018-02-09T14:05:14-08:00
[INFO] Final Memory: 211M/2644M
{code}
With maven assembly 2.6 -> a little over 2 seconds.
{code}
[INFO] Building jar:
/home/stuart.smith/workspace/MASSEMBLY875/target/MASSEMBLY-875-1.1-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.231 s
[INFO] Finished at: 2018-02-09T14:06:34-08:00
[INFO] Final Memory: 56M/408M
{code}
I'll start whittling away the dependencies in the lib, and see what happens
there.
> Maven 3.x is about 10x slower than 2.6
> --------------------------------------
>
> Key: MASSEMBLY-875
> URL: https://issues.apache.org/jira/browse/MASSEMBLY-875
> Project: Maven Assembly Plugin
> Issue Type: Bug
> Reporter: Stu
> Priority: Minor
>
> In all our java projects, we have a fairly basic assembly configuration,
> something like this:
> {code:java}
> <plugin>
> <artifactId>maven-assembly-plugin</artifactId>
> <version>2.6</version>
> <configuration>
> <archive>
> <manifest>
> <mainClass>org.x.x.x</mainClass>
> </manifest>
> </archive>
> <descriptorRefs>
> <descriptorRef>jar-with-dependencies</descriptorRef>
> </descriptorRefs>
> </configuration>
> <executions>
> <execution>
> <id>make-assembly</id>
> <phase>package</phase>
> <goals>
> <goal>single</goal>
> </goals>
> </execution>
> </executions>
> </plugin>{code}
> They all take about 10x longer with any 3.x.x version of the maven assembly
> plugin than the 2.6 version.
> This has been noticed by others:
> [https://stackoverflow.com/questions/9009232/what-sort-of-configuration-issues-or-problems-might-make-maven-assembly-plugin-g/24519615#24519615]
> But not reported as a bug that I could find.
> Although I could only justify "Minor" for the priority, this is really is a
> blocker for us moving to 3.x.x
> The upgrade is just not worth taking your build from < 10 sec to > 50 sec.
> (For this particular build, it went from about ~ 7 sec to ~ 57 sec.)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)