[
http://jira.codehaus.org/browse/MGWT-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=174419#action_174419
]
Stefan Hübner commented on MGWT-55:
-----------------------------------
bq. I'm checking the original implementation of
{{CompilerMojo#compilationRequired(String, File)}} to reevluate my point.
OK, I'm trying to describe what I ran into yesterday. Please don't take me
wrong. I just want to explain my point more precisely to explain why I proposed
that patch. I don't want to point my finger on others code for my own
satisfaction. Your plugin is great and I'm just trying to solve a problem we
ran into.
Now with that said, please consider the following project layout:
{noformat}
- project P
\ project W (the web application, packaging type: WAR)
\ project C (the main line of our GWT client code, packaging type: JAR)
\ ....
{noformat}
Project _P_ is the aggregating parent POM to all its submodules, of which _W_
and _C_ are two. _W_ is the actual war-project which employs the
gwt-maven-plugin. _W_ only contains some GWT-module declarations and host pages
and refers to all the other submodules as dependencies. _C_ is the main line of
the GWT client code. Other submodules contain more client-side- and
server-side-code. All submodules carrying GWT client-side code are configured
to copy the sources over to their {{target/classes}}.
Now consider the following implementation of
{{CompilerMojo#compilationRequired(String, File)}} as in r9616 (I've cut out
some irrelevant lines):
{code:java}
for ( Object sourceRoot : getProject().getCompileSourceRoots() )
{
File rootFile = new File( sourceRoot.toString() );
return !scanner.getIncludedSources( rootFile, output ).isEmpty();
}
{code}
What happens when invoking "mvn clean install" on project _P_? When
{{gwt:compile}} is executed, {{compilationRequired()}} enters the for-loop with
a list of "compileSourceRoots". That particular list actually contains the
following item *only*: {{W/src/main/java}} and nothing else. So, since it only
scans that paricular directory of _W_, which doesn't get changed very often
(since main development happens in _C_), it in turn virtually never executes
the GWT compiler! So the packaged war ends up missing any GWT client code.
The second problem with above implementation was, that line 4 ("return
!scanner...") stops the loop on the very first item, even if there were more
items in the list. Instead it should scan all items until it finds an item for
which the scanner returns a non empty lits. It should only return {{false}}, if
the scanner doesn't find any changes on any list item.
This is just a more verbose explanation of our particular problem, which
motivated the provided patch. I hope that helps clarifying your concerns with
the patch. The patch wasn't intended to improve productivity. Rather it makes
the plugin usefull for us in the first place.
Best regards!
Stefan
> Consider (re)sourcesOnPath when checking for required compilation
> -----------------------------------------------------------------
>
> Key: MGWT-55
> URL: http://jira.codehaus.org/browse/MGWT-55
> Project: Maven 2.x GWT Plugin
> Issue Type: Improvement
> Affects Versions: 1.1
> Reporter: Stefan Hübner
> Assignee: nicolas de loof
> Priority: Minor
> Fix For: 1.1
>
> Attachments: MGWT.patch
>
>
> In our multi-module project CompileMojo doesn't notice changed sources, if
> those sources reside in a module which is a sibbling to the WAR module. So
> the application won't get recompiled. This is because
> {{CompileMojo#compilationRequired()}} doesn't respect {{sourcesOnPath}} and
> {{resourcesOnPath}}.
> Attached is patch to fix this behaviour. It has been tested on our projects.
> Cheers!
> Stefan
--
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