In fact, the beginning of the requirement to compress the source code into a war file, confused!
Company projects require CAS SSO single sign-on
That's the thing ....
In fact, the war file is the packaging of Web applications in Java. To borrow a man's words, "When you have a lot of Web applications, if you want to deploy it to other machines, it's a pretty depressing thing to go back and forth, if it's a file ..." Then the war file will meet your little request. "
Then some people will say, this and directly into the RAR file is not the same? The difference is big!
If you directly into the RAR file, you have to manually unzip, but the war file does not need, you put it into the Tomcat WebApp directory, you can directly run, I think this work can be powerful, haha.
in the Tomcat installation directory under the Conf directory there is a server.xml, search "unpackwars" keyword, you will see in the <Host> tag will have its settings, if set to true, then tomcat at boot time, Automatically extracts your war file in the WebApps directory, and if set to False, Tomcat accesses the war file directly.
If his value is true, your tomcat has been started, you have automatically unpacked folder deleted, Tomcat will automatically unzip, I think it is real-time in the check, once there is no, it will decompress.
How do I generate a war file?
JAR-CVF Blog.war *
How to view the war file
JAR-TF Blog.war
In fact, in eclipse, the realization of such a function is also very simple
Create a new Web project:
Named: Eclipse4war (the name can be taken from any drop)
Items--Right-click
export--> WAR file
Start Tomcat
Go to the management interface of Tomcat: See the Red box section
Deployment success:
Visit Homepage:
Reference documents:
Http://www.cnblogs.com/hongten/archive/2012/11/27/hongten_java_eclipse_war_tomcat.html
Http://www.cnblogs.com/lan0725/archive/2010/01/20/1874009.html
Http://www.cnblogs.com/visec479/p/4523700.html
War file Deployment (RPM)