Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3360966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:04:54+00:00 2026-05-18T03:04:54+00:00

I need to setup Maven to: a) compile the GWT module b) copy the

  • 0

I need to setup Maven to:

a) compile the GWT module

b) copy the *.java files in the jar (so it can be imported in another GWT module)

c) copy the result of the compilation step in the jar (so it can be used on a server as is)

Does any one know how this can be done ?

The basic idea is that I want to decouple my GWT project from my Spring MVC project and remove any dependencies that the Spring application might have to GWT jars & plug-ins.

That way I can use the GWT modules as pure javascript libraries and load them with org.springframework.js.resource.ResourceServlet directly from the Jar files while still maintaining the flexibility to re-use modules in other GWT projects.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T03:04:54+00:00Added an answer on May 18, 2026 at 3:04 am

    I’m attaching the solution I came up with so others can use it:

    <!-- Set the output directory to something gwt:run can use in hosted mode -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
                <finalName>gwt-build-name</finalName>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>1.6</source>
                            <target>1.6</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>gwt-maven-plugin</artifactId>
                        <version>${gwt.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>compile</goal>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                        </configuration>
                    </plugin>
                    <!-- Attach the resources plugin to the prepare-package phase to include the host page & generated javascript files -->
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>package-generated-javascript</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration> 
                                    <!-- shove everything the compiler produced into the JAR/META-INF/ folder so that Spring resourceServlet can find it -->
                                    <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.build.directory}/${project.build.finalName}</directory>
                                            <includes>
                                                <include>org.yournamehere.Main/**</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>include-host-page</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration> 
                               <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
    
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/main/webapp</directory>
                                            <includes>
                                                <include>**</include>                                        
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
    

    What the above does is change the output directory to target/finalName so that everything ends up under the same directory and attach the resources plugin to the compile, prepare-package phases to copy the GWT compiler output to the build directory. Once everything is there it will end up in the final jar by default.

    This way the build directory contains everything that hosted mode needs to run and everything Spring resources servlet needs to serve the GWT module without any direct dependencies to GWT.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement to create jar files with Maven, but they need to
I need to setup NACHOS java version in Linux and run some simple sample
I need to setup a system where customers can choose to Request a Quote
I have a GWT project set up with multiple module files (they inherit a
I've got a multiple project setup, using Maven and the Findbugs plugin. I need
I need to setup a web app in JBoss to load html files directly
I need to profile a java application for a customer. It's an eclipse/maven project,
I am new to using Maven. I have Java files that have dependencies. Like
I need to setup a DNS server only to resolve the name of our
I need to setup a 2 way SSL communication channel between a .NET/WCF application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.