如何在eclipse中更改JSF的版本?

时间:2014-05-01 09:51:44

标签: eclipse maven jsf jboss

首先,我真的很抱歉我糟糕的英语。 我开始研究Jboss和Ejb,我买了一本关于这个主题的书,我不想宣传这本书,但它是jboss as7development。 我试图在第2,3,4和5章中进行练习,但我遇到了同样的问题。 本书使用了maven Eclipse Jboss的组合。它使用javaee 6原型项目,并且在某一点上需要通过面转换项目生命周期,但Eclipse不允许它。我在互联网上搜索了这个问题,但我找不到任何解决方案。 我尝试使用javaee7原型,但使用相同的pom.xml,但它不起作用。项目构面中的jsf web模块ecc版本是正确的,但Eclipse在以下标记中显示两个错误:

无法将项目构面动态Web模块的版本更改为2.3 ticket-agency-jpa line 1
Maven Java EE配置问题 尚未满足一个或多个约束。 ticket-agency-jpa第1行Maven Java EE配置问题

我在这里发布了我的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>com.packthub.as7development.chapter4</groupId>
    <artifactId>ticket-agency-cdi</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>ticket-agency-cdi</name>
    <url>http://maven.apache.org</url>

    <properties>
        <version.jboss.maven.plugin>7.3.Final</version.jboss.maven.plugin>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.org.richfaces>4.2.0.Final</version.org.richfaces>

        <version.org.jboss.bom>1.0.0.Final</version.org.jboss.bom>
       <version.jboss.spec.javaee.6.0>3.0.2.Final</version.jboss.spec.javaee.6.0>

        <!-- other plugin versions -->
        <version.compiler.plugin>2.3.1</version.compiler.plugin>
        <version.surefire.plugin>2.4.3</version.surefire.plugin>
        <version.war.plugin>2.1.1</version.war.plugin>

        <!-- maven-compiler-plugin -->
        <maven.compiler.target>1.6</maven.compiler.target>
        <maven.compiler.source>1.6</maven.compiler.source>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- JBoss distributes a complete set of Java EE 6 APIs including 
                a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or 
                a collection) of artifacts. We use this here so that we always get the correct 
                versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack 
                (you can read this as the JBoss stack of the Java EE 6 APIs, with some extras 
                tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate
                stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras 
                from the Hibernate family of projects) -->
           <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-6.0</artifactId>
                <version>${version.jboss.spec.javaee.6.0}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.richfaces</groupId>
                <artifactId>richfaces-bom</artifactId>
                <version>${version.org.richfaces}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <dependencies>
        <!-- First declare the APIs we depend on and need for compilation. 
            All of them are provided by JBoss AS 7 -->

        <!-- Import the CDI API, we use provided scope as the API is included 
            in JBoss AS 7 -->
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the Common Annotations API (JSR-250), we use provided 
            scope as the API is included in JBoss AS 7.
            Servono per poter annotare i nostri bean -->
        <dependency>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
         <groupId>org.jboss.logging</groupId>
         <artifactId>jboss-logging</artifactId>
         <version>RELEASE</version>
      </dependency>

        <!-- Import the EJB API, we use provided scope as the API is included 
            in JBoss AS 7 -->
        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>



        <!-- Import the JSF API, we use provided scope as the API is included 
            in JBoss AS 7 -->
        <dependency>
            <groupId>org.jboss.spec.javax.faces</groupId>
            <artifactId>jboss-jsf-api_2.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>

          <!-- Import RichFaces runtime dependencies - these will be included
         as libraries in the WAR -->
        <dependency>
            <groupId>org.richfaces.ui</groupId>
            <artifactId>richfaces-components-ui</artifactId>
        </dependency>
        <dependency>
            <groupId>org.richfaces.core</groupId>
            <artifactId>richfaces-core-impl</artifactId>
        </dependency>

    </dependencies>
  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
            <!-- JBoss AS plugin to deploy the application -->
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>${version.jboss.maven.plugin}</version>
                <configuration>
                    <filename>${project.build.finalName}.war</filename>
                </configuration>
            </plugin>
    </plugins>      
  </build>

</project>

对于我的项目,我正在使用eclipse开普勒,我需要使用jsf 2.1。 Web动态模块是3.0,这是正确的,当我尝试更改jsf版本时,eclipse说:无法将项目facet JavaServerFaces的版本更改为2.1。 有关如何进行的任何建议吗?

1 个答案:

答案 0 :(得分:1)

这是Eclipse的方面机制的一个已知问题。

recently answered another question exactly like this

基本上,您必须在取消选择项目构面和更改其版本之间单击应用

干杯。