How to make war file in Eclipse

173,931

File -> Export -> Web -> WAR file

OR in Kepler follow as shown below :

enter image description here

Share:
173,931

Related videos on Youtube

vbence
Author by

vbence

Hi, my name is Bence and I'm a developer. Current projects: stream.m - A WebM and H.264 live streaming server DVB InputStream - Java interface for digital tuners (for Windows and Linux)

Updated on June 09, 2020

Comments

  • vbence
    vbence almost 4 years

    What is the easy way to make war file?

    My project is working when i right click run on server, but i want to deploy on tomcat server. I have installed m2clipse but it gave me an error.

    1. Is maven compulsory to make war file?
    2. Do i need special directory structure to make war with eclipse?

      Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project testing2: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1] [ERROR]

  • Chris Thompson
    Chris Thompson about 13 years
    I believe you can also export a jar file and simply give it a .war extension
  • Konstantin Komissarchik
    Konstantin Komissarchik about 13 years
    Exporting a jar and renaming it will most definitely not work. While both jar and war are basically zip archives, their contents are drastically different.
  • Chris Thompson
    Chris Thompson about 13 years
    The only difference is the presence of the WEB-INF directory and the location of the binary output. Eclipse can be configured to generate this properly via the jar export functionality.
  • Konstantin Komissarchik
    Konstantin Komissarchik about 13 years
    That's not the only difference. A WAR has "web content" in addition to descriptors and java classes. The export WAR wizard works with the Eclipse Dynamic Web Project than the asker is undoubtedly using to make sure that the web content and all the other pieces get properly packaged into the WAR.
  • Dan Jameson
    Dan Jameson about 10 years
    My version of Eclipse (Kepler, 20130614-0229) has neither "Web" nor "WAR file" as an export option.
  • KNU
    KNU almost 10 years
    @DanJameson in the Project Explorer menu Right Click on the Web project to find Export -> WAR File. Thanx
  • KrishPrabakar
    KrishPrabakar almost 9 years
    @Dan Jameson - Is your project a '(Dynamic) Web Project' ?
  • Cos64
    Cos64 about 7 years
    @DanJameson My Eclipse (Neon) also didn't have the option to export to "Web / WAR file", until I installed "Eclipse Java EE Developer Tools".