Max heap size configuration/maven env setting support
-----------------------------------------------------

                 Key: MCOBERTURA-99
                 URL: http://jira.codehaus.org/browse/MCOBERTURA-99
             Project: Maven 2.x Cobertura Plugin
          Issue Type: New Feature
         Environment: Maven version: 2.0.10
Java version: 1.7.0-ea
OS name: "linux" version: "2.6.24-23-generic" arch: "amd64" Family: "unix"
Cobertura version: 1.9
            Reporter: Trampas Kirk
         Attachments: max_heap_size_setting_support.patch

I have a large maven project (~5600 classes in one module) I'm trying to run 
cobertura on via this plugin, but it runs out of memory for the {{instrument}} 
and {{report}} phases.  Out of the box, the {{site}} goal supports the 
{{maxmem}} configuration parameter, but {{instrument}} and {{report}} do not.  
They would fail with the following set of error messages:


{noformat}[ERROR] GC Warning: Out of Memory!  Returning NIL!
GC Warning: Out of Memory!  Returning NIL!
GC Warning: Out of Memory!  Returning NIL!
Exception in thread "main" GC Warning: Out of Memory!  Returning NIL!
GC Warning: Out of Memory!  Returning NIL!
java.lang.OutOfMemoryError
GC Warning: Out of Memory!  Returning NIL!
*** Catastrophic failure while handling uncaught exception.
{noformat}

In the atttached patch I added support for configuring the amount of memory to 
use in the {{instrumentation}} and {{check}} phases within the configuration in 
the pom.  Additionally, I added functionality whereby the plugin will use the 
same heap size setting as maven itself (the {{-Xmx}} setting from the 
{{MAVEN_OPTS}} environment variable) in all phases.

Here's a sample configuration snippet to use with the patch to specify memory 
for {{check}} and {{instrument}}:
{code:xml}
...
<plugins>
    <plugin>
    <configuration>
    <check>
        <haltOnFailure>false</haltOnFailure>
        <maxmem>512m</maxmem>
    </check>
    <instrumentation>
        <maxmem>512m</maxmem>
    </instrumentation>
</configuration>
...

{code}

I would have preferred to use {{<maxMem>}} as it is a more conventional naming 
style, but the setting already existed in {{AbstractCoberturaMojo}}, 
{{CoberturaReportMojo}} and {{AbstractTask}} and used "maxmem" rather than 
"maxMem" internally, so I followed the existing convention.

I cannot attach a sample project that requires a larger memory setting for 
obvious reasons.  But in my testing I was able to verify that each phase will 
use maven's {{MAVEN_PROPS -Xmx}} setting, and will override the maven one or 
the default if maven does not have one specified with the setting from the 
pom.xml.  Lastly, the plugin was able to complete succesfully on my large 
project once it was able to use enough memory.

The attached patch is intended for the trunk of the plugin located here: 
({{http://svn.codehaus.org/mojo/trunk/mojo/cobertura-maven-plugin}})

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to