Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gwt:add-super-sources will not copy the sources to classpath #51

Closed
branflake2267 opened this issue Jan 1, 2016 · 8 comments
Closed

Comments

@branflake2267
Copy link

Running mvn gwt:add-super-sources to the classpath. Where mvn package will copy it. I'm trying to figure out how to debug the mojo, so I'm not sure what's going on yet. What'd I'd really like to happen is trigger it on some other phase, but I can't do that b/c it won't run by it self.

<properties>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties>

<build>
    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
</build>

<plugin>
  <groupId>net.ltgt.gwt.maven</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>${gwt.maven.plugin.version}</version>
  <extensions>true</extensions>
  <configuration>
    <!-- Eclipse will work with module naming in the gwt-app config only -->
    <moduleName>com.wrightwayeconomy.module</moduleName>
    <moduleShortName>module</moduleShortName>
    <webappDirectory>${webappDirectory}</webappDirectory>
    <launcherDir>${webappDirectory}</launcherDir>
    <startupUrls>
      <startupUrl>Project.html</startupUrl>
    </startupUrls>
  </configuration>
  <executions>
    <!-- Generate the module and add it to the webappDirectory/classes/... -->
    <execution>
      <id>gwt-generate</id>
      <phase>generate-sources</phase>
      <goals>
        <goal>generate-module</goal>
        <goal>add-super-sources</goal>
      </goals>
    </execution>
  </executions>
</plugin>
@branflake2267
Copy link
Author

Here is what I would expect the goal to do, copy the super source into the classes directory, except it doesn't do it with only running mvn gwt:add-super-sources.

screen shot 2015-12-31 at 11 30 51 pm

@branflake2267
Copy link
Author

Looks like a MavenResourcesExecution needs to be invoked in the execute path.

@branflake2267
Copy link
Author

I copied MavenResourcesExecution from import sources into add super sources mojo execution path, and it worked. Is this something you can fix or would you like me to try to add a PR for it tomorrow?

@tbroyer
Copy link
Owner

tbroyer commented Jan 1, 2016

gwt:add-super-sources only declares a <resource> programmatically so that we can have sane defaults in the lifecycles. The actual copy is done by resources:resources in the process-resources phase (like in any standard Maven project with packaging jar or war).

FYI, the only reason gwt:import-sources does the copying is that it needs to run after the process-resources phase to be able to pick up generated sources (specifically by annotation processors during the compile phase).

@tbroyer tbroyer closed this as completed Jan 1, 2016
@branflake2267
Copy link
Author

Gotcha. I was expecting to run the goal by itself and have it move the resources too. I think it would add some flexibility to the plugin. While I understand the ideal behavior would be not to add the resources twice on some paths of execution I don't see why it wouldn't be a problem to do it all in the goal too. This makes it troublesome to find a good execution path for m2e. I haven't found any workable path yet which means I have to look at other options if I can get anything to work with this plugin.

@tbroyer
Copy link
Owner

tbroyer commented Jan 1, 2016

What's the actual problem with m2e? What does it do (and when) that makes it incompatible with this behavior? Why do you need/want super sources copied to project.build.outputDirectory without also copying other resources?

@branflake2267
Copy link
Author

After you mentioned it should be copied in the resources phases got me to thinking it might be getting wiped so I'm trying to determine if I've got a race condition with another plugin.

M2e in eclipse will add goals to the lifecycles to run. So I need to add the super sources into the classes, so I add the goal gwt:add-super-sources into the pom, which I see m2e picks up. I know it executes it, although since its only adding the resources to the maven project. From what it looks like it's either running after the resources execution, or it's a completely different config its adding the reference to the resources to. The module is generating at the same time, and I see it get added to the classes.

All I really want is the super source get copied to the classes and I'll I want to do is add the goal to the plugin and have m2e pick that up and run it which it's doing it. But that goal I found like you said, is depending on resources:resources running another plugin. This I don't know how works yet, at least I don't know how and when m2e is running resources.

@branflake2267
Copy link
Author

I've been trying to avoid setting up the resource definition with the directory src/main/super, which fixes it. I've tried to avoid that b/c it adds the source folder to the ide, and then errors start to show up, but I forget, that resources are excluded by default. Ugh, so many layers I forget about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants