Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java gwt maven插件即使在没有更改的情况下也会运行排列_Java_Eclipse_Maven_Gwt_Plugins - Fatal编程技术网

Java gwt maven插件即使在没有更改的情况下也会运行排列

Java gwt maven插件即使在没有更改的情况下也会运行排列,java,eclipse,maven,gwt,plugins,Java,Eclipse,Maven,Gwt,Plugins,我们在产品中使用GWT和mojo GWT maven插件2.4来编译GWT代码。 但是我们观察到,当我们运行mvn安装时,gwt maven插件正在运行排列,即使没有对gwt代码进行任何更改。 在这个问题上苦苦挣扎了一段时间后,我们能够使用2个maven项目通过简单的设置重现它: 第一个项目MygwtAventSampleSource:包含GWT代码和GWT模块xml文件 第二个项目MavenBuilderMod:包含MyGwtMavenSampleSource作为maven依赖项,并将构建wa

我们在产品中使用GWT和mojo GWT maven插件2.4来编译GWT代码。 但是我们观察到,当我们运行mvn安装时,gwt maven插件正在运行排列,即使没有对gwt代码进行任何更改。 在这个问题上苦苦挣扎了一段时间后,我们能够使用2个maven项目通过简单的设置重现它:

第一个项目MygwtAventSampleSource:包含GWT代码和GWT模块xml文件 第二个项目MavenBuilderMod:包含MyGwtMavenSampleSource作为maven依赖项,并将构建war 文件 以下是两个项目的POM:

第一个项目:MyGwtMavenSampleSource

第二个项目:MavenBuilderMod

所以,问题是,我们如何让gwt maven插件/编译器在这种设置中只在代码更改时运行排列


注意:这与预期一样有效,即如果gwt模块xml文件放在包含gwt maven插件的同一个maven模块中,则仅当代码发生更改时才会运行置换,而且gwt maven插件中的增量构建支持可能会被破坏,特别是如果您仍在使用一个2年以上的版本

gwt maven插件在某种程度上看到了gwt.xml文件在您的第一个模块的构建过程中发生了变化,理想情况下,如果没有任何变化,它实际上应该是无操作的;重新复制资源和/或重建JAR可能足以向下触发问题,尤其是比它生成的nocache.js文件更新的问题

我认为更好的设置是在第一个模块中运行GWTMaven插件,并将所有内容打包到ZIP或WAR中,然后将其用作WAR覆盖。不幸的是,这使运行DevMode变得有点困难,但是

<?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">
  <!-- POM file generated with GWT webAppCreator -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>GWTMavenPlugin</groupId>
  <artifactId>MyGwtMavenSampleSource</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>GWT Maven Archetype</name>

  <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.4.0</gwtVersion>
    <!-- GWT needs at least java 1.5 -->
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwtVersion}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwtVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <classifier>sources</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>GWTMavenPlugin</groupId>
  <artifactId>MavenBuilderMod</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.4.0</gwtVersion>
    <!-- GWT needs at least java 1.5 -->
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwtVersion}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwtVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <classifier>sources</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>GWTMavenPlugin</groupId>
      <artifactId>MyGwtMavenSampleSource</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
  <build>
    <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
    <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.8</version>
            <executions>
              <execution>
                <id>src-dependencies</id>
                <phase>package</phase>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <classifier>sources</classifier>
                  <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                  <outputDirectory>${project.build.directory}/sources</outputDirectory>
                </configuration>
              </execution>
            </executions>
        </plugin>
      <!-- GWT Maven Plugin -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.4.0</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
        <!-- Plugin configuration. There are many available options, see 
          gwt-maven-plugin documentation at codehaus.org -->
        <configuration>
          <runTarget>MyGwtMavenSampleSource.html</runTarget>
          <hostedWebapp>${webappDirectory}</hostedWebapp>
          <modules>
            <module>com.ca.gwt.maven.sample.MyGwtMavenSampleSource</module>
        </modules>
        </configuration>
      </plugin>

      <!-- Copy static web files before executing gwt:run -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <executions>
          <execution>
            <phase>compile</phase>
          </execution>
        </executions>
        <configuration>
          <webappDirectory>${webappDirectory}</webappDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>