GWT模块...未在项目源或资源中找到 [英] GWT Module ... not found in project sources or resources

查看:138
本文介绍了GWT模块...未在项目源或资源中找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GWT新手。我试图制作一个web应用程序,并使用以下maven配置来配置gwt。我把它放在一个配置文件中,所以只有当配置文件被调用时,gwt才会被编译。



这个配置文件就像:

 <个人资料> 
<个人资料>
< id> gwtCompile< / id>
< build>
< plugins>
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> gwt-maven-plugin< / artifactId>
< version> 2.5.0< / version>
<配置>
< extraJvmArgs> -Xmx512M -Xss1024k< / extraJvmArgs>
< module> com.mycompany.MyMainModule< / module>
< inplace> true< / inplace>
< force> true< / force>
< disableCastChecking> true< / disableCastChecking>
< style> PRETTY< / style>
< warSourceDirectory> $ {basedir} / war< / warSourceDirectory>
< / configuration>
<依赖关系>
< dependency>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
<版本> $ {gwt.version}< / version>
< /依赖关系>
< dependency>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-dev< / artifactId>
<版本> $ {gwt.version}< / version>
< /依赖关系>
< /依赖关系>
<执行次数>
<执行>
< id> compileJS< / id>
<阶段>程序类< /阶段>
<目标>
< goal>编译< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>
< / plugins>
< / build>
< / profile>

运行命令时:

  mvn clean install -Dmaven.test.skip = true -PgwtCompile 

它给了我错误信息:

  GWT模块com.mycompany.MyMainModule在项目源或资源中找不到。 

My MyMainModule.gwt.xml如下所示:

 <?xml version =1.0encoding =UTF-8?> 
< module>
<继承了name ='com.google.gwt.user.User'/>

< entry-point class ='com.mycompany.MyMainModule'/>

< source path ='client'/>
< source path ='shared'/>
< / module>

我可以看到一些在线文档中表示多个模块项目应该有这个错误。但是,mime不是一个多模块项目。



有人可以告诉我这可能出了什么问题吗?

非常感谢。



编辑:



我已经准备好了:

 <资源> 
< resource>
< directory> $ {basedir} / src / main / java< / directory>
<包括>
< include> ** / client / **< / include>
< include> ** / *。gwt.xml< / include>
< / includes>
< / resource>
< resource>
< directory> $ {basedir} / src / main / resources< / directory>
<包括>
< include> ** / *< / include>
< / includes>
< / resource>
< /资源>


解决方案

我找到了解决方案。问题是gwt-maven-plugin中指定的模块必须是.gwt.xml文件的确切路径名,而不是入口点文件。



所以配置文件必须是:

 < configuration> 
< extraJvmArgs> -Xmx512M -Xss1024k< / extraJvmArgs>
< module> com.mycompany.myoroject.MyMainModule< / module>
< inplace> true< / inplace>
< force> true< / force>
< disableCastChecking> true< / disableCastChecking>
< style> PRETTY< / style>
< warSourceDirectory> $ {basedir} / war< / warSourceDirectory>
< / configuration>

因为MyMainModule.gwt.xml位于src / main / com / mycompany / myproject / MyMainModule下。 gwt.xml。



非常感谢您的回答。


I am new to GWT. I tried to make a web application and uses the following maven config to config gwt. I put it in a profile so only when the profile is invoked will the gwt being compiled.

The profile is like:

<profiles>
        <profile>
            <id>gwtCompile</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>gwt-maven-plugin</artifactId>
                        <version>2.5.0</version>
                        <configuration>
                            <extraJvmArgs>-Xmx512M -Xss1024k </extraJvmArgs>
                            <module>com.mycompany.MyMainModule</module>
                            <inplace>true</inplace>
                            <force>true</force>
                            <disableCastChecking>true</disableCastChecking>
                            <style>PRETTY</style>
                            <warSourceDirectory>${basedir}/war</warSourceDirectory>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.google.gwt</groupId>
                                <artifactId>gwt-user</artifactId>
                                <version>${gwt.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.google.gwt</groupId>
                                <artifactId>gwt-dev</artifactId>
                                <version>${gwt.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>compileJS</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

When I run the command:

   mvn clean install -Dmaven.test.skip=true -PgwtCompile

it gave me error message:

GWT Module com.mycompany.MyMainModule not found in project sources or resources.

My MyMainModule.gwt.xml is like this:

<?xml version="1.0" encoding="UTF-8"?>
<module>
    <inherits name='com.google.gwt.user.User' />

    <entry-point class='com.mycompany.MyMainModule' />

    <source path='client' />
    <source path='shared' />
</module>

I can see some online documents said multiple module project is supposed to have this error. But mime is not a multi-module project.

Can someone let me know what possibly went wrong with this?

Many thanks.

EDIT:

I have got this in place:

<resources>
    <resource>
        <directory>${basedir}/src/main/java</directory>
        <includes>
            <include>**/client/**</include>
            <include>**/*.gwt.xml</include>
        </includes>
    </resource>
    <resource>
        <directory>${basedir}/src/main/resources</directory>
        <includes>
            <include>**/*</include>
        </includes>
    </resource>
</resources>

解决方案

I found the solution to this. The problem was that the module specified in the gwt-maven-plugin has to be the exact path name of the .gwt.xml file, not the entry point file.

So the configuration file has to be:

<configuration>
    <extraJvmArgs>-Xmx512M -Xss1024k </extraJvmArgs>
    <module>com.mycompany.myoroject.MyMainModule</module>
    <inplace>true</inplace>
    <force>true</force>
    <disableCastChecking>true</disableCastChecking>
    <style>PRETTY</style>
    <warSourceDirectory>${basedir}/war</warSourceDirectory>
</configuration>

becasue my MyMainModule.gwt.xml is under src/main/com/mycompany/myproject/MyMainModule.gwt.xml.

Many thanks for your answers.

这篇关于GWT模块...未在项目源或资源中找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