在使用maven编译GWT时,WEB-INF / lib中缺少gwt-servlet.jar [英] gwt-servlet.jar missing in the WEB-INF/lib on compiling GWT with maven
问题描述
mvn clean install
和 mvn eclipse:eclipse 并在eclipse中打开项目,我收到以下错误
GWT SDK JAR gwt-servlet.jar缺少WEB-INF / lib目录
编辑:
这是我的依赖一个自定义maven存储库):
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
< version> 2.4.0< / version>
< / dependency>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-servlet< / artifactId>
< version> 2.4.0< / version>
< / dependency>
<依赖关系>
< groupId> com.smartgwt< / groupId>
< artifactId> smart-gwt< / artifactId>
< version> 2.5< / version>
< / dependency>
编辑2(主要pom):
< build>
< extensions>
< extension>
< groupId> org.apache.maven.wagon< / groupId>
< artifactId> wagon-ftp< / artifactId>
< / extension>
< / extensions>
....
解决方案我注意到的事情
1)您指定的smartgw依赖关系无法从maven中央存储库中解析
<依赖性>
< groupId> com.smartgwt< / groupId>
< artifactId> smart-gwt< / artifactId>
< version> 2.5< / version>
< / dependency>
它只具有2.4版本的smartgw(请参阅这里 http://search.maven.org/#search%7Cga%7C1%7Csmartgwt )相反,我不得不使用这个
<依赖关系>
< groupId> com.smartgwt< / groupId>
< artifactId> smartgwt< / artifactId>
< version> 2.4< / version>
< / dependency>
注意到工件ID也不同。 (如果你有一个包含这个的自定义存储库,那么请更新你的问题)
2)你不需要做eclipse:eclipse可以发出
文件>导入>现有的Maven项目
这将自动从您的pom.xml生成eclipse项目
更新
我用以下测试:
gwttest2文件夹中的父pom
< project xmlns =http://maven.apache.org/POM/ 4.0.0xmlns: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> com.test< / groupId>
< artifactId> gwttest2-main< / artifactId>
< version> 0.0.1-SNAPSHOT< / version>
< packaging> pom< / packaging>
< modules>
< module> gwttest2-module1< / module>
< / modules>
< build>
< extensions>
< extension>
< groupId> org.apache.maven.wagon< / groupId>
< artifactId> wagon-ftp< / artifactId>
< / extension>
< / extensions>
< / build>
<依赖关系>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
< version> 2.4.0< / version>
< / dependency>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-servlet< / artifactId>
< version> 2.4.0< / version>
< / dependency>
<依赖关系>
< groupId> com.smartgwt< / groupId>
< artifactId> smartgwt< / artifactId>
< version> 2.4< / version>
< / dependency>
< / dependencies>
< / project>
gwttest2 / gwttest2-module1文件夹中的小孩pom
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns: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> com.test< / groupId>
< artifactId> gwttest2-module1< / artifactId>
< version> 0.0.1-SNAPSHOT< / version>
< packaging> war< / packaging>
< parent>
< artifactId> gwttest2-main< / artifactId>
< groupId> com.test< / groupId>
< version> 0.0.1-SNAPSHOT< / version>
< / parent>
< build>
< extensions>
< extension>
< groupId> org.apache.maven.wagon< / groupId>
< artifactId> wagon-ftp< / artifactId>
< / extension>
< / extensions>
< / build>
<依赖关系>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
< version> 2.4.0< / version>
< / dependency>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-servlet< / artifactId>
< version> 2.4.0< / version>
< / dependency>
<依赖关系>
< groupId> com.smartgwt< / groupId>
< artifactId> smartgwt< / artifactId>
< version> 2.4< / version>
< / dependency>
< / dependencies>
< / project>
In my pom file, I have included the dependency of gwt-servlet but if i run mvn clean install
and mvn eclipse:eclipse
and open the project in eclipse, I get the following error
GWT SDK JAR gwt-servlet.jar is missing in the WEB-INF/lib directory
EDIT :
Here is my dependency (we use a custom maven repository):
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smart-gwt</artifactId>
<version>2.5</version>
</dependency>
EDIT 2 (main pom):
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
</extension>
</extensions>
....
解决方案 There are two things I noticed.
1) The smartgw dependency you specified cannot be resolved from the maven central repository
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smart-gwt</artifactId>
<version>2.5</version>
</dependency>
It only has the 2.4 version of smartgw (see here http://search.maven.org/#search%7Cga%7C1%7Csmartgwt) Instead I had to use this
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
notice that the artifact ID is different too. (If you have a custom repository containing this then please update your question)
2) You dont need to do eclipse:eclipse instead you can issue the
File > Import > Existing Maven projects
this will auto generate the eclipse project from your pom.xml
UPDATE
I tested with the following :
Parent pom in gwttest2 folder
<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>com.test</groupId>
<artifactId>gwttest2-main</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>gwttest2-module1</module>
</modules>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
</extension>
</extensions>
</build>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</project>
child pom in gwttest2/gwttest2-module1 folder
<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>com.test</groupId>
<artifactId>gwttest2-module1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<artifactId>gwttest2-main</artifactId>
<groupId>com.test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
</extension>
</extensions>
</build>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</project>
这篇关于在使用maven编译GWT时,WEB-INF / lib中缺少gwt-servlet.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!