我在我的GWT
網絡應用中使用客戶端驗證,Maven
作爲構建工具。在開發模式下運行不會導致任何問題。現在我想用Maven
建項目,但得到多個錯誤,如下:gwt-maven-plugin無法編譯,因爲「沒有源代碼可用於類型org.hibernate.validator.constraints.impl.SizeValidatorForString;」
[ERROR] Line 52: No source code is available for type org.hibernate.validator.constraints.impl.SizeValidatorForString; did you forget to inherit a required module?
[INFO] [ERROR] Line 52: No source code is available for type org.hibernate.validator.constraints.impl.SizeValidatorForCollection; did you forget to inherit a required module?
[INFO] [ERROR] Line 52: No source code is available for type org.hibernate.validator.constraints.impl.SizeValidatorForMap; did you forget to inherit a required module?
[INFO] [ERROR] Line 75: No source code is available for type org.hibernate.validator.constraints.impl.NotNullValidator; did you forget to inherit a required module?
[INFO] [ERROR] Line 83: No source code is available for type org.hibernate.validator.constraints.NotEmpty; did you forget to inherit a required module?
我希望gwt-maven-plugin
能看到的jar源文件休眠 - 驗證 - 4.2.0.Final-sources.jar在編譯該項目。如何管理此資源以使其正常工作?我試圖把hibernate-validator-4.2.0.Final-sources.jar轉換成src/main/resources
目錄,但它似乎不起作用。
的pom.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<parent>
<groupId>com.szybieka.tarantula</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>
<artifactId>tarantula</artifactId>
<packaging>war</packaging>
<name>Tarantula</name>
<url>http://github.com/shebeko/tarantula</url>
<properties>
<gwt.version>2.5.1</gwt.version>
<jackson.version>1.9.10</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>system</scope>
<systemPath>${basedir}/war/WEB-INF/lib/hibernate-validator-4.2.0.Final.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>system</scope>
<systemPath>${basedir}/war/WEB-INF/lib/validation-api-1.0.0.GA.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
<scope>system</scope>
<systemPath>${basedir}/war/WEB-INF/lib/slf4j-api-1.6.1.jar</systemPath>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<scope>system</scope>
<systemPath>${basedir}/war/WEB-INF/lib/json-20090211.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Catcha from local repository -->
<dependency>
<groupId>com.google.code</groupId>
<artifactId>captcha</artifactId>
<version>1.2.1</version>
</dependency>
<!-- Jackson JSON processor -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.2.3</version>
</dependency>
<!-- Core -->
<dependency>
<groupId>com.szybieka.tarantula</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Location -->
<dependency>
<groupId>com.szybieka.tarantula</groupId>
<artifactId>location</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Jackson JSON Mapper -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- DataSource -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>tarantula</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessors>
<annotationProcessor>com.google.web.bindery.requestfactory.apt.RfValidator</annotationProcessor>
</annotationProcessors>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>${basedir}/war</warSourceDirectory>
<archiveClasses>true</archiveClasses>
<warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/gwt-servlet*,gwtia_requestfactory_*/**</warSourceExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<configuration>
<modules>
<param>com.szybieka.tarantula.gwt.MainModule</param>
</modules>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
加入休眠 - 驗證 - 4.2.0.Final-sources.jar休眠 - 驗證 - 4.2.0.Final-sources.jar MVN全新安裝後結果:
[INFO] ------------------------------------------------------------------------
[INFO] Building Tarantula 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ tarantula ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ tarantula ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 50 source files to /home/adam-szybieka/workspace/tarantula/parent/web/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalProxy.java:[3,43] package org.hibernate.validator.constraints does not exist
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalFormProxy.java:[3,43] package org.hibernate.validator.constraints does not exist
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalProxy.java:[14,6] cannot find symbol
symbol: class NotEmpty
location: interface com.szybieka.tarantula.gwt.client.proxy.PrincipalProxy
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalProxy.java:[19,6] cannot find symbol
symbol: class NotEmpty
location: interface com.szybieka.tarantula.gwt.client.proxy.PrincipalProxy
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalFormProxy.java:[9,6] cannot find symbol
symbol: class NotEmpty
location: interface com.szybieka.tarantula.gwt.client.proxy.PrincipalFormProxy
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalFormProxy.java:[14,6] cannot find symbol
symbol: class NotEmpty
location: interface com.szybieka.tarantula.gwt.client.proxy.PrincipalFormProxy
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalFormProxy.java:[19,6] cannot find symbol
symbol: class NotEmpty
location: interface com.szybieka.tarantula.gwt.client.proxy.PrincipalFormProxy
[ERROR] /home/adam-szybieka/workspace/tarantula/parent/web/src/main/java/com/szybieka/tarantula/gwt/client/proxy/PrincipalProxy.java:[15,12] java.util.NoSuchElementException
at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:396)
....................................................
所以這裏是'pom.xml'。實際上,我試着在pom中添加** hibernate-validator-4.2.0.Final-sources.jar **以及** hibernate-validator-4.2.0.Final.jar **,但它沒有幫幫我。 –
你是否打掃乾淨? –
獲取GA源代碼,並確保它們位於客戶端和服務器的類路徑中 –