gwt maven插件如何在另一个模块pom.xml中添加源jar

gwt maven插件如何在另一个模块pom.xml中添加源jar,gwt,maven,Gwt,Maven,我的应用程序有两个模块,一个是jar,另一个是gwt war。在jar模块(非gwt)pom.xml中,我添加了 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version

我的应用程序有两个模块,一个是jar,另一个是gwt war。在jar模块(非gwt)pom.xml中,我添加了

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-source-plugin</artifactId>
      <version>2.1.2</version>
      <executions>
         <execution>
           <phase>package</phase>
           <goals>
              <goal>jar-no-fork</goal>
           </goals>
         </execution>
      </executions>
     </plugin>
   </plugins>
</build>

org.apache.maven.plugins
maven源插件
2.1.2
包裹
罐子没有叉子
并且成功创建了als-admin-viewer-core-1.0.0-sources.jar。 然后在webapp(一个gwt应用程序)pom.xml中,我想使用这个jar,在片段中,我添加了

 <plugin>
   <groupId>org.codehaus.mojo<groupId>
   <artifactId>gwt-maven-plugin</artifactId>
   <version>2.4.0</version>
   <dependencies>
      <dependency>
    <groupId>hk.gov.ehr.service.tch.als</groupId>
    <artifactId>als-admin-viewer-core</artifactId>
    <version>1.0.0</version>    
   </dependency>
   <dependency>
    <groupId>hk.gov.ehr.service.tch.als</groupId>
    <artifactId>als-admin-viewer-core</artifactId>
    <version>1.0.0</version>
    <classifier>sources</classifier>
   </dependency>
  </dependencies>
  <execution>
  <phase>prepare-package</phase>
  <goals> 
    <goal>compile</goal>
  </goals>
  </executions>
........

org.codehaus.mojo
GWTMaven插件
2.4.0
hk.gov.ehr.service.tch.als
als管理查看器核心
1.0.0    
hk.gov.ehr.service.tch.als
als管理查看器核心
1.0.0
来源
准备包装
编译
........
但当我为这个项目运行maven安装(als admin viewer webapp)时,出现了一个错误 没有hk.gov.ehr.service.tch.als.admin.viewer.core.LogSearchCriteria类型的源代码;您是否忘记继承所需的模块? 提示

有什么问题

我甚至尝试添加

<compileSourcesArtifacts>
  <compileSourcesArtifact>hk.gov.ehr.service.tch.als:als-admin-viewer-core</compileSourcesArtifact>  <!-- groupId:artifactId -->
</compileSourcesArtifacts>

www.hk.gov.ehr.service.tch.als:als admin viewer core



gwt maven插件的一部分,但仍然没有帮助

我认为您忘记了在jar模块中创建“gwt.xml”文件,并在主gwt.xml(在gwt-maven模块中)中继承它

请看

有关详细信息(请参阅“将通用JAR用作GWT库”一节)


还要记住:如果您使用maven source插件来附加源代码,那么您的源代码将随web应用程序一起分发。如果您使用的是“compileSourcesArtifacts”,则可以避免这种副作用。

我认为您忘记了在jar模块中创建“gwt.xml”文件,并在主gwt.xml(在gwt maven模块内)中继承它

请看

有关详细信息(请参阅“将通用JAR用作GWT库”一节)

还要记住:如果您使用maven source插件来附加源代码,那么您的源代码将随web应用程序一起分发。如果您使用的是“compileSourcesArtifacts”,则可以避免这种副作用

<configuration>