Question

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?

Was it helpful?

Solution

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).

OTHER TIPS

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

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

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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top