Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Importing a war into a dynamic web project
Importing a war into a dynamic web project [message #230615] Thu, 23 April 2009 07:24 Go to next message
breako  is currently offline breako
Messages: 57
Registered: July 2009
Member
I wish to import a war file into a dynamic web project. All easy. But, I
wish for the war to not be packaged as another web project with my dynamic
web project. Not easy.

More specifically:

Before I import, my file / folder structure is:

\myproj\.metadata
\myproj\.settings
\myproj\build
\myproj\src
\myproj\WebContext

I then import my war. I am prompted for:
1. WAR file
2. Web Project
3. etc

Whatever I specify for the Web Project, Eclipse creates a subdirectory
with this name.

So if I do
Web Project = mywar

Eclipse does creates a new sub folder, mywar, and unpacks the war there:

e.g.

\myproj\mywar
\myproj\mywar\.settings
\myproj\mywar\build
\myproj\mywar\src
\myproj\mywar\WebContext
\myproj\mywar\.classpath
\myproj\mywar\.project

This makes things messy as I have two WebContext directories, two src
directories and two build directories.

I'd much prefer to unpack the war into the existing \WebContext
\.classpath \.project directories, rather than create new ones. Is there
anyway to do this?
Re: Importing a war into a dynamic web project [message #230623 is a reply to message #230615] Thu, 23 April 2009 11:17 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
It looks like you are trying to collapse the workspace and project into a
single directory. That is not something that Eclipse allows. How did you
create your starting structure? The typical structure is
<workspace.root>/<project.root>, but you can also have the project root be
somewhere else on the file system. What is not allowed is workspace.root
== project.root.

If the myproj directory is where you ultimately want to build your webapp,
you need to pick another directory to be your workspace root. I would
close eclipse and delete .metadata folder in the myproj directory. After
that step re-open eclipse and pick a different workspace directory. The
easiest thing to do is to use the parent dir of myproj.

Hope this helps.

- Konstantin
Re: Importing a war into a dynamic web project [message #230634 is a reply to message #230623] Thu, 23 April 2009 12:49 Go to previous messageGo to next message
breako  is currently offline breako
Messages: 57
Registered: July 2009
Member
That's interesting. I am wondering is it possible to import a war into a
dynamic web project and hence expand that war into that dyanmic web
project and not create another web project inside the existing dynamic web
project?
Re: Importing a war into a dynamic web project [message #230639 is a reply to message #230634] Thu, 23 April 2009 14:04 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 937
Registered: July 2009
Senior Member
Yes, that should be possible if your starting setup is valid in the first
place.
Re: Importing a war into a dynamic web project [message #230676 is a reply to message #230639] Fri, 24 April 2009 05:53 Go to previous message
breako  is currently offline breako
Messages: 57
Registered: July 2009
Member
Thanks for getting back. I tried:
1. creating a new workspace
2. containing a dynamic web project underneath the workspace

So my dir structure is:

workspace.home\.metdata
workspace.home\mydynamicwebproject
workspace.home\mydynamicwebproject\.settings
workspace.home\mydynamicwebproject\build
workspace.home\mydynamicwebproject\src
workspace.home\mydynamicwebproject\WebContent
workspace.home\mydynamicwebproject\.classpath
workspace.home\mydynamicwebproject\.project

I then right click, and select to import my external war.
I am prompted to specify the webproject for it, I specify
\mydymanicwebproject

I am not allowed. I get: A project already exists with this name.

I create a new dynamic web project and I move this to a remote location,
away from the workspace altogether.

I try to import a war again. I specify this project as the webproject. I
get same error message.

So it appears you can't import a war into an existing dynamic web project.

You can of course specify a new web project name for the war but this will
just create another web project for the war, rather than use an existing
one.
Previous Topic:Update server.xml and catalina.properties
Next Topic:external javadonc
Goto Forum:
  


Current Time: Fri Aug 01 01:47:01 EDT 2014

Powered by FUDForum. Page generated in 0.02233 seconds