GWT Maven 项目编译失败 - 没有可用于类型的源代码



我已经处理这个问题几个小时了。

尝试编译 Maven GWT 项目,在 GWT 编译点收到以下错误:

[INFO] 编译模块 com.ephesoft.dcma.gwt.login.Login
[信息] 验证新编译的单位
[信息] [错误]'jar:file:/D:/workspace2/dcma-root/dcma-gwt/dcma-gwt-core/target/dcma-gwt-core-0.0.14-> SNAPSHOT.jar!/com/ephesoft/dcma/gwt/core/client/validator/ValidatorFactory.java'
中的错误 [信息] [错误]第 47 行:没有可用于 com.ephesoft.dcma.core.common.DataType 类型的源代码;您是否忘记继承所需的模块?
[信息] [错误]'jar:file:/D:/workspace2/dcma-root/dcma-gwt/dcma-gwt-core/target/dcma-gwt-core-0.0.14-SNAPSHOT.jar!/com/ephesoft/dcma/gwt/core/client/ui/RotatableImage.java'
中的错误 [信息] [错误]第 54 行:没有可用于 com.ephesoft.dcma.batch.schema.Direction 类型的源代码;您是否忘记继承所需的模块?
[信息] [错误]'jar:file:/D:/workspace2/dcma-root/dcma-gwt/dcma-gwt-core/target/dcma-gwt-core-0.0.14-SNAPSHOT.jar!/com/ephesoft/dcma/gwt/core/shared/comparator/DocumentTypeComparator.java'
中的错误 ...
...

这样的例子不胜枚举...

这是我的网络应用程序POM文件 -
dcma-root\dcma-webapp\pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>war</packaging>
    <parent>
        <groupId>com.ephesoft.dcma</groupId>
        <artifactId>dcma-gwt</artifactId>
        <version>0.0.14-SNAPSHOT</version>
        <relativePath>../dcma-gwt</relativePath>
    </parent>
    <artifactId>dcma-webapp</artifactId>
    <name>DCMA: Web application Model</name>
    <description>The DCMA web Application model.</description>
    <dependencies>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-home</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-login</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-review-validate</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-admin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-folder-monitor</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-heart-beat</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-mail-import</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-batchInstance</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-reporting</artifactId>
        </dependency>       
        <dependency>
            <groupId>com.ephesoft.dcma</groupId>
            <artifactId>dcma-gwt-upload-batch</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                        <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
                        <projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                        <buildcommand>com.google.gwt.eclipse.core.gwtProjectValidator</buildcommand>
                        <buildcommand>com.google.appengine.eclipse.core.enhancerbuilder</buildcommand>
                    </additionalBuildcommands>
                    <classpathContainers>
                        <classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</classpathContainer>
                    </classpathContainers>
                    <wtpversion>1.5</wtpversion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <configuration>
                            <modules>
                                <module>com.ephesoft.dcma.gwt.core.Core</module>
                                <module>com.ephesoft.dcma.batch.Batch</module>
                                <module>com.ephesoft.dcma.gwt.login.Login</module>
                                <module>com.ephesoft.dcma.gwt.admin.bm.BatchClassManagement</module>
                                <module>com.ephesoft.dcma.gwt.home.BatchList</module>
                                <module>com.ephesoft.dcma.gwt.rv.ReviewValidate</module>
                                <module>com.ephesoft.dcma.gwt.batchInstance.BatchInstance</module>
                                <module>com.ephesoft.dcma.gwt.reporting.Report</module>
                                <module>com.ephesoft.dcma.gwt.uploadbatch.UploadBatch</module>
                            </modules>
                            <localWorkers>2</localWorkers>
                            <extraJvmArgs>-Xmx768m</extraJvmArgs>
                            <sourcesOnPath>false</sourcesOnPath>
                            <force>true</force>
                        </configuration>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>stand-alone</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.1.1</version>
                        <executions>
                            <execution>
                                <phase>test</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <mainClass>com.ephesoft.dcma.webapp.DCMAExecuter</mainClass>
                                    <arguments>
                                        <argument>none</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
dcma-root\dcma-gwt\

dcma-gwt-login\src\main\java\com\ephesoft\dcma\gwt\login\Login.gwt.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-source/core/src/gwt-module.dtd">
<module rename-to='login'>
    <inherits name='com.google.gwt.user.User' />
    <inherits name='com.ephesoft.dcma.gwt.core.Core' />
    <entry-point class='com.ephesoft.dcma.gwt.login.client.LoginEntryPoint' />
</module>
dcma-root\dcma-gwt\dcma-gwt-core\

src\main\java\com\ephesoft\dcma\gwt\core\Core.gwt.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='core'>
    <inherits name='com.google.gwt.user.User' />
    <source path='client' />
    <source path='shared' />
    <inherits name="com.googlecode.gwt.math.Math" />
    <inherits name="com.ephesoft.dcma.batch.Batch" />
    <inherits name="com.ephesoft.dcma.core.Common" />
    <inherits name="com.ephesoft.dcma.da.Property" />
    <inherits name="com.google.gwt.i18n.I18N" />
    <inherits name='com.google.gwt.user.theme.standard.Standard' />
    <stylesheet src='css/style.css' />

</module>
dcma-root\

dcma-gwt\dcma-gwt-core\src\main\java\com\ephesoft\dcma\core\Common.gwt.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='coreCommon'>
    <inherits name='com.google.gwt.user.User' />
    <source path="common" />
</module>
所以登录包括核心,而

核心又包括通用,那么问题是什么?

我将非常感谢您的帮助!!

如果我

正确理解了这个问题,你需要编译依赖于另一个的gwt模块?对于我们在依赖模块中使用的该任务

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>${gwt.version}</version>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <extraJvmArgs>-Xmx1024M</extraJvmArgs>
      <localWorkers>3</localWorkers>
      <optimizationLevel>${gwt.optimize}</optimizationLevel>
      <style>OBF' -XenableClosureCompiler '-XenableClosureCompiler</style>
      <workDir>${project.build.directory}/gwt/temp</workDir>
      <deploy>${project.build.directory}/WEB-INF/deploy</deploy>
      <modules>
        <module>${module}</module>
      </modules>
      <hostedWebapp>${webappDirectory}</hostedWebapp>
      <logLevel>WARN</logLevel>
      <compileSourcesArtifacts>
        <compileSourcesArtifact>groupId:artifactId</compileSourcesArtifact>
      </compileSourcesArtifacts>
    </configuration>
  </plugin>

<compileSourcesArtifact>groupId:artifactId</compileSourcesArtifact>看起来像<compileSourcesArtifact>com.google.gwt:gwt-user</compileSourcesArtifact>和核心模块的位置

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <executions>
      <execution>
        <id>attach-sources</id>
        <phase>package</phase>
        <goals>
          <goal>jar</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

为了编译依赖于另一个 maven 模块的 GWT 模块,我必须显式地将依赖项添加到依赖项的来源:

<dependency>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <classifier>sources</classifier>
    <scope>compile</scope>
</dependency>
当然,从

依赖项中部署源,如@Teymur所述:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>3.2.0</version>
    <executions>
        <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
                <goal>jar-no-fork</goal>
            </goals>
        </execution>
    </executions>
</plugin>

这在没有<compileSourcesArtifacts>设置的情况下工作。

相关内容

  • 没有找到相关文章

最新更新