zoukankan      html  css  js  c++  java
  • 使用 maven:archetype 创建JSF2 + EJB3.1 + JPA2项目骨架并在JBoss WildFly 8.1上部署

    运行下面命令创建项目骨架:

    mvn archetype:generate -DarchetypeGroupId=org.jboss.spec.archetypes -DarchetypeArtifactId=jboss-javaee6-webapp-ear-archetype -DarchetypeVersion=7.1.1.Final -DgroupId={你的groupId} -DartifactId={你的artifactId} -Dversion=1.0-SNAPSHOT

    项目生成完成后,为了支持在WildFly上的部署操作,需加入 wildfly-maven-plugin 方法例如以下:

    找到根文件夹下的 pom.xml 的 build 节点。加入下面内容:

    <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>1.0.1.Final</version>
                </plugin>
                ...
            </plugins>
            ...
        </build>

    加入 jsf-api:

    <dependency>
    	<groupId>org.jboss.spec.javax.faces</groupId>
    	<artifactId>jboss-jsf-api_2.2_spec</artifactId>
    	<version>2.2.0</version>
    </dependency>
    



    然后切换到 ear 文件夹。找到 pom.xml 文件,加入下面内容:

    <plugin>
    				<groupId>org.wildfly.plugins</groupId>
    				<artifactId>wildfly-maven-plugin</artifactId>
    			</plugin

    另外为了能进行打包。还要在build 下加入:

    <defaultGoal>package</defaultGoal>

    更新 tag namespace:

    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    	xmlns:f="http://xmlns.jcp.org/jsf/core"
        xmlns:h="http://xmlns.jcp.org/jsf/html"

    更新faces-config.xml namesapce:

    <faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
            http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
    	version="2.2">
    </faces-config>


    OK大功告成。假设要在此基础上进行开发,还须要改动 persistence.xml 和 *.ds.xml 文件。

    部署方法:

    mvn clean install
    cd ***-ear
    mvn wildfly:deploy


  • 相关阅读:
    爬虫总结
    Request模块(八)
    urllib2异常处理(七)
    urllib2 Handler处理器和自定义opener(六)
    urllib2的GET和POST请求(五)
    urllib2模块的基本使用(四)
    HTTP代理器Fiddler(三)
    http协议再复习(二)
    Spring.NET学习笔记6——依赖注入(应用篇)
    4.spring对象的创建(静态工厂 实例工厂 泛型,嵌套类型)
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/5342406.html
Copyright © 2011-2022 走看看