【问题标题】:WebApp Unable to find type, How to compile source into target dirWebApp 找不到类型,如何将源代码编译到目标目录中
【发布时间】:2014-05-16 13:46:25
【问题描述】:

基本上我需要 2 个 maven 模块,一个应该通过从另一个继承客户端源来启动应用程序(因为客户端包括入口点)。 因此我有 2 个 .gwt.xml 文件和 pom.xml 文件。

gwt.gwt.xml

<module>

    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.google.gwt.user.User' />
    <inherits name='org.fusesource.restygwt.RestyGWT' />
    <!--Specify the app entry point class. -->
    <entry-point class='com.myapp.admin.client.EntryPoint'/>    

    <source path='client'/>
    <source path='rest'/>
    <source path='consts'/>

</module>

web.gwt.xml

<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.myapp.admin.gwt' /> 

POM 客户端(gwt),包装:jar

<plugins>
    <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
            <execution>
                <id>attach-sources</id>
                <phase>verify</phase>
                <goals>
                    <goal>jar-no-fork</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>

POM 网页,包装:战争

    <!-- GWT Maven Plugin -->
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>compile</goal>
                </goals>
            </execution>
        </executions>

<!-- Copy static web files before executing gwt:run -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>

</plugin>

此外,它还包含与 gwt-module &lt;classifier&gt;sources&lt;/classifier&gt; 的依赖关系。我可以毫无错误地编译我的应用程序,但我无法运行它,因为

[错误] [web] - 找不到类型 'com.myapp.admin.client.EntryPoint' [错误] [web] - 提示:检查类型名称 'com.myapp.admin.client.EntryPoint' 是否真的是你的意思 [错误] [web] - 提示:检查您的类路径是否包含所有必需的源根目录

这是合理的,因为目录中没有源。但是为什么没有来源呢?

感谢您的帮助。

【问题讨论】:

  • 你(试图)如何运行你的项目?
  • 嗨。我正在使用日食。使用 run config -war "path to SNAPSHOT" com.myapp.admin.web (+port 参数等)

标签: google-app-engine maven gwt


【解决方案1】:

当使用带有“从工作区解析依赖项”的 M2Eclipse 时,类型不同于 jar(例如 java-source)或分类器的依赖项都解析为 Eclipse 项目的 target/classes,所以你不要实际上在你的类路径中获取源代码。

AFAIK,Google Plugin for Eclipse 采用 M2Eclipse 的类路径,因此您不会在那里获得源代码。您需要编辑启动配置以将您依赖的项目的源目录(src/main/java 和可能的其他目录)添加到类路径中。

【讨论】:

    猜你喜欢
    • 2018-01-28
    • 2021-05-10
    • 2015-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多