应行家算法_一些行家技巧和窍门

应行家算法

我正在将使用WebLogic Workshop(是的,使用不受支持的IDE可以正确阅读)的现有应用程序迁移到Maven。 在旅途中有一些陷阱,我想在这里写下给那些可能会觉得有用的人,特别是对我自己而言作为参考。

整个应用程序使用Apache XMLBeans处理与XML有关的所有事情,这是我要迁移到Maven的第一部分。 Maven确实有一个用于XMLBeans的maven插件,下面的代码片段说明了如何将该插件合并到项目中。

<build><plugins><plugin><groupId>org.codehaus.mojo</groupId><artifactId>xmlbeans-maven-plugin</artifactId><version>2.3.3</version><configuration> <javaSource>1.5</javaSource> </configuration> <executions><execution><phase>generate-sources</phase><goals><goal>xmlbeans</goal></goals></execution></executions></plugin></plugins></build>

这里的一个难题是,如果希望生成的XMLBeans代码具有maxoccurs设置为无界的元素的“列表”数据结构,则需要使用<javaSource> 1.5 </ javaSource>标记。 仅当您的代码已在使用列表类型时。 没有此标签,此插件将仅生成无界元素的数组类型。

接下来,是时候迁移公开应用程序Web服务的模块了。 当它在WebLogic上运行时,它使用“ jwsc”任务生成了需求工件。 我找不到能满足此要求的现成的Maven插件,经过一番搜索后,我遇到了通过Maven ant run插件调用ant构建的解决方案。 让我们看一下pom.xml上所需的配置更改;

<plugin><groupId>org.codehaus.gmaven</groupId><artifactId>gmaven-plugin</artifactId><version>1.3</version><executions><execution><id>set-main-artifact</id><phase>package</phase><goals><goal>execute</goal></goals><configuration><source>project.artifact.setFile(new File(project.build.directory+'/'+project.artifactId+'-'+project.version+'.war'))</source></configuration></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId><version>1.6</version><executions><execution><phase>prepare-package</phase><configuration><target><property name="maven.compile.classpath" refid="maven.compile.classpath" /><property name="maven.runtime.classpath" refid="maven.runtime.classpath" /><property name="maven.test.classpath" refid="maven.test.classpath" /><property name="maven.plugin.classpath" refid="maven.plugin.classpath" /><ant antfile="src/main/ant/build.xml" target="all" /></target></configuration><goals><goal>run</goal></goals></execution></executions><dependencies><dependency><groupId>org.apache.ant</groupId><artifactId>ant</artifactId><version>1.7.1</version><scope>runtime</scope></dependency><dependency><groupId>ant-contrib</groupId><artifactId>ant-contrib</artifactId><version>1.0b2</version><scope>runtime</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>weblogic</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>xmlbeans</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>wlserv</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>jaxwsrt</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>beadescriptor</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>beadescriptorbinding</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>beadescriptorsettable</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>weblogic</groupId><artifactId>staxb</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>org.apache.xmlbeans</groupId><artifactId>xmlbeans</artifactId><version>2.4.0</version></dependency><dependency><groupId>weblogic</groupId><artifactId>webservices</artifactId><version>10.3.0</version><scope>compile</scope></dependency><dependency><groupId>com.sun</groupId><artifactId>tools</artifactId><version>1.5.0</version><scope>system</scope><systemPath>${java.home}/../lib/tools.jar</systemPath></dependency></dependencies></plugin><plugin><artifactId>maven-war-plugin</artifactId><version>2.1.1</version><configuration><encoding>UTF-8</encoding></configuration><executions><execution><id>default-war</id><phase>none</phase></execution></executions></plugin>

请注意,使用maven install file命令将在groupId中设置为“ weblogic”的依赖项手动安装在maven存储库中。 所需的jar库如下:

  • wlfullclient.jar(此jar根据此处指定的说明构建)
  • webserviceclient.jar
  • webservices.jar
  • wls-api.jar
  • xercesImpl.jar
  • xmlParserAPIs.jar
  • com.bea.core.descriptor.settable.binding_1.4.0.0.jar
  • com.bea.core.descriptor.wl.binding_1.1.0.0.jar
  • com.bea.core.descriptor.wl_1.1.0.0.jar
  • com.bea.core.xml.beaxmlbeans_1.0.0.0_2-4-0.jar
  • com.bea.core.xml.staxb.buildtime_1.3.0.0.jar
  • glassfish.jaxws.rt_2.1.3.jar

