我如何在eclipse web项目中更改WebContent文件夹到不同的地方?

时间:2023-01-13 16:37:36

With the Galileo release it is finally possible to convert a normal Java project to a dynamic web project. Unfortunately it assumes that the Web stuff is located in a folder WebContent, which is not necessarily the case for an existing project. How can I change it? In MyEclipse it is quite easy, but with a stock eclipse I don't find such an option!

通过Galileo发行版,最终可以将普通Java项目转换为动态web项目。不幸的是,它假定Web内容位于文件夹的WebContent中,这并不一定是现有项目的情况。我怎样才能改变它呢?在MyEclipse中,这很简单,但是有了eclipse,我就找不到这样的选择了!

3 个解决方案

#1


52  

I am not sure what you meant by "a stock eclipse", but Helios allows this functionality in a very straight-forward way:

我不确定你所说的“a stock eclipse”是什么意思,但是Helios非常直接地允许这个功能:

  • Right click your dynamic web project and open "Properties".
  • 右键单击动态web项目并打开“属性”。
  • Find Deployment Assembly and you should be able to set context paths from there.
  • 找到部署程序集,您应该能够从那里设置上下文路径。
  • #2


    24  

    I am not sure if there is UI for this or not, but you can edit file .settings/org.eclipse.wst.common.component, and change following line:

    我不确定是否有UI,但您可以编辑file .settings/org.eclipse.wst.common.component,并更改以下行:

    <wb-resource deploy-path="/" source-path="/WebContent"/>
    

    Change /WebContent to your preferred directory. I use this for a several years now and encountered no problems with it.

    更改/WebContent到您的首选目录。我使用它已经有好几年了,并且没有遇到任何问题。

    #3


    12  

    Go in the project properties and do like this example where I use the Maven webapp folder:

    进入项目属性,就像这个例子一样,我使用Maven webapp文件夹:

    我如何在eclipse web项目中更改WebContent文件夹到不同的地方?

    #1


    52  

    I am not sure what you meant by "a stock eclipse", but Helios allows this functionality in a very straight-forward way:

    我不确定你所说的“a stock eclipse”是什么意思,但是Helios非常直接地允许这个功能:

  • Right click your dynamic web project and open "Properties".
  • 右键单击动态web项目并打开“属性”。
  • Find Deployment Assembly and you should be able to set context paths from there.
  • 找到部署程序集,您应该能够从那里设置上下文路径。
  • #2


    24  

    I am not sure if there is UI for this or not, but you can edit file .settings/org.eclipse.wst.common.component, and change following line:

    我不确定是否有UI,但您可以编辑file .settings/org.eclipse.wst.common.component,并更改以下行:

    <wb-resource deploy-path="/" source-path="/WebContent"/>
    

    Change /WebContent to your preferred directory. I use this for a several years now and encountered no problems with it.

    更改/WebContent到您的首选目录。我使用它已经有好几年了,并且没有遇到任何问题。

    #3


    12  

    Go in the project properties and do like this example where I use the Maven webapp folder:

    进入项目属性,就像这个例子一样,我使用Maven webapp文件夹:

    我如何在eclipse web项目中更改WebContent文件夹到不同的地方?