尝试将 GET 项目从 2.5.1 升级到 2.8.1

Posted

技术标签:

【中文标题】尝试将 GET 项目从 2.5.1 升级到 2.8.1【英文标题】:Trying to Updrade GWT project from 2.5.1 to 2.8.1 【发布时间】:2017-08-17 20:05:26 【问题描述】:

我在执行 maven 全新安装时遇到以下错误。我需要帮助

[错误] org/apache/tapestry/util/text/LocalizedProperties

[信息] 构建失败

[错误] 无法在项目 rpm 上执行目标 org.codehaus.mojo:gwt-maven-plugin:2.8.1:i18n(默认):命令失败,状态为 1: [错误] cmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_80\jre\bin\java" -Xmx512m com.google.gwt.i18n.tools.I18NSync -out C:\ \ elcipseMars-WorkUpdate\rpm\target\generated-sources\gwt -createMessages com...client.Messages"

这是我从 gwt 2.5.1 升级到 gwt 2.8.1 和 java 1.6 到 java 1.8 的 POM 文件

http://maven.apache.org/xsd/maven-4.0.0.xsd">

<properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.8.1</gwtVersion>
    <spring.version>3.2.3.RELEASE</spring.version>
    <spring.security.version>3.1.4.RELEASE</spring.security.version>
    <freemarker.version>2.3.20</freemarker.version>
    <hibernate.version>4.2.3.Final</hibernate.version>
    <junit.version>4.11</junit.version>
    <slf4j.version>1.7.5</slf4j.version>
    <logback.version>1.0.13</logback.version>
    <jcloverslf4j.version>1.6.6</jcloverslf4j.version>
    <server.timeout>60000</server.timeout>
    <finalName>rpm</finalName>
            <gwt.compile.style>OBFUSCATED</gwt.compile.style>
            <!-- <gwt.compile.style>DETAILED</gwt.compile.style> -->
            <gwt.extra.jvm.args>-Xmx512m</gwt.extra.jvm.args>
            <maven.surefire.additional.classpath.element.directory>src/main/resources/local</maven.surefire.additional.classpath.element.directory>

    <guice.version>3.0</guice.version>
    <!-- GWT needs at least java 1.5 -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <webappDirectory>$project.build.directory/$project.build.finalName</webappDirectory>
    <outputWebDirectory>$webappDirectory/WEB-INF</outputWebDirectory>
    <outputClassDirectory>$outputWebDirectory/classes</outputClassDirectory>
    <server.deploy.backup>backup</server.deploy.backup>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <quartz.version>1.8.6</quartz.version>

            <selenium.java.version>2.45.0</selenium.java.version>
            <opencsv.version>2.3</opencsv.version>
    <!-- <property name="hibernate.c3p0.testConnectionOnCheckout" value="true" /> -->

</properties>




    <repository>
        <id>java net</id>
        <url>http://download.java.net/maven/2</url>
    </repository>

    <repository>
        <id>iblio</id>
        <name>iblio</name>
        <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
    </repository>

    <repository>
        <id>ge_repo</id>
        <url>http://repo.capital.ge.com/artifactory/repo</url>
    </repository>

    <repository>
        <id>spring-maven-releases</id>
        <name>Springframework Maven Repository</name>
        <url>http://maven.springframework.org/releases</url>
    </repository>

    <repository>
        <id>JBoss</id>
        <name>JBoss Repository</name>

</repositories>


<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>net.customware.gwt.dispatch</groupId>
        <artifactId>gwt-dispatch</artifactId>
        <version>1.2.0</version>
    </dependency>

