kas*_*ili 22 eclipse configuration jsf maven
我尝试了一些东西,但仍然存在这个问题.我正在使用Eclipse Kepler.我在导入maven项目时遇到以下错误
无法安装JavaServer Faces 2.2:尚未满足一个或多个约束
JavaServer Faces 2.2需要动态Web模块2.5或更高版本
1)我尝试使用Java Server Faces 1.2中的Maven Java EE配置标记中提到的一些东西,但没有运气.2)我也进入.settings并修改了org.eclipse.wst.common.project.facet.core.xml并修改了jst.web以指向2.5或3.0版本; 但我得到一些其他错误.
我试图让煎茶GXT例子行家/ Eclipse构建工作的基础上http://neiliscoding.blogspot.ie/2012/05/how-to-setup-examples-for-use-in-gxt-3.html和让这个javaserver在eclipse中遇到问题.这是我的pom.xml
<?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>
<parent>
<artifactId>xx</artifactId>
<groupId>ss</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>guis</artifactId>
<packaging>war</packaging>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.5.1</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.inject</groupId>
<artifactId>gin</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<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>com.google.gwt</groupId>
<artifactId>gwt-dev</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>com.sencha.gxt</groupId>
<artifactId>gxt-chart</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>uibinder-bridge</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<!-- <goal>i18n</goal> -->
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>guis.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.harmonia.client.Messages</i18nMessagesBundle>
</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>
<!-- <goals> <goal>exploded</goal> </goals> -->
</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.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
这是我的web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app> -->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>GXT Created Web Application</display-name>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>guis.html</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)
如您所见,我在上面的web.xml中尝试了不同的dtd,但我仍然遇到了问题.非常感谢任何提示
rag*_*era 27
我也遇到过Maven项目.这是解决问题所必须做的事情:
首先更新您的web.xml,如ThorbjørnRavnAndersen所述.我使用3.0版如下:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Servlet 3.0 Web Application</display-name>
</web-app>
Run Code Online (Sandbox Code Playgroud)
然后右键单击您的项目并选择Properties - > Project Facets在那里您将看到Dynamic Web Module的版本.这需要从2.3或更高版本更改为2.5或更高版本(我选择3.0).
但是,要执行此操作,我必须取消选中动态Web模块的勾选框 - >应用,然后在项目上执行Maven更新.返回Project Facets窗口,它应该已经匹配您的web.xml配置 - 在我的情况下为3.0.如果没有,你应该能够改变它.
如果这对您不起作用,请尝试右键单击Dynamic Web Module Facet并选择更改版本(并确保它未锁定).
希望有效!
Tho*_*sen 22
您的问题是您已将web.xml标记为符合servlet 2.3(或者甚至不是 - 我不确定您的注释中的doctype是如何解释的)
<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
Run Code Online (Sandbox Code Playgroud)
并且您需要它至少与servlet 2.5兼容才能使Eclipse工具正常工作.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Run Code Online (Sandbox Code Playgroud)
(未经测试 - 从http://javahowto.blogspot.dk/2009/10/sample-webxml-servlet-25.html复制)
您可能需要重新创建Eclipse项目以获取更改.
| 归档时间: |
|
| 查看次数: |
58404 次 |
| 最近记录: |