0
votes

First, I'm really sorry for my terrible English. I'm starting to study Jboss and Ejb and I bought a book on the topic, I don't want to publicize the book but it's jboss as7development. I tried to develop the exercise in chapter 2,3,4 and 5 but I have the same problem. The book use a combination of maven Eclipse Jboss. It uses the javaee 6 archetype project, and at a certain point requires to transform the project lifecycle through faces but Eclipse doesn't allow it. I've searched the Internet for this problem but I didn't find any solution. I try to use javaee7 archetype but with the same pom.xml but it doesn't work. The version of jsf web module ecc in project facets are correct but Eclipse displays two errors in markers that are:

Cannot change version of project facet Dynamic Web Module to 2.3.
ticket-agency-jpa line 1
Maven Java EE Configuration Problem One or more constraints have not been satisfied. ticket-agency-jpa line 1 Maven Java EE Configuration Problem

I post here 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>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>

For my project I'm using eclipse Kepler and I need to use jsf 2.1. The web dynamic module is 3.0 and it's correct, when I try to change the jsf version eclipse says: Cannot change the version of project facet JavaServerFaces to 2.1. Any suggestion for how to proceed?

1
Have you tried updating it via project-facets in eclipse ?Saif Asif
Yes, right click on the project-->properties-->project-facets and the version of Dynamic Web module is 3.0 and jsf is 2.0, when I try to change the jsf's version in 2.1 Eclispse says: Cannot change the version of project facet Java server Faces to 2.1user2369517

1 Answers

1
votes

This is a known issue of Eclipse's facet mechanism.

I've recently answered another question exactly like this.

Basically, you have to click Apply between de-selecting the project facets and changing their version.

Cheers.