-2

I'm developing an Installer for a project team to reduce the amount of work they have to do installing it manually.

We are using: Windows 7 x64, Eclipse Kepler

Right now I'm looking for a way to import a .war file using the commandline.

Is there any way to do this via cmd?

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
tr4pt
  • 317
  • 3
  • 15
  • Where do you want to import the installer? .war is a web archive for JEE servers – Dimitri Jan 30 '14 at 14:02
  • 1
    So you are trying to import a .WAR file into Eclipse? Why? Otherwise ... what do you mean by "import"? – Stephen C Jan 30 '14 at 14:02
  • because it is a demand of the project team... they need the .WAR file in eclipse – tr4pt Jan 30 '14 at 14:04
  • 1
    What is inside the war? What do you mean by "they need the war file in Eclipse"? – mrjink Feb 20 '14 at 13:38
  • Proxy Servlet - HTTPS Be sure that the Tomcat server is stopped. Download the war file and import in your Eclipse through File->Import-> Web->War File. its a proxy.war file which has to be included in eclipse – tr4pt Feb 20 '14 at 13:46
  • 3
    That's an strange use case... I'd say your team should use Maven or similar tool to handle the IDE configuration and project import. – Gilberto Torrezan Feb 20 '14 at 14:55

4 Answers4

4

First of all, I would not recommend importing the source code from a file in Eclipse if you have a team of developers, as you would be giving everyone a version that will hardly be actual after some days of work. Using some repository (CVS, SVN, GIT) would be the way to go.

If you have your code in a central repository, then you could make a "Project Set" file in Eclipse wich can be imported easily to setup your whole workspace:

http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-cvs-project-set.htm

This project set might have instructions on how to construct the Workspace based on checkouts of the repositories you need.

If you happen to work at a company that uses some X or Y old-fashioned Source Control tool (or worse, none at all), and you have no chances of implementing one that is compatible with Eclipse (like the three I stated above), then the time you are saving with automating the import of a war file will become irrelevant compared to the source code control issues you will be facing (or the team is facing already).

Martin
  • 3,018
  • 1
  • 26
  • 45
0

A WAR file is a ZIP file. If you need the content of the WAR you can use the tools for ZIP archives.

ArnoS
  • 26
  • 2
  • I know how to unzip a war file etc. thx anyway but my problem is HOW do I import this war file in eclipse-kepler with the commandline? so when the developers start eclipse for the first time (after the installer is finished) they can work with the content of the .war file in eclipse – tr4pt Jan 30 '14 at 15:42
0

A workaround in case eclipse does not have any such options would be to

  1. do a Import WAR through eclipse GUI
  2. check what changes are made to workspace by eclipse (eg. folder created with exploded war file content, configuration files created by eclipse in the folder like .classpath for project folders etc)
  3. Identify the steps and replicate the same through a batch file
  4. Add a call to the batch file in eclipse launch short cut
somshivam
  • 759
  • 7
  • 19
0

There is no command line API I know to do this task for Eclipse just from command line, but with the right tools you can achieve what you want.

Please try this:

  1. Straightforward approach that works with any GUI application. You can use AutoIt scripts for interaction with any application. The downside is that GUI may change more frequently than command line API.
  2. Try to create Eclipse project with metadata and unpack WAR file in this project. It can be done, for instance, with Maven or Gradle. Those also can download all dependencies for you.
senyor
  • 332
  • 4
  • 9