maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Peckham" <dave.peck...@gmail.com>
Subject Re: maven-assembly-plugin slow on exit with jar-with-dependencies
Date Fri, 15 Feb 2008 17:43:41 GMT
I found the culprit. It is a shutdown hook in plexus-archiver plugin,
not a call to deleteOnExit. Short term fix is to comment this block
out. Longer term I might make this behavior configurable and submit a
patch. I can imagine adding two config params:

1) <outputDirectory> - if null then default to ${java.io.tmpdir}
2) <cleanUpOnExit> - default to true

Here is the short term solution:

[plexus-archiver-1.0-alpha-8]$ svn diff
src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java
Index: src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java
===================================================================
--- src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java	(revision
7199)
+++ src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java	(working
copy)
@@ -311,6 +311,7 @@

         final File tempDir = FileUtils.createTempFile(
"archived-file-set.", ".tmp", null );

+/*
         Runtime.getRuntime().addShutdownHook( new Thread( new Runnable(){

             public void run()
@@ -326,6 +327,7 @@
             }

         } ) );
+*/

         tempDir.mkdirs();


Cheers,
Dave


On Fri, Feb 15, 2008 at 8:37 AM, Dave Peckham <dave.peckham@gmail.com> wrote:
> Hi,
>
>  I've started using the maven-assembly-plugin to build jars with
>  dependencies. However, it is *extremely* slow to clean up. I suspect
>  it is building tmp files using "deleteOnExit" and then the JVM is
>  deleting them one-by-one. If anyone has any ideas, I'd love to hear
>  them.
>
>  $ time mvn clean package -Dmaven.test.skip=false
>  ...
>  [INFO] ------------------------------------------------------------------------
>  [INFO] Reactor Summary:
>  [INFO] ------------------------------------------------------------------------
>  [INFO] XXX ............................................... SUCCESS [2.859s]
>  [INFO] XXX-core .......................................... SUCCESS [6.885s]
>  [INFO] XXX-slave ......................................... SUCCESS [24.794s]
>  [INFO] XXX-indexer ....................................... SUCCESS [21.832s]
>  [INFO] XXX-webapp ........................................ SUCCESS [4.627s]
>  [INFO] ------------------------------------------------------------------------
>  [INFO] ------------------------------------------------------------------------
>  [INFO] BUILD SUCCESSFUL
>  [INFO] ------------------------------------------------------------------------
>  [INFO] Total time: 1 minute 2 seconds
>  [INFO] Finished at: Fri Feb 15 08:13:06 PST 2008
>  [INFO] Final Memory: 27M/51M
>  [INFO] ------------------------------------------------------------------------
>  real    3m38.507s
>  user    0m35.351s
>  sys     0m26.354s
>
>  As you can see, it spends 2:36 cleaning up the tmp dir. I tried
>  building my own version of the maven-assembly-plugin with the
>  deleteOnExit lines commented out, but it did not improve anything. I
>  have not yet tried more extensive removal of deleteOnExit thoughout
>  maven.
>
>  As a design decision, I don't see why this plugin needs to use tmp
>  space anyway. Seems just as reasonable to use another dir in target.
>  Next "clean" will clear it out more efficiently anyway, rather than on
>  a file-by-file basis.
>
>  Thanks,
>  Dave
>
>  ----
>
>  <plugin>
>   <artifactId>maven-assembly-plugin</artifactId>
>   <configuration>
>     <finalName>XXX-slave</finalName>
>     <appendAssemblyId>false</appendAssemblyId>
>     <descriptorRefs>
>       <descriptorRef>jar-with-dependencies</descriptorRef>
>     </descriptorRefs>
>   </configuration>
>   <executions>
>     <execution>
>       <phase>package</phase>
>       <goals>
>         <goal>attached</goal>
>       </goals>
>       <configuration>
>         <attach>false</attach>
>       </configuration>
>     </execution>
>   </executions>
>  </plugin>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message