[ 
http://jira.codehaus.org/browse/MGWT-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=202716#action_202716
 ] 

Richard Allen commented on MGWT-131:
------------------------------------

An added benefit from our approach, is that I have been able to get all of my 
multiple projects on the GWT DevMode classpath without using the 
build-helper-maven-plugin hack described here: 
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/productivity.html.

My pom project that builds the war has {{<modules>}}, so the source directories 
for the multiple projects are known to Maven. All I had to do was add the 
following variable to {{RunMojo}}:

{code}
/**
 * If the executed project is a reactor project,
 * this will contains the full list of projects in the reactor.
 *
 * @parameter expression="${reactorProjects}"
 * @required
 * @readonly
 */
protected List<MavenProject> reactorProjects;
{code}

and add the following code to {{RunMojo.doExecute()}} after the {{JavaCommand}} 
is instantiated:

{code}
if (reactorProjects != null) {
    for (MavenProject project : reactorProjects) {
        List<String> compileSourceRoots = project.getCompileSourceRoots();
        for (String srcRoot : compileSourceRoots) {
            File srcRootFile = new File(srcRoot);
            if (srcRootFile.isDirectory()) {
                getLog().info("Adding compile source to classpath: "
                        + srcRootFile.getPath());
                cmd.withinClasspathFirst(srcRootFile);
            }
        }

        List<Resource> compileResources = project.getBuild().getResources();
        for (Resource resource : compileResources) {
            File resourceRootFile = new File(resource.getDirectory());
            if (resourceRootFile.isDirectory()) {
                getLog().info("Adding compile resource to classpath: "
                        + resourceRootFile.getPath());
                cmd.withinClasspathFirst(resourceRootFile);
            }
        }

        File webappSourceRootFile = new File(project.getBasedir(), 
"src/main/webapp");
        if (webappSourceRootFile.isDirectory()) {
            getLog().info("Adding webapp resource to classpath: "
                    + webappSourceRootFile.getPath());
            cmd.withinClasspathFirst(webappSourceRootFile);
        }
    }
}
{code}

You may call this all a "hack", but it makes our development environment 
significantly more productive, easier to configure via Maven, and easier to 
maintain.

> Plugin attempts to compile projects with 'pom' packaging
> --------------------------------------------------------
>
>                 Key: MGWT-131
>                 URL: http://jira.codehaus.org/browse/MGWT-131
>             Project: Maven 2.x GWT Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Fedora 11, Java 1.6.0_16, Maven 2.2.1, GWT 1.7.1
>            Reporter: Daniel Scott
>            Assignee: nicolas de loof
>            Priority: Minor
>             Fix For: 1.2
>
>
> When the GWT compile goal is enabled for projects which have the 'pom' 
> packaging type, maven attempts to compile the project and fails because no 
> source code is available. The compilation should be disabled by default for 
> projects which have the 'pom' packaging type.

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