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

Joshua Pollak commented on MEXEC-43:
------------------------------------

What I mean by "when run from the correct module it will fail because it can't 
locate the dependancies." is this:

setup a multi-module project with two modules, A and B. Module B depends on 
module A. Compile the project from the parent directory. A is compiled, then B. 
Change into the B directory, and run:

mvn -Dexec.mainClass=BMainClass exec:java

This will fail, because the classes in project A will not be found, because A 
has not been installed into the local repository.

HOWEVER, if you run from the parent-pom level and you do the above command, 
with my patch applied, the main class will execute correctly, because Maven 
recognizes that module A is in the same project. Without my patch, Maven 
returns with an error because the exec:java plugin fails when trying to find 
BMainClass in module A (it never gets to module B).

This patch lets you configure your exec plugin to fall through modules which 
don't have the main class you are seeking, and run the class in other modules.



> Patch: failIfNoClass adds the ability to disable failing if no class was 
> found, as well as a better error message
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: MEXEC-43
>                 URL: http://jira.codehaus.org/browse/MEXEC-43
>             Project: Maven 2.x Exec Plugin
>          Issue Type: New Feature
>    Affects Versions: 1.1-beta-1
>            Reporter: Joshua Pollak
>         Attachments: failIfNoClass.patch
>
>
> exec:java is pretty much useless to execute main classes in multi-module 
> projects (without first installing) because the exec:java command can't be 
> run from the top level pom because it will fail with class not found, and 
> when run from the correct module it will fail because it can't locate the 
> dependancies.
> This patch adds the ability to disable the 'fail if class not found' behavior 
> via the 'failIfNoClass' property. If set to false the plugin will NOT fail if 
> the Java class specified is not found. This is useful in a multi-module 
> project where you might want to exec a class in one module which won't be 
> found in other modules.
> The default value of failIfNoClass is TRUE, which preserves the current 
> behavior.
> This patch also adds a constructive error in the case where failIfNoClass is 
> true, and no class is found. In the past, just the string "null" was 
> displayed.

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