gpt4 book ai didi

java - gwt-maven-plugin 无法编译,因为 "No source code is available for type org.hibernate.validator.constraints.impl.SizeValidatorForString;"

转载 作者:行者123 更新时间:2023-12-01 04:14:08 25 4
gpt4 key购买 nike

我在我的 GWT Web 应用程序中使用客户端验证,并使用 Maven 作为构建工具。在开发模式下运行不会导致任何问题。现在我想使用 Maven 构建项目,但出现多个错误,如下所示:

[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源文件hibernate-validator-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>

添加 hibernate-validator-4.2.0.Final-sources.jar hibernate-validator-4.2.0.Final-sources.jar mvn clean install 结果:

[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 的依赖项,或者存在版本控制问题。你能发布你的 pom 吗?

明白了:

你有这种依赖性

<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>

这是 4.2.0.Final jar,但您没有 4.2.0.Final-sources.jar

添加最终来源的依赖项,您应该就有答案了。

关于java - gwt-maven-plugin 无法编译,因为 "No source code is available for type org.hibernate.validator.constraints.impl.SizeValidatorForString;",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19612321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com