IDEA 如何使用JRebel 部署web項目呢?
步驟
(1)安裝JRebel插件
File|Settings...
輸入JRebel進行搜索,然后安裝.
注意:安裝完JRebel插件之后需要重啟IDEA.
(2)配置tomcat
Run|
依次點開Defaults-Tomcat Server-Local,進入Local Tomcat(Tomcat模板)的設置界面
點擊Configure,設置Tomcat路徑,并單擊OK保存
修改"Update" 動作和tomcat端口號
server選項卡,設置On Update action 和 On frame deactivation 兩個動作都更新類和資源
(3)配置輸入的classes目錄
File|Project structure
進入"Project"標簽頁
修改"Project compiler output"為D:\software\eclipse\workspace2\<項目名稱>\src\main\webapp\WEB-INF\classes
設置modules的代碼編譯輸出目錄. 點擊modules 設置右側 use module compile output path
都是設置為D:\software\eclipse\workspace2\<項目名稱>\src\main\webapp\WEB-INF\classes
指定Web.xml和WebRoot的路徑. 點擊web,分別指定
Web Module deployment descriptor ?路徑為 D:\software\eclipse\workspace2\convention\src\main\webapp\WEB-INF\web.xml
和 Web Resource Directory的路徑 為?D:\software\eclipse\workspace2\convention\src\main\webapp
點擊Apply.
進入Artifacts 標簽頁,修改Output directory:
(4)添加對應project的應用服務器
去掉"After launch"的勾選
保存之后并點擊Deployment選項卡,
選擇exploded那項
右邊設置訪問的uri即應用路徑,
保存,回到server選項卡,設置On Update action 和 On frame deactivation 兩個動作都更新類和資源
(5)為了防止點擊 reimport按鈕導致moudels 和 artifact 兩個選項卡里面的路徑恢復默認的問題
(6)配置JRebel
(7)以JRebel 方式啟動
或者
(8)檢查rebel.xml
改為:
(9)部署好之后,以JRebel 啟動,控制臺信息:
D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59\bin\catalina.bat run
[2015-12-28 11:05:48,261] Artifact convention:war exploded: Server is not connected. Deploy is not available.
Using CATALINA_BASE: ? "C:\Users\Administrator\.IntelliJIdea15\system\tomcat\Unnamed_convention"
Using CATALINA_HOME: ? "D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59"
Using CATALINA_TMPDIR: "D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59\temp"
Using JRE_HOME: ? ? ? ?"C:\Program Files\Java\jdk1.7.0_55"
Using CLASSPATH: ? ? ? "D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59\bin\bootstrap.jar;D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59\bin\tomcat-juli.jar"
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?#############################################################
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?JRebel Legacy Agent 6.3.1 (201512181654)
2015-12-28 23:05:49 JRebel: ?(c) Copyright ZeroTurnaround AS, Estonia, Tartu.
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?Over the last 30 days JRebel prevented
2015-12-28 23:05:49 JRebel: ?at least 130 redeploys/restarts saving you about 0.2 hours.
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?Over the last 237 days JRebel prevented
2015-12-28 23:05:49 JRebel: ?at least 1375 redeploys/restarts saving you about 2.3 hours.
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?Licensed to wei huang (yonyou)
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?License type: evaluation
2015-12-28 23:05:49 JRebel: ?Valid from: December 28, 2015
2015-12-28 23:05:49 JRebel: ?Valid until: January 11, 2016
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?You are using an EVALUATION license.
2015-12-28 23:05:49 JRebel: ?Days left until license expires: 14
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?To extend your evaluation or purchase a license,
2015-12-28 23:05:49 JRebel: ?contact sales@zeroturnaround.com.
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?If you think this is an error, contact support@zeroturnaround.com.
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel:
2015-12-28 23:05:49 JRebel: ?#############################################################
2015-12-28 23:05:49 JRebel:
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: ? ? ? ?Apache Tomcat/7.0.59
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: ? ? ? ? ?Jan 28 2015 15:51:10 UTC
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: ? ? ? ? 7.0.59.0
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: ? ? ? ? ? ? ? Windows 7
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: ? ? ? ? ? ?6.1
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: ? ? ? ? ?amd64
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: ? ? ? ? ? ? C:\Program Files\Java\jdk1.7.0_55\jre
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: ? ? ? ? ? 1.7.0_55-b13
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: ? ? ? ? ? ?Oracle Corporation
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: ? ? ? ? C:\Users\Administrator\.IntelliJIdea15\system\tomcat\Unnamed_convention
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: ? ? ? ? D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.base=C:\Users\Administrator\.jrebel
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide.plugin.version=6.3.1-idea-13-15
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide.version=15.0.2
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide.product=IU
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.env.ide=intellij
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Drebel.notification.url=http://localhost:55537
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -javaagent:C:\Users\Administrator\.IntelliJIdea15\config\plugins\jr-ide-idea\lib\jrebel\jrebel.jar
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote=
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.port=1099
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.ssl=false
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.rmi.server.hostname=127.0.0.1
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.config.file=C:\Users\Administrator\.IntelliJIdea15\system\tomcat\Unnamed_convention\conf\logging.properties
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59\endorsed
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=C:\Users\Administrator\.IntelliJIdea15\system\tomcat\Unnamed_convention
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59
十二月 28, 2015 11:05:52 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=D:\software\apache-tomcat-7.0.59-windows-x64_idea\apache-tomcat-7.0.59\temp
十二月 28, 2015 11:05:52 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
十二月 28, 2015 11:05:52 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
十二月 28, 2015 11:05:54 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.1j 15 Oct 2014)
十二月 28, 2015 11:05:54 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-80"]
十二月 28, 2015 11:05:54 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
十二月 28, 2015 11:05:54 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 2609 ms
十二月 28, 2015 11:05:54 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
十二月 28, 2015 11:05:54 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.59
十二月 28, 2015 11:05:54 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-80"]
十二月 28, 2015 11:05:54 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
十二月 28, 2015 11:05:54 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 82 ms
Connected to server
[2015-12-28 11:05:54,535] Artifact convention:war exploded: Artifact is being deployed, please wait...
2015-12-28 23:05:55 JRebel: Directory 'D:\software\eclipse\workspace2\common_ssh\target\classes' will be monitored for changes.
2015-12-28 23:05:55 JRebel: Directory 'D:\software\eclipse\workspace2\io0007-find_progess\target\classes' will be monitored for changes.
2015-12-28 23:05:55 JRebel: Directory 'D:\software\eclipse\workspace2\oa_framework\target\classes' will be monitored for changes.
2015-12-28 23:06:01 JRebel: Monitoring Log4j configuration in 'file:/D:/software/eclipse/workspace2/convention/src/main/webapp/WEB-INF/classes/log4j.properties'.
28 十二月 2015 23:06:02,138 ?INFO org.springframework.web.context.support.XmlWebApplicationContext:510 - Refreshing Root WebApplicationContext: startup date [Mon Dec 28 23:06:02 CST 2015]; root of context hierarchy
28 十二月 2015 23:06:02,502 ?INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315 - Loading XML bean definitions from class path resource [beans.xml]
28 十二月 2015 23:06:02,930 ?INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315 - Loading XML bean definitions from class path resource [tv_beans.xml]
28 十二月 2015 23:06:03,057 ?INFO org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider:231 - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
28 十二月 2015 23:06:04,303 ?INFO org.springframework.context.support.PropertySourcesPlaceholderConfigurer:172 - Loading properties file from class path resource [jdbc.properties]
2015-12-28 23:06:04 JRebel: Monitoring properties in 'D:\software\eclipse\workspace2\convention\src\main\webapp\WEB-INF\classes\jdbc.properties'.
28 十二月 2015 23:06:05,514 ?INFO org.hibernate.annotations.common.Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
28 十二月 2015 23:06:05,527 ?INFO org.hibernate.Version:41 - HHH000412: Hibernate Core {4.2.2.Final}
28 十二月 2015 23:06:06,701 ?INFO org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory:48 - HHH000397: Using ASTQueryTranslatorFactory
初始化字典
Hibernate:
/* criteria query */ select
this_.id as id1_3_0_,
this_.description as descript2_3_0_,
this_.groupId as groupId3_3_0_,
this_.key2 as key4_3_0_,
this_.value as value5_3_0_
from
t_dictionary this_
order by
this_.groupId asc,
this_.key2 asc
28 十二月 2015 23:06:12,566 ?INFO org.springframework.web.servlet.DispatcherServlet:454 - FrameworkServlet 'spring2': initialization started
28 十二月 2015 23:06:12,574 ?INFO org.springframework.web.context.support.XmlWebApplicationContext:510 - Refreshing WebApplicationContext for namespace 'spring2-servlet': startup date [Mon Dec 28 23:06:12 CST 2015]; parent: Root WebApplicationContext
28 十二月 2015 23:06:12,583 ?INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315 - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring2-servlet.xml]
28 十二月 2015 23:06:12,842 ?INFO org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider:231 - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
28 十二月 2015 23:06:13,361 ?INFO org.hibernate.validator.internal.util.Version:27 - HV000001: Hibernate Validator 5.1.2.Final
28 十二月 2015 23:06:14,762 ?INFO org.springframework.web.servlet.DispatcherServlet:473 - FrameworkServlet 'spring2': initialization completed in 2195 ms
[2015-12-28 11:06:14,874] Artifact convention:war exploded: Artifact is deployed successfully
[2015-12-28 11:06:14,875] Artifact convention:war exploded: Deploy took 20,340 milliseconds
(9)修改了java文件,不用重啟tomcat,自動加載
參考:http://blog.csdn.net/sunny243788557/article/details/33688795