从最终战争中排除gwt超级资源

从最终战争中排除gwt超级资源,gwt,maven-3,Gwt,Maven 3,对于具有以下结构的GWT项目: src /java ... /super /java /text /DecimalFormat.java 是否可以只将DecimalFormat.java包含在project-sources.jar中,而不包含在包含编译的.class文件的project.jar中 我目前使用的POM是: <plugin> <groupId>org.

对于具有以下结构的GWT项目:

src
  /java
    ...
  /super
    /java
      /text
        /DecimalFormat.java
是否可以只将DecimalFormat.java包含在project-sources.jar中,而不包含在包含编译的.class文件的project.jar中

我目前使用的POM是:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration combine.self="override">
                    <excludes>
                        <exclude>**/src/emulation/*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/src/emulation/**/*.java</include>
                    </includes>
                </configuration>
            </plugin>
但是以上所有操作都不起作用,因为路径应该是相对于sources文件夹src/java的。 也在努力与。。似乎不起作用

是否有任何插件可以更具体地处理这个问题?我看过托马斯·布罗耶的一些相关作品。但我无法让它在这种情况下工作


谢谢大家!

我无法使用maven source插件,因为某些原因,include和excludes过滤器被完全忽略。然而,在多模块配置中似乎是可能的

父母亲 pom.xml 这是一个有点冗长的例子,因为我在本地实现了它,直到我的代码风格,但是你可以完全忽略它,因为它不是什么新东西,只是两个子模块的父模块

4.0.0 测验 gwt高级 0-SNAPSHOT 聚甲醛 UTF-8 UTF-8 应用程序 模仿 com.google.gwt gwt 2.8.0 聚甲醛 进口 org.apache.maven.plugins maven编译器插件 3.6.1 1.8 1.8 org.apache.maven.plugins maven源插件 3.0.1 org.codehaus.mojo GWTMaven插件 2.8.0 org.apache.maven.plugins maven编译器插件 仿真子模块 仿真/pom.xml 这是Java.text包仿真类的pom。正如我上面所说的,我无法使maven source插件能够很好地与过滤器一起工作,但是由于这个模块是分离的,所以可以很容易地将源代码提供给自动具有源代码分类器的目标源代码JAR文件

4.0.0 测验 gwt高级 0-SNAPSHOT 高级仿真 0 org.apache.maven.plugins maven源插件 包裹 罐子 仿真/src/main/java/java/text/text.gwt.xml 只是一个GWT模块定义,没有什么新的。它也可能位于资源库中,但这更像是一个代码定义,因此出于测试目的,可以在这里使用

仿真/src/main/java/java/text/DecimalFormat.java 仅用于测试目的的模拟类:

包java.text; 公共最终类DecimalFormat{ 私有最终字符串模式; 公共十进制字符串模式{ 这个模式=模式; } 公共字符串格式最终双精度值{ 返回{pattern=+pattern+,value=+value+}; } } 应用子模块 这个pom.xml不包含GWT构建周期,而是隐式地让您自己完成。注意仿真模块依赖项的sources元素——这对于GWT来说是最重要的,因为它只能编译Java源代码,但不能处理Java字节码。提供确保不将依赖项附加到目标工件上,这是不必要的,因为所有JavaScript文件都是生成的,并且在服务器上预编译时不需要Java源代码

app/pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd>

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>test</groupId>
        <artifactId>gwt-advanced</artifactId>
        <version>0-SNAPSHOT</version>
    </parent>

    <artifactId>gwt-advanced-app</artifactId>
    <version>0</version>
    <packaging>war</packaging>

    <dependencies>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-codeserver</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>test</groupId>
            <artifactId>gwt-advanced-emulation</artifactId>
            <version>0</version>
            <scope>provided</scope>
            <classifier>sources</classifier>
        </dependency>

    </dependencies>

    <build>

        <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>

        <plugins>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <configuration>
                    <runTarget>index.html</runTarget>
                    <module>test.ApplicationEntryPoint</module>
                    <copyWebapp>true</copyWebapp>
                </configuration>
            </plugin>

        </plugins>

    </build>

