如何在Maven项目中添加Richfaces [英] How to add richfaces to maven project
问题描述
我正在尝试在我的应用程序中使用弹出组件.我使用JSF,Glassfish.这是我的 pom.xml :
I'm trying to use popup component in my app. I use JSF, Glassfish. Here's my pom.xml:
<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>pl.karta</groupId>
<artifactId>epacjent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>epacjent</name>
<properties>
<org.richfaces.bom.version>4.2.2.Final</org.richfaces.bom.version>
<gae.version>1.4.2</gae.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url>
<id>eclipselink</id>
<layout>default</layout>
<name>Repository for library Library[eclipselink]</name>
</repository>
</repositories>
</project>
和 web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
...
我收到了以下警告:
WARNING: JSF1091: No mime type could be found for file ajax.reslib. To resolve this, add a mime-type mapping to the applications web.xml.
WARNING: JSF1091: No mime type could be found for file base-component.reslib. To resolve this, add a mime-type mapping to the applications web.xml.
WARNING: JSF1091: No mime type could be found for file popupPanel.ecss. To resolve this, add a mime-type mapping to the applications web.xml.
我对所有这些东西真的很陌生,有人可以告诉我我的配置如何吗?
I'm really new to all this stuff, could someone tell me how should my configuration look like?
推荐答案
首先,您的问题是您根本没有添加依赖项.您仅添加了BOM,但是您需要添加其他依赖项,如将Richfaces与Maven结合使用所述.添加BOM只是声明要使用哪个版本的库,而不会附加依赖项本身.
First of all, your problem is that you're not adding the dependencies at all.You only have the BOM added, but you need to add the other dependencies as the tutorial of using Richfaces with Maven says. Adding the BOM you're only declaring which version of the library you want to use, but not attaching the dependencies themselves.
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
稍后,您只需在web.xml
文件中指定 Faces Servlet ,即可使 RichFaces 正常工作.看看此条目.
Later on, you only need to specify the Faces Servlet in the web.xml
file to have RichFaces working. Take a look to this entry too.
这篇关于如何在Maven项目中添加Richfaces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!