<dependency>
   <groupId>com.oracle</groupId>
   <artifactId>ojdbc6</artifactId>
   <version>11.2.0.4</version>
   <scope>system</scope>
   <systemPath>$basedir/lib/ojdbc6.jar</systemPath>
 </dependency>


    <!-- <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>classes12</artifactId>
        <version>10.2.0.2.0</version>
    </dependency> -->

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>$slf4j.version</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>

    <dependency>
        <groupId>com.lowagie</groupId>
        <artifactId>itext</artifactId>
        <version>2.0.7</version>
    </dependency>

    <!-- Necesario a partir de GWT 2.3.0 -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <classifier>sources</classifier>
        <scope>provided</scope>
    </dependency>

    <!-- jsr 303 (javax.validation) provider -->
    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-core</artifactId>
        <version>0.3-incubating</version>
    </dependency>

    <dependency>
        <groupId>org.apache.bval</groupId>
        <artifactId>bval-jsr303</artifactId>
        <version>0.3-incubating</version>
    </dependency>

    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>

    <!-- POI -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.9</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>3.9</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.9</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9</version>
        <exclusions>
            <exclusion>
                <artifactId>xml-apis</artifactId>
                <groupId>xml-apis</groupId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>$spring.version</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>$spring.version</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>$spring.version</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>$spring.version</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>$spring.version</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.7.0</version>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.7.0</version>
    </dependency>

    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>$freemarker.version</version>
    </dependency>

    <!-- Allow us to use jsr-330 -->
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
        <classifier>sources</classifier>
        <scope>provided</scope>
        <type>jar</type>
    </dependency>

    <dependency>
        <groupId>com.google.gwt.inject</groupId>
        <artifactId>gin</artifactId>
        <version>2.1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>$guice.version</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.3.148</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>$junit.version</version>
        <scope>test</scope>
    </dependency>

    <!-- <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> 
        <version>1.1</version> <exclusions> <exclusion> <artifactId>servlet-api</artifactId> 
        <groupId>javax.servlet</groupId> </exclusion> </exclusions> </dependency> -->

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>$spring.security.version</version>
    </dependency>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.3</version>
    </dependency>

    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>$spring.security.version</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>$spring.security.version</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>$spring.security.version</version>
    </dependency>

    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>jsr250-api</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.2.1</version>
        <exclusions>
            <exclusion>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
            </exclusion>
            <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.1</version>
    </dependency>

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache-core</artifactId>
        <version>2.5.0</version>
    </dependency>

    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>

    <!-- <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency> -->

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>$hibernate.version</version>
        <exclusions>
            <exclusion>
                <groupId>asm</groupId>
                <artifactId>asm</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>slf4j-api</artifactId>
                <groupId>org.slf4j</groupId>
            </exclusion>
            <exclusion>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>ejb3-persistence</artifactId>
                <groupId>org.hibernate</groupId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.0.0</version>
    </dependency>

    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.12.1.GA</version>
    </dependency>

    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>$logback.version</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>$jcloverslf4j.version</version>
    </dependency>

    <!-- Spring 3 dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>$spring.version</version>
    </dependency>


    <!-- Spring + Quartz need transaction -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>$spring.version</version>
    </dependency>

    <!-- ESAPI -->
    <dependency>
       <groupId>org.owasp.esapi</groupId>
         <artifactId>esapi</artifactId>
       <version>2.1.0</version>
    </dependency>

    <!-- Quartz framework -->
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>1.8.6</version>
    </dependency>

            <!-- OpenCSV -->
            <dependency>
                    <groupId>net.sf.opencsv</groupId>
                    <artifactId>opencsv</artifactId>
                    <version>$opencsv.version</version>
            </dependency>

            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>$selenium.java.version</version>
                <scope>test</scope>
            </dependency>
</dependencies>

<build>
    <!-- Generate compiled stuff in the folder used for developing mode -->
    <outputDirectory>$outputClassDirectory</outputDirectory>
    <finalName>$finalName</finalName>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

        <!-- GWT Maven Plugin -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.8.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                        <goal>i18n</goal>
                    </goals>
                </execution>
            </executions>
            <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                documentation at codehaus.org -->
            <configuration>
                <runTarget>cdf.html</runTarget>
                <hostedWebapp>$webappDirectory</hostedWebapp>
                <i18nMessagesBundle>com.ge.capital.cdf.client.Messages</i18nMessagesBundle>
                <meminitial>256m</meminitial>
                <maxmem>1024m</maxmem>
                <debugSuspend>false</debugSuspend>
                <style>$gwt.compile.style</style>
                                    <extraJvmArgs>$gwt.extra.jvm.args</extraJvmArgs>
                <!-- Uncomment if we need to launch gwt using https -->
                <!-- <server>:ssl</server> -->
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-user</artifactId>
                    <version>$gwtVersion</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-dev</artifactId>
                    <version>$gwtVersion</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-servlet</artifactId>
                    <version>$gwtVersion</version>
                </dependency>

 <dependency>
   <groupId>com.oracle</groupId>
   <artifactId>ojdbc6</artifactId>
   <version>11.2.0.4</version>
   <scope>system</scope>
   <systemPath>$basedir/lib/ojdbc6.jar</systemPath>
 </dependency>

     <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                    <version>2.5</version>
                </dependency>

            </dependencies>
        </plugin>

        <!-- Copy static web files before executing gwt:run -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <webappDirectory>$webappDirectory</webappDirectory>
                <warName>$finalName</warName>
                <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
            </configuration>
        </plugin>
    </plugins>

请帮我解决这个错误。

【问题讨论】:

Java 不是 javascript,JavaScript 也不是 Java 【参考方案1】:

出现问题是因为gwt-maven-plugin 不在您的pom.xml 中,您需要将gwt-maven-plugin 添加到 pom.xml 中,您可以参考 belpw 插件:

<build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.8.1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>generateAsync</goal>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

【讨论】:

codehaus gwt maven 插件被认为已弃用,建议使用新的gwt maven 插件tbroyer.github.io/gwt-maven-plugin【参考方案2】:

首先,您使用的是 JDK 7 而不是 JDK 8 'C:\Program Files\Java\jdk1.7.0_80\jre\bin\java'。

第二,看起来你有一些挂毯依赖冲突。我的建议:

1.在&lt;dependencyManagement&gt;中添加bom依赖

<dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt</artifactId>
    <version>$gwt.version</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

2.移除gwt-maven-plugin里面的依赖

3. 也将 gwt-dev 添加为提供的依赖项(如 gwt-user 依赖项)

【讨论】:

以上是关于尝试将 GET 项目从 2.5.1 升级到 2.8.1的主要内容,如果未能解决你的问题,请参考以下文章

Symfony 更新 2.8 到 3.4

Symfony LTS:如何从 2.8 升级到 3.4?

将crm 4插件项目从visual studio 2005升级到visual studio 2010

从命令行将 vc++6 项目升级到 vc++ 2008

将 Python 项目从 2.7 版本升级到 2.7.4

将 Spring Boot 项目从 JDK 8 升级到 JDK 11