</project>
输出 mvn 用于GWT构建周期的Maven命令 mvn clean gwt:run-启动嵌入式web容器。 mvn clean gwt:compile install-执行gwt编译,主要是生成JavaScript文件,打包war文件并将工件安装到本地存储库;工件可以很容易地部署到Tomcat。 gwt-advanced-app-0.war工件列表: 自从目标war中的WEB-INF/classes/test/ApplicationEntryPoint.class条目之后,可能还有更多需要微调的地方,但是没有提供依赖项的源代码。

能否显示您正在使用的pom.xml?
<?xml version="1.0" encoding="UTF-8"?>
<web-app>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

</web-app>
<!DOCTYPE html>
<html>
<head>
    <title>GWT Test</title>
    <script type="text/javascript" language="javascript" src="test.ApplicationEntryPoint/test.ApplicationEntryPoint.nocache.js"></script>
</head>
<body>
<table>
    <tbody>
    <tr>
        <th>e</th>
        <td id="e"></td>
    </tr>
    <tr>
        <th>pi</th>
        <td id="pi"></td>
    </tr>
    </tbody>
</table>
</body>
</html>
package test;

import java.text.DecimalFormat;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Document;

import static java.lang.Math.E;
import static java.lang.Math.PI;

public final class ApplicationEntryPoint
        implements EntryPoint {

    private ApplicationEntryPoint() {
    }

    @Override
    public void onModuleLoad() {
        final Document document = Document.get();
        final DecimalFormat decimalFormat = new DecimalFormat("###,###.###");
        document.getElementById("e").setInnerText(decimalFormat.format(E));
        document.getElementById("pi").setInnerText(decimalFormat.format(PI));
    }

}
e  | {pattern=###,###.###, value=2.718281828459045}
pi | {pattern=###,###.###, value=3.141592653589793}
Archive:  gwt-advanced-app-0.war
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  xxxx-xx-xx xx:xx   META-INF/
      143  xxxx-xx-xx xx:xx   META-INF/MANIFEST.MF
        0  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/
        0  xxxx-xx-xx xx:xx   WEB-INF/
        0  xxxx-xx-xx xx:xx   WEB-INF/classes/
        0  xxxx-xx-xx xx:xx   WEB-INF/classes/test/
        0  xxxx-xx-xx xx:xx   WEB-INF/deploy/
        0  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/
        0  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/rpcPolicyManifest/
        0  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/symbolMaps/
      349  xxxx-xx-xx xx:xx   index.html
    11323  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/502BBFC907647230FA696491F4CA7597.cache.js
    11318  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/548A93E7618BA4A5D5DDE22181A086C0.cache.js
       43  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/clear.cache.gif
      317  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/compilation-mappings.txt
    11320  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/E664752A6412123C29A3FFF0FEE4665A.cache.js
    11323  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/E891921037077276BDFB0E285016FD1C.cache.js
    11325  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/FE9CAA3D03DD64BC3E380FCDFFCA4614.cache.js
    14981  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/test.ApplicationEntryPoint.devmode.js
     8167  xxxx-xx-xx xx:xx   test.ApplicationEntryPoint/test.ApplicationEntryPoint.nocache.js
     1017  xxxx-xx-xx xx:xx   WEB-INF/classes/test/ApplicationEntryPoint.class
       89  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/rpcPolicyManifest/manifest.txt
    32563  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/symbolMaps/502BBFC907647230FA696491F4CA7597.symbolMap
    32544  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/symbolMaps/548A93E7618BA4A5D5DDE22181A086C0.symbolMap
    32548  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/symbolMaps/E664752A6412123C29A3FFF0FEE4665A.symbolMap
    32553  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/symbolMaps/E891921037077276BDFB0E285016FD1C.symbolMap
    32573  xxxx-xx-xx xx:xx   WEB-INF/deploy/test.ApplicationEntryPoint/symbolMaps/FE9CAA3D03DD64BC3E380FCDFFCA4614.symbolMap
      147  xxxx-xx-xx xx:xx   WEB-INF/web.xml
        0  xxxx-xx-xx xx:xx   META-INF/maven/
        0  xxxx-xx-xx xx:xx   META-INF/maven/test/
        0  xxxx-xx-xx xx:xx   META-INF/maven/test/gwt-advanced-app/
     1579  xxxx-xx-xx xx:xx   META-INF/maven/test/gwt-advanced-app/pom.xml
      106  xxxx-xx-xx xx:xx   META-INF/maven/test/gwt-advanced-app/pom.properties
---------                     -------
   246328                     33 files