下一步是将ant build.xml拖放到项目的src / main / ant目录中。 build.xml如下;

<project name="build-webservice" default="all"><target name="all" depends="build.webService" /><path id="maven_plugin_classpath"><pathelement path="${maven.plugin.classpath}" /></path><path id="maven_runtime_classpath"><pathelement path="${maven.compile.classpath}" /><pathelement path="${maven.runtime.classpath}" /><pathelement path="${maven.plugin.classpath}" /><pathelement path="${weblogic.jar}" /></path><taskdef name="jwsc"classname="weblogic.wsee.tools.anttasks.JwscTask"classpath="${weblogic.jar}"classpathref="maven_plugin_classpath"/><target name="build.webService" description="Compile the web services if not up2date"><!--Eclipse compiles and places classes into target/classes when the workspace is building.If this folder exists when jwsc runs, then any classes that are already compiled will NOTbe included in the final WAR file.  Thus, this directory is removed prior to created thewebServices WAR fie.--><delete dir="target/classes" /><jwsc srcdir="${project.build.sourceDirectory}"destDir="target"classpathref="maven_runtime_classpath"keepGenerated="yes"applicationxml="${project.build.directory}/application.xml"fork="true"memorymaximumsize="256m"verbose="true"debug="on"><module contextPath="ws" name="${project.artifactId}-${project.version}"><jwsfileset srcdir="."><include name="**/*.java" /><exclude name="**/*Test.java" /></jwsfileset></module></jwsc>    </target>    
</project>

请注意,无需对此build.xml进行任何更改。

接下来,它是关于构建要部署到weblogic的EAR模块的。 查看由WebLogic Workshop构建的EAR,我可以看到所有必需的第三方库都被捆绑到了一个名为APP-INF / lib的文件夹中,该文件夹位于EAR的根目录中。 另外,WAR文件在lib目录中没有任何jar文件,我想在使用maven构建EAR时模仿此功能。 以下配置使我能够做到这一点;

<build><finalName>ErrorXAEAR</finalName><plugins><plugin><artifactId>maven-ear-plugin</artifactId><version>2.10.1</version><configuration><defaultLibBundleDir>APP-INF/lib/</defaultLibBundleDir><skinnyWars>true</skinnyWars><modules><jarModule><groupId>mtn.sa.errorxa</groupId><artifactId>errorxa-ejb</artifactId><bundleDir>/</bundleDir><bundleFileName>ErrorXAEJB.jar</bundleFileName></jarModule><webModule><groupId>mtn.sa.errorxa</groupId><artifactId>errorxa-service</artifactId><bundleDir>/</bundleDir><bundleFileName>ErrorXAService.war</bundleFileName></webModule></modules></configuration></plugin></plugins></build>

标签<skinnyWars>可以使war文件的lib目录不填充所需的第三方库,该第三方库现在捆绑在EAR的APP-INF / lib目录中。 标记<defaultLibBundleDir>负责将所有必需的库复制到EAR中名为APP-INF / lib的文件夹中。

关于EAR生成的另一件事是,我不希望maven生成application.xml文件,因为该文件以及weblogic-application.xml已经在项目上生成,因此我想使用它。 为此,我要做的就是将这两个文件都放到src / main / application文件夹中,并且默认的application.xml被覆盖。

我发现在构建EAR时,Maven的mvndependency:tree工具非常有用,它可以识别和除去通过递归依赖关系拖入EAR的不必要的依赖关系。 使用一个简单的排除标签,我就可以删除不需要的库。

关于这个帖子。 我会不断更新我可能遇到的任何事情。 下一步是在构建过程中使用maven进行每个应用程序的部署和取消部署。

翻译自: https://www.javacodegeeks.com/2016/03/maven-tips-tricks.html

应行家算法

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/336197.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C++ 11 深度学习(十五)多线程

线程创建 方式一:调用函数 #include<thread>void CreateThread() {int a100;cout<<"This is Thread: "<<a<<endl; }int main() {thread Threadone(CreateThread);//join是一种阻塞的方式&#xff0c;需要子线程处理完毕之后&#xff0c;…

pythonfor循环语句例题_python循环语句的使用练习题

1. 使用while循环输出1 2 3 4 5 6 8 9 10 for i in range(10) : if i6 : print( ,end ) continue print(i1,end" ") 2. 求1-100的所有数的和 s0 for i in range(101) : si print(s) 3. 输出 1-100 内的所有奇数 for i in range(100) : if (i1)%21 : print(i1,end ) 4…

计算机的好处和坏处的英语作文,电脑的利弊英语作文

电脑的利弊英语作文在学习、工作或生活中&#xff0c;大家都写过作文吧&#xff0c;通过作文可以把我们那些零零散散的思想&#xff0c;聚集在一块。那么你有了解过作文吗&#xff1f;下面是小编为大家整理的电脑的利弊英语作文&#xff0c;希望能够帮助到大家。Computer is in…

多个定时器相互干扰的问题_相互问题

多个定时器相互干扰的问题HTTPS协议是建立安全连接的公认标准。 理解此协议的工作原理不是问题&#xff0c;并且自2000年以来可以使用相应的RFC文档 。 尽管HTTPS的使用如此广泛&#xff0c;但您仍然可以找到没有不必要的复杂性就无法处理此协议的软件。 不幸的是&#xff0c;…

【WebRTC---进阶篇】(一)服务器基础编程

一个最简单的服务器程序 server.h /*** Server Class ** @author lichao* @date 2019-08-07* @copyleft GPL 2.0*/#ifndef __SERVER_H__ #define __SERVER_H__namespace avdance {class Server {public:Server(); //consrtuct~Server(); //destructpublic:void run();};} //…

servlet容器_SpringBoot是否内置了Servlet容器?

SpringBoot是否内置了Servlet容器&#xff1f;SpringBoot内置了Servlet容器&#xff0c;这样项目的发布、部署就不需要额外的Servlet容器&#xff0c;直接启动jar包即可。SpringBoot官方文档上有一个小章节内置servlet容器支持用于说明内置Servlet的相关问题。在SpringBoot源码…

计算机专业开学要带电脑吗,大学上课要带电脑吗

大学刚开学&#xff0c;上课的时候学生们要不要带电脑呢&#xff0c;想必这个问题一直对还没进入大学的准大学生来说很困扰&#xff0c;下面是小编整理的详细内容&#xff0c;一起来看看吧&#xff01;大学上课要带电脑吗大学上课能否带电脑需要看老师的要求。大学课程书本知识…

【WebRTC---进阶篇】(二)libevent实现高性能网络服务器

libevent编译与安装 libevent官网 Linux平台安装编译libevent wget -c addr --no-check-certificate ./configure --prefix=/usr/local/libevent make -j 8 make install #include <event2/listener.h> #include <event2/bufferevent.h> #include <event2/b…

突然讨厌做前端,讨厌代码_不要讨厌HATEOAS

突然讨厌做前端,讨厌代码或我如何学会不再担心和爱HATEOAS REST已成为实现Web服务的事实上的解决方案&#xff0c;至少已成为一种流行的解决方案。 这是可以理解的&#xff0c;因为REST在使用HTTP规范时提供了一定程度的自我文档。 它经久耐用&#xff0c;可扩展&#xff0c;并…

html按钮冻结,Vue js按钮冻结dom

我想切换一个包含加载动画的按钮按钮&#xff0c;直到该函数完成使用v-if。但是当我按下按钮时&#xff0c;DOM冻结&#xff0c;span元素不变&#xff0c;直到函数调用结束。我如何让DOM不冻结并显示加载图标&#xff1f;非阻塞按钮按下可能是一个解决方案&#xff1f;Vue js按…

【WebRTC---进阶篇】(三)各流媒体服务器的比较

多人音视频架构 Mesh方案 多对多大多进行P2P,在国内P2P直连穿越会出现很大问题。 MCU方案 客户端连接后,对应每个终端都有一个模块进项上传。再将音视频进行拆分解码。进行混屏,压缩编码分别推动给每个终端。 SFU方案 sfu不进行编解码,只是进行转发。只对订阅的终端进行…

注释嵌套注释_DIY注释

注释嵌套注释从Java 5开始&#xff0c;Java中出现了注释。 我想做一个自己的注释&#xff0c;只是为了看看需要什么。 但是&#xff0c;我发现它们只是接口。 有擦 接口后面没有牙。 必须执行一些代码。 我认为这是橡胶行之有效的方法&#xff0c;我真的找到了解决方法。 首先…

汇编 cmp_汇编复习

第一章计算机组成五部分&#xff1a;&#xff08;运算器、控制器&#xff09;、存储器、输入/输出设备↑↑ CPU ↑↑ ↑内存↑三条总线&#xff1a;控制总线、地址总线、数据总线不同进制及BCD码的转换特殊ascll ‘0’~‘9’—— 30H ~ 39H‘A’~‘F’—— 41H ~ 46H回车 —— …

【WebRTC---进阶篇】(四)mediasoup服务器的布署与使用

Nodejs安装 Nodejs安装 下载mediasoup Demo,并配置 详细GitHub地址 https://github.com/versatica/mediasoup-demo

睡眠是锁定计算机怎么设置密码,电脑休眠锁屏怎么设置

想要保护好自己的隐私&#xff0c;就要懂得电脑休眠锁屏怎么设置哦&#xff01;什么&#xff1f;你不会设置&#xff1f;不怕&#xff0c;小编这就来为您支招&#xff01;请看下文内容&#xff01;电脑休眠锁屏怎么设置用户账户面板1、首先您需要创建用户密码&#xff0c;如果您…

junit5和junit4_JUnit 5 –设置

junit5和junit42015年11月&#xff0c; JUnit Lambda团队展示了他们的原型 。 此后&#xff0c;该项目更名为JUnit 5&#xff0c;并于2016年2月发布了Alpha版本。我们将在一系列简短文章中进行探讨&#xff1a; 建立 基本 建筑 条件 注射 … 本节讨论JUnit 5的设置&…

markdown 生成目录_github上如何为markdown文件生成目录

写在前面熟悉markdown都知道可以使用[TOC]自动生成markdown文件的标题目录&#xff0c;比如在typora&#xff0c;vscode(需要插件)等本地编辑器中&#xff0c;或者在CSDN等网页编辑器中&#xff0c;但是github却不支持[TOC]标签&#xff0c;至于为什么不支持感兴趣的可以深入搜…

【WebRTC---进阶篇】(五)mediasoup的信令系统

mediasoup demo分析 app 客户端部分 broadcasters 推拉流部分 server 服务端部分 config.js 相当于一个配置文件&#xff0c;获取一些基本配置信息。获取的信息来交给server.js。 server.js 先从config.js获取信息&#xff0c;然后启动HTTPS webSocket服务等&#xff0c;…

axure html尺寸,axure怎么确定尺寸

回答&#xff1a;您好如做的是室内设计的话&#xff0c;那么来说可能会些参数提供给您的(例如长宽高)如果没有参数的话&#xff0c;只要把比例做好就可以了。只要比例做好了&#xff0c;东西看起来就自然像。至于教程的话&#xff0c;一般录制教程前都会有做好准备的&#xff0…

java工程引入scala_引入ReactiveInflux:用于Scala和Java的无阻塞InfluxDB驱动程序,支持Apache Spark...

java工程引入scala我很高兴宣布Pygmalios开发的ReactiveInflux的第一个发行版。 InfluxDB错过了Scala和Java的非阻塞驱动程序。 不变性&#xff0c;可测试性和可扩展性是ReactiveInflux的关键功能。 加上对Apache Spark的支持&#xff0c;它是首选武器。 https://github.com/p…