[ 
http://jira.codehaus.org/browse/MEXEC-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=179878#action_179878
 ] 

Mathias Arens commented on MEXEC-68:
------------------------------------

There will be always the two way approach. The question is what is the default 
setting. The advantage of the jar approach is that it works for long and for 
short classpaths. The current approach does only work for short or 'normal' 
length classpaths.

In the surefire plugin this option is called useManifestOnlyJar and it is set 
to true by default. They have a html page on this issue describing the benefits 
of this apporach:

http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html

Here is a copy of the surefire documentation on the useManifestOnlyJar option 
(maybe the option should have the same name in the exec plugin. 'longClasspath' 
is not the best name):

useManifestOnlyJar      boolean         By default, Surefire forks your tests 
using a manifest-only jar; set this parameter to "false" to force it to launch 
your tests with a plain old Java classpath. (See 
http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html
 for a more detailed explanation of manifest-only jars and their benefits.) 
Default value is "true". Beware, setting this to "false" may cause your tests 
to fail on Windows if your classpath is too long. Default value is true.

> classpath too long problem
> --------------------------
>
>                 Key: MEXEC-68
>                 URL: http://jira.codehaus.org/browse/MEXEC-68
>             Project: Maven 2.x Exec Plugin
>          Issue Type: Bug
>          Components: exec
>    Affects Versions: 1.1.1
>         Environment: windows xp, java 1.6
>            Reporter: Mathias Arens
>         Attachments: exec-maven-plugin-long-classpath.patch
>
>
> If you try to run a project main class with a long list of dependencies the 
> classpath grows larger than windows can handle on its command line. The maven 
> exec plugin simply fails when the classpath is getting to large.
> The surefire plugin solves this issue by putting the classpath and the main 
> class into a Manifest.mf file and wrapping it into a jar. I copied the 
> createJar() routine from the ForkConfiguration class from the surefire-booter 
> module to the ExecMojo plus two additional classes.
> I introduced a new attribute to the ExecMojo called longClasspath that can be 
> set from the command line with -Dexec.longClasspath=true. If this flag is set 
> to true a temporary jar file is created and executed.  The command line 
> arguments '-classpath %classpath mainClass' are replaced by '-jar 
> maven-exec.jar' whilst the jar contains the main class and the classpath.
> I added a patch with my current implementation of the ExecMojo class based on 
> revision 9948. The patch works perfectly fine even with maven modules that 
> have long classpaths and where main classes cannot be executed with the 
> current exec-plugin. But in the implementation I made several assumptions on 
> the ordering of the command line arguments. I don't know all the assumptions 
> are valid. At least the patch is a good starting point for a fix of this 
> issue.
> Maybe the default value of the longClasspath attribute should be set to true 
> in further releases because this is the default in the surefire plugin as 
> well. And maybe somebody has a better attribute name for the longClasspath 
> attribute.

-- 
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