使用m2Eclipse 通过 maven 自动部署webapp到weblogic 12c
admin
2023-05-08 08:01:57
0

这是oracle 官网介绍通过maven weblogic plug-in 来自动部署war 包 到weblogic 12c/11R

这是官方详细介绍如何使用maven 部署到weblogic12c http://docs.oracle.com/cd/E24329_01/web.1211/e24368/maven.htm#WLPRG585

 本人结合实际操作来说明如何通过m2eclipse(maven)+ eclipse自动部署到weblogic 服务器

 

第一部分: 设置eclipse

 

1 确保eclipse 已经安装了m2eclipse

通过点击file-new -maven project

如果成功显示并能创建项目,则表示maven eclipse 插件已经安装了

使用m2Eclipse 通过 maven 自动部署webapp到weblogic 12c r

 

2 创建一个maven web app project

使用m2Eclipse 通过 maven 自动部署webapp到weblogic 12c

 

3 创建成功后的maven 项目结构

使用m2Eclipse 通过 maven 自动部署webapp到weblogic 12c

 

 

4 右键点击pom.xml 文件 - run as maven- install

 

 

第二部分: 配置maven weblogic plugin (weblogic 插件)(难点)

 

weblogic 可以被maven自动部署的前提是在weblogic 下已经有这两个文件

MW_HOME/wlserver_12.1/server/lib/wls-maven-plugin.jar

MW_HOME/wlserver_12.1/server/lib/pom.xml

 

下面展示如何配置从而是weblogic 下包含这两个文件

1 定位到C:/wls12120/wlserver/server/lib

 

2 在C:/wls12120/wlserver/server/lib目录下运行

mvn install
mvn install -Dfile=wls-maven-plugin.jar -DpomFile=pom.xml
 
/*复制pom.xml 和wls-maven-plugin.jar 到以下//depo/.m2/repository/com/oracle/weblogic/wls-maven-plugin 目录 
*/
//执行  
  mvn install:install-file -Dfile=wls-maven-plugin.jar -DpomFile=pom.xml

如果成功执行会显示build success 并且此时lib 目录下面多了wls-maven-plugin.jarpom.xml

验证是否成功

  C:\wls12120\wlserver\server\lib>mvn wls:help
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------------------------------------------------
[INFO] Building WebLogic Server Maven Plugin 12.1.2.0
[INFO] -----------------------------------------------------------------------
[INFO]
[INFO] --- wls-maven-plugin:12.1.2.0:help (default-cli) @ wls-maven-plugin ---
[INFO]
WebLogic Server Maven Plugin
The following goals are supported by wls-maven-plugin:
appc:
  Generates and compiles the classes needed to deploy EJBs and JSPs to
  WebLogic Server. Also validates the deployment descriptors for compliance
  with the current specifications at both the individual module level and
  the application level.
deploy:
  Deploys WebLogic Server applications and modules. Supports all deployment
  formats, such as WAR, JAR, etc.
create-domain:
  Create a domain for WebLogic Server using the default domain template.
  For more complex domain creation use the WLST goal.

 

 

 

第三部分: 整合eclipse 和 自动部署

上述两部分完成后, 可以开始整合eclipse

1 配置eclipse 项目下的porm.xml

修改eclipse 项目下空白的porm.xml,添加信息代码如下


    MavenWebStruts
 
    
 
     
        maven-plugin-plugin
        2.3
        
          wls
        
      
 
 
 
    
 
	org.apache.maven.plugins
 
	maven-compiler-plugin
 
	
 
	1.7.0_13
 
	1.7.0_13
 
	false
	
	UTF-8
	
	
	
	
	
	
 
org.apache.maven.plugins
 
maven-war-plugin
 
2.1.1
 

 
false
 

 

 
 
 

 
org.apache.maven.plugins
 
maven-surefire-plugin
 
2.11
 

 
true
 

 

 
    
            
                com.oracle.weblogic
                wls-maven-plugin
                12.1.2.0
            
 
	      ${project.build.finalName}
 
		     C:\wls12120
			
			账户
			t3://localhost:7001
			密码
			${project.build.directory}/${project.build.finalName}.${project.packaging}

 
 
 
            
 
 
    
  

重点是是在下添加com.oracle.weblogic plugin.

补充以下一些标签含义

weblogic账户

weblogic 密码

表示war/ear的位置

 

2 通过eclipse 部署项目

为了测试是否能成功部署先测试wls 插件是否生效

右键点击porm.xml 运行

使用m2Eclipse 通过 maven 自动部署webapp到weblogic 12c

[INFO] Building MavenWebStruts Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- wls-maven-plugin:12.1.2.0:help (default-cli) @ MavenWebStruts ---
[INFO]
WebLogic Server Maven Plugin
The following goals are supported by wls-maven-plugin:
 
appc:
Generates and compiles the classes needed to deploy EJBs and JSPs to
WebLogic Server. Also validates the deployment descriptors for compliance
with the current specifications at both the individual module level and
the application level.
 
deploy:
Deploys WebLogic Server applications and modules. Supports all deployment
formats, such as WAR, JAR, etc.
 
create-domain:
Create a domain for WebLogic Server using the default domain template.
For more complex domain creation use the WLST goal.
 
help:
Lists all the goals supported by the wls-maven-plugin.
 
install:
Installs WebLogic Server.
 
list-apps:
Lists the deployment names for applications and standalone modules
deployed, distributed, or installed in the domain.
 
redeploy:
Redeploys a running application or part of a running application.
 
start-app:
Starts an application deployed on WebLogic Server.
 
start-server:
Starts WebLogic Server.
 
stop-app:
Stops an application.
 
stop-server:
Stops WebLogic Server.
 
undeploy:
Undeploys the application from WebLogic Server. Stops the deployment unit
and removes staged files from target servers.
 
update-app:
Updates an application's deployment plan by redistributing the plan files
and reconfiguring the application based on the new plan contents.
 
wlst:
WLST wrapper for Maven.
 
ws-clientgen:
A Maven goal to generate client web service artifacts from a WSDL
 
ws-wsdlc:
A Maven goal to generate a set of artifacts and a partial Java
implementation of the Web service from a WSDL.
 
ws-jwsc:
A Maven goal to build a JAX-WS web service
 
 
For detailed help on a goal, use -Dgoal= -Ddetail=true options.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.796 s
[INFO] Finished at: 2015-08-27T15:50:03-05:00
[INFO] Final Memory: 6M/112M
[INFO] ------------------------------------------------------------------------

如果出现以上信息说明整合成功

 

最后启动服务器,并且运行以下命令.

使用m2Eclipse 通过 maven 自动部署webapp到weblogic 12c

 

相关内容

热门资讯

Google在港推出AI代理G... 观点网讯:7月29日,Google在香港推出AI代理Gemini Spark,该代理可全天候在后台运...
5G+165Hz!联想新品官宣... 近两年来,小屏平板一直是比较有趣的一个品类。 不同于大平板注重效率、手机追求万能的特点,拯救者Y70...
原创 马... 马斯克又出来了。这次说2036年钱就没用了。 理由是人工智能加机器人,东西多到你用不完,还拿钱干嘛...
美的集团:我国智能家居互联互通... IT之家 7 月 30 日消息,美的集团今日发布公告,7 月 21 日至 23 日,智能家居互联互通...
华为新款MatePad Pro... 【CNMO科技消息】7月30日,@华为终端 官宣全新旗舰平板华为MatePad Pro。 新款华为...
从实验室到实景验证:6G光子太... 全息通信是第六代移动通信(6G)的典型应用场景之一,旨在通过融合无线传输与全息三维成像技术,实现超大...
从“能对话”到“能干活”——人... 【经济界面】 光明日报记者 刘坤 李晓东 周洪双 人工智能(AI)眼镜化身为个人“助理”,实时进行...
【全新发布】UminiP Pr... (来源:洲明科技)
日本通过“H3火箭8号”发射失... △H3火箭(资料图) 日本文部科学省30日召开关于去年“H3火箭8号”发射失败的会议。会议通过的最终...
互联网巨头抢滩健康硬件,上游芯... 封面新闻记者 付文超 当下,互联网巨头对健康硬件的押注,正在成为产业现实,加速拉动整个产业链步入新一...