Git Product home page Git Product logo

Comments (8)

tbroyer avatar tbroyer commented on May 31, 2024

Did you use the dev profile (using either -Ddev or -Pdev) ? It adds the shared modules' sources to the client modules' resources so they're available to GWT.

There might however be a class of changes that require running javac again and relaunching DevMode / SDM.

from gwt-maven-archetypes.

reinert avatar reinert commented on May 31, 2024

Yeah, I was using dev profile.

The problem was related to the resources inclusion.

The only way I could get it to work was adding sources instead of resources in the compie phase.

The build-helper-maven-plugin was configured as following:

<phase>compile</phase>
<goals>
  <goal>add-resource</goal>
</goals>
<configuration>
  <resources>
    <!-- Only sources, resources are already in the classpath, by definition -->
    <resource>
      <directory>${basedir}/../gwtthiago-shared/src/main/java</directory>
    </resource>
  </resources>
</configuration>

I had to change to:

<phase>compile</phase>
<goals>
    <goal>add-source</goal>
</goals>
<configuration>
    <sources>
        <!-- Only sources, resources are already in the classpath, by definition -->
        <source>${basedir}/../gwtthiago-shared/src/main/java</source>
    </sources>
</configuration>

Actually, I don't quite understand why it was configured to include the shared sources as 'resources'. Was it supposed to work?

from gwt-maven-archetypes.

tbroyer avatar tbroyer commented on May 31, 2024

You don't want the shared classes to be compiled into the client's target/classes, this is why it was set as add-resource. Now we could maybe use add-source in the process-classes phase? But what we really want is have the sources in the classpath, so add-resource should work as advertized.

What kind of "breaking change" did you do in the shared class? Also, with your add-source setup, did the shared classes imported this way end up being compiled by the maven-compiler-plugin as part of the client build?

from gwt-maven-archetypes.

reinert avatar reinert commented on May 31, 2024

Ok! Now I clearly understand!

Actually my problem wasn't in the client POM, but in shared.

It happens that I'm using gwt-maven-plugin generateAsync goal, and the sources generated in another folder wasn't being compiled!

Although in the client I was referencing the shared generated folder...

<resource>
  <directory>${basedir}/../gwtthiago-shared/target/generated-sources/gwt</directory>
</resource>

... I wasn't including this folder in the shared compilation. So client's compilation couldn't find any compiled classes there, only sources! I solved by adding the generated sources folder in shared compilation with build helper plugin.

Thanks for helping me out!

from gwt-maven-archetypes.

tbroyer avatar tbroyer commented on May 31, 2024

Note: generateAsync should add its output directory to the project's sources without the need for the build-helper-maven-plugin. It's possible however that the generated code wouldn't be packaged in the sources JAR.

from gwt-maven-archetypes.

tbroyer avatar tbroyer commented on May 31, 2024

Actually you were right: gwt-maven-plugin purposefully doesn't add resources to the classpath, so add-source has to be used. Currently working on the fix.

from gwt-maven-archetypes.

reinert avatar reinert commented on May 31, 2024

Why 'purposefully'?

from gwt-maven-archetypes.

tbroyer avatar tbroyer commented on May 31, 2024

See https://jira.codehaus.org/browse/MGWT-350 (and https://jira.codehaus.org/browse/MGWT-348)

from gwt-maven-archetypes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.