Eclipse和Tomcat:如何指定项目中提供的文件夹?

时间:2023-02-05 11:36:24

I'm using Eclipse 3.4 and Tomcat 5.5 and I have a Dynamic Web Project set up. I can access it from http://127.0.0.1:8080/project/ but by default it serves files from WebContent folder. The real files, that I want to serve, can be found under folder named "share". This folder comes from CVS so I'd like to use it with its given name instead of renaming it. How can this be done?

我正在使用Eclipse 3.4和Tomcat 5.5,并且我已经设置了动态Web项目。我可以从http://127.0.0.1:8080/project/访问它,但默认情况下它提供WebContent文件夹中的文件。我想要提供的真实文件可以在名为“share”的文件夹下找到。这个文件夹来自CVS所以我想用它给定的名字而不是重命名它。如何才能做到这一点?

5 个解决方案

#1


8  

In the project folder, there should be a file under the .settings folder named org.eclipse.wst.common.component that contains an XML fragment like this:

在项目文件夹中,名为org.eclipse.wst.common.component的.settings文件夹下应该有一个包含XML片段的文件,如下所示:

<wb-module deploy-name="WebProjectName">
    <wb-resource deploy-path="/" source-path="/WebContent"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>

You should be able to change the source-path under wb-resource to your share folder. I'd make these changes with the Eclipse project closed to be safe.

您应该能够将wb-resource下的源路径更改为共享文件夹。我将关闭Eclipse项目进行这些更改以确保安全。

This is a setting that you pick when you first create the Dynamic Web Project in Eclipse - I can't find how to change the value in an existing project thru Eclipse itself.

这是您在Eclipse中首次创建Dynamic Web Project时选择的设置 - 我无法找到如何通过Eclipse本身更改现有项目中的值。

If you want the share folder to be mapped to a different path when deployed, such as /share/ in your webapp, you can probably just add another wb-resource element.

如果您希望在部署时将共享文件夹映射到其他路径,例如webapp中的/ share /,则可以添加另一个wb-resource元素。

#2


4  

Can be done through Eclipse, no need to manually edit .settings files.

可以通过Eclipse完成,无需手动编辑.settings文件。

In Eclipse 3.6 (and possibly earlier releases),

在Eclipse 3.6(以及可能的早期版本)中,

  1. right click on your project
  2. 右键单击您的项目

  3. click on properties
  4. 点击属性

  5. Click on 'Deployment Assembly'
  6. 点击“部署装配”

  7. Add... Folder -> Next
  8. 添加...文件夹 - >下一步

  9. Navigate to source folder
  10. 导航到源文件夹

  11. Finish

#3


2  

if you're running windows, use the junction utility from MS : http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx and map your share directory to the Webcontent folder. I've regularly done several of these mappings quite regularly.

如果您正在运行Windows,请使用MS的联结实用程序:http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx并将共享目录映射到Webcontent文件夹。我经常定期完成其中几个映射。

#4


0  

On STS 2.5.1

在STS 2.5.1上

  1. right click on your project
  2. 右键单击您的项目

  3. click on properties
  4. 点击属性

  5. Click on 'Java Build path'
  6. 单击“Java Build path”

  7. Click "Source" tab
  8. 单击“源”选项卡

  9. Navigate to default out put folder
  10. 导航到默认输出文件夹

  11. Browse and add your path
  12. 浏览并添加您的路径

  13. Finish

#5


0  

you can specify location of webcontent in R-click on project > Properties > Deployment Assembly

您可以在项目>属性>部署程序集的R单击中指定webcontent的位置

This is what I did in mys STS, you can add or remove a location.

这就是我在mys STS中所做的,你可以添加或删除一个位置。

#1


8  

In the project folder, there should be a file under the .settings folder named org.eclipse.wst.common.component that contains an XML fragment like this:

在项目文件夹中,名为org.eclipse.wst.common.component的.settings文件夹下应该有一个包含XML片段的文件,如下所示:

<wb-module deploy-name="WebProjectName">
    <wb-resource deploy-path="/" source-path="/WebContent"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>

You should be able to change the source-path under wb-resource to your share folder. I'd make these changes with the Eclipse project closed to be safe.

您应该能够将wb-resource下的源路径更改为共享文件夹。我将关闭Eclipse项目进行这些更改以确保安全。

This is a setting that you pick when you first create the Dynamic Web Project in Eclipse - I can't find how to change the value in an existing project thru Eclipse itself.

这是您在Eclipse中首次创建Dynamic Web Project时选择的设置 - 我无法找到如何通过Eclipse本身更改现有项目中的值。

If you want the share folder to be mapped to a different path when deployed, such as /share/ in your webapp, you can probably just add another wb-resource element.

如果您希望在部署时将共享文件夹映射到其他路径,例如webapp中的/ share /,则可以添加另一个wb-resource元素。

#2


4  

Can be done through Eclipse, no need to manually edit .settings files.

可以通过Eclipse完成,无需手动编辑.settings文件。

In Eclipse 3.6 (and possibly earlier releases),

在Eclipse 3.6(以及可能的早期版本)中,

  1. right click on your project
  2. 右键单击您的项目

  3. click on properties
  4. 点击属性

  5. Click on 'Deployment Assembly'
  6. 点击“部署装配”

  7. Add... Folder -> Next
  8. 添加...文件夹 - >下一步

  9. Navigate to source folder
  10. 导航到源文件夹

  11. Finish

#3


2  

if you're running windows, use the junction utility from MS : http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx and map your share directory to the Webcontent folder. I've regularly done several of these mappings quite regularly.

如果您正在运行Windows,请使用MS的联结实用程序:http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx并将共享目录映射到Webcontent文件夹。我经常定期完成其中几个映射。

#4


0  

On STS 2.5.1

在STS 2.5.1上

  1. right click on your project
  2. 右键单击您的项目

  3. click on properties
  4. 点击属性

  5. Click on 'Java Build path'
  6. 单击“Java Build path”

  7. Click "Source" tab
  8. 单击“源”选项卡

  9. Navigate to default out put folder
  10. 导航到默认输出文件夹

  11. Browse and add your path
  12. 浏览并添加您的路径

  13. Finish

#5


0  

you can specify location of webcontent in R-click on project > Properties > Deployment Assembly

您可以在项目>属性>部署程序集的R单击中指定webcontent的位置

This is what I did in mys STS, you can add or remove a location.

这就是我在mys STS中所做的,你可以添加或删除一个位置。