classifier的使用

本文介绍了如何利用Maven管理同一个EJB模块在不同J2EE中间件(如JBoss、WebSphere或WebLogic)的发布,并通过classifier属性实现针对不同中间件的配置差异。重点阐述了如何通过配置persistence.xml文件来适应不同中间件的需求,以及如何使用Maven插件完成自动化部署。



 在J2EE开发中,当我们的某个ejb的jar包不但可以使用于jboss中,还希望运行在websphere或weblogic中。一个ejb包要发布在不同的j2ee中间件中时有些配置信息往往不一样,比如:这个ejb包中有JPA的配置文件persistence.xml文件。那么,这个文件在jboss中的设置如下:

  <properties>
   <!-- Auto detect annotation model classes -->
   <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
   <property name="hibernate.show_sql" value="true" />
   <property name="hibernate.format_sql" value="true" />
   <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
   <property name="hibernate.cache.use_query_cache" value="true" />
   <property name="hibernate.cache.use_second_level_cache"
    value="true" />
  </properties>

 而websphere的设置如下:

  <properties>
   <!-- Auto detect annotation model classes -->
   <property name="hibernate.archive.autodetection" value="class" />
   <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
   <property name="hibernate.show_sql" value="false"/>
   <property name="hibernate.format_sql" value="true"/>
   <property name="hibernate.cache.use_query_cache" value="true"/>
   <property name="hibernate.cache.use_second_level_cache" value="true"/>
   <property name="hibernate.cache.region_prefix" value="mes"/>
   <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
     <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/> 
  </properties>

 

如果这个ejb的jar包是一个平台的基本模块,当某一个项目使用该平台发布在jboss环境下,另一个项目也使用该平台发布在websphere环境下,这个时候要想用maven管理该怎么办呢?这个时候classifier就发挥作用了。

    首先,我们使用maven-jar-plugin或maven-ejb-plugin的classifier属性,将这个模块分别发布为jboss类型的和websphere类型的,下面以maven-ejb-plugin为例配置如下:

 <build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ejb-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <classifier>${appserver.type}</classifier>
     <ejbVersion>3.0</ejbVersion>
     <archive>
      <manifest>
       <addClasspath>false</addClasspath>
      </manifest>
     </archive>
     <generateClient>true</generateClient>
     <clientExcludes>
      <clientExclude>**/*Bean.class</clientExclude>
      <clientExclude>**/package.html</clientExclude>
     </clientExcludes>
    </configuration>
   </plugin>

 

特别需要注意的是:<classifier>${appserver.type}</classifier>
appserver.type是变量:

当发布jboss版本的模块时使用jboss作为变量值.

当发面websphere版本的模块时使用websphere作为变量值.

把分别不同情况生成的包发布到私服中,可以在仓库中看到xxx-jboss.jar和xxx-websphere.jar,如图所示:

当系统要发布在jboss或websphere中间件时,也可以通过在依赖中使用classifier来指定是使用平台模块的jboss版本还是websphere版本,配置如下:

   <dependency>
    <groupId>cn.com.pzhsteel.mes</groupId>
    <artifactId>mes-ejb</artifactId>
    <version>${mes.platform.version}</version>
    <classifier>websphere</classifier>
    <type>ejb</type>
   </dependency>

 这样就可以指定是使用哪个版本的平台模块了。

 

### 使用Train Classifier功能在CloudCompare中的方法 在CloudCompare这款点云处理软件中,训练分类器(Train Classifier)是一项用于自动识别和分类点云数据的重要工具。为了有效利用此功能,需遵循特定的操作流程。 #### 准备工作 确保已安装最新版本的CloudCompare并加载待分析的点云文件[^1]。通常情况下,这些文件格式可以是LAS、LAZ或者ASCII等常见形式。 #### 数据预处理 对原始点云数据执行必要的清理操作,比如去除噪声点、滤除异常值以及调整分辨率等措施来优化输入质量。良好的前期准备有助于提高后续模型训练的效果。 #### 特征提取 通过CloudCompare内置算法计算几何特征参数作为机器学习的基础要素。这一步骤涉及选择合适的描述符类型,例如法线方向直方图(NHD)或积分不变量(II)[^1]。恰当选取特征对于区分不同类别至关重要。 #### 构建样本集 手动标注部分具有代表性的区域以形成正负样例集合。该过程可能需要借助第三方GIS平台辅助完成精确标记任务;同时保存为CSV或其他兼容格式以便导入到CloudCompare环境中继续下一步操作。 #### 训练分类模型 打开`Classification`菜单下的`Train classifier...`选项启动向导界面,在这里指定先前创建好的特征文件路径及对应的标签信息。接着配置好各项超参数设置之后点击运行按钮即可开始正式培训阶段的工作流程序列化过程。 ```python # Python API example (if applicable) cc.Classification.TrainClassifier( feature_file="path/to/features.csv", label_column=0, output_model="trained_classifier.model" ) ``` #### 应用与评估 一旦训练结束,则可将得到的最佳权重应用于整个场景范围内实现自动化分割目的。此外还应该统计混淆矩阵等相关指标用来衡量预测精度水平,并据此反馈调优直至满意为止。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值