Ejb的完整build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="MyEjb_01_HelloWorld" basedir=".">
 <property name="src.dir" value="${basedir}\src" />
 <property environment="env" />
 <property name="jboss.home" value="${env.JBOSS_HOME}" />
 <property name="jboss.server.config" value="default"/>
 <property name="build.dir" value="${basedir}\build" />

 <path id="build.classpath">
  <fileset dir="${jboss.home}\client">
   <include name="*.jar" />
  </fileset>
  <pathelement location="${build.dir}" />
 </path>

 <target name="prepare">
  <delete dir="${build.dir}" />
  <mkdir dir="${build.dir}" />
 </target>

 <target name="compile" depends="prepare" description="编译">
  <javac srcdir="${src.dir}" destdir="${build.dir}">
  <classpath refid="build.classpath"></classpath>
  </javac>
 </target>

 <target name="ejbjar" depends="compile" description="创建EJB发布包">
  <jar jarfile="${basedir}\${ant.project.name}.jar">
   <fileset dir="${build.dir}">
    <include name="**/*.class" />
   </fileset>
  </jar>
 </target>

 <target name="deploy" depends="ejbjar" description="发布ejb">
  <copy file="${basedir}\${ant.project.name}.jar" todir="${jboss.home}\server\${jboss.server.config}\deploy"></copy>
 </target>
 <target name="undeploy" description="卸载ejb">
  <delete file="${jboss.home}\server\${jboss.server.config}\deploy\${ant.project.name}.jar"/>
 </target>


</project>

### JRebel `jrebel.xml` 配置文件详解 JRebel 的配置主要通过 `jrebel.xml` 文件完成。该文件允许开发人员自定义如何处理应用程序的不同部分,从而优化热重载行为。 #### 基本结构 以下是典型的 `jrebel.xml` 文件的基本结构: ```xml <?xml version="1.0" encoding="UTF-8"?> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://manuals.jrebel.com/schema/jrebel/application.xsd" xmlns="https://manuals.jrebel.com/schema/jrebel"> <!-- 类路径映射 --> <classpath> <dir name="${project.basedir}/target/classes"/> </classpath> <!-- Web 应用程序配置 --> <web> <link target="/"> <dir name="${basedir}/WebRoot"/> </link> </web> <!-- Java EE 组件配置 --> <ejb> <classpattern name="com.example.MyBeanImpl"> <property name="beanName" value="MyBean"/> </classpattern> </ejb> </application> ``` #### 关键元素解释 - **类路径 (`classpath`)** - 映射编译后的 `.class` 文件位置到运行时环境。 - **Web 应用程序 (`web`)** - 将物理目录链接至虚拟主机根目录或其他上下文路径下。 - **Java EE 组件 (`ejb`, `managed-bean`, etc.)** - 对于 EJB 或其他托管 Bean 提供特定属性覆盖机制[^2]。 #### 实际应用案例 当使用 Spring Boot 和 JRebel 结合时,可以通过如下方式简化配置并提高效率: ```xml <!-- jrebel.xml --> <application ... > <server id="spring-boot"/> <classpath> <dir name="${project.build.directory}/classes"/> </classpath> <web> <link target="/"> <dir name="${basedir}/src/main/webapp"/> </link> </web> <!-- 支持 Thymeleaf 模板即时刷新 --> <resource> <dir name="${basedir}/src/main/resources/templates"/> </resource> </application> ``` 此配置不仅涵盖了标准的类和资源路径还包括了对模板引擎的支持,使得前端页面修改也能立即生效[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值