eclipse Eclipse每次运行项目都会修改server.xml(Run-->Run on Server)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15233263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:06:15  来源:igfitidea点击:

Eclipse modifies server.xml each time run the project (Run-->Run on Server)

eclipsesettingstomcat7eclipse-juno

提问by Unknown

I'm using Tomcat 7 on Eclipse Juno. I use workspace metadata as server location (Please see my tomcat configurations below).

我在 Eclipse Juno 上使用 Tomcat 7。我使用工作区元数据作为服务器位置(请参阅下面的我的 tomcat 配置)。

Tomcat configurations

Tomcat 配置

Also I got a Server projectin eclipse [please see the image below] with separate server.xml and other configuration files.

此外,我在 Eclipse 中获得了一个服务器项目[请参见下图],其中包含单独的 server.xml 和其他配置文件。

Server project

服务器项目

Normally it works fine. The issue came across after I changed the server.xml (in eclipse project) for SSL configurations.

通常它工作正常。在我为 SSL 配置更改 server.xml(在 eclipse 项目中)后,问题出现了。

Configurations are working fine. But each time I run the project (Run-->Run on Server) server.xml get modified to the default version. My customized SSL changes are missing.

配置工作正常。但是每次我运行项目(运行-->在服务器上运行)server.xml 都会被修改为默认版本。我的自定义 SSL 更改丢失。

Also I tried to change server.xml in tomcat installation location (C:\apache-tomcat-7.0.35\conf), but it didn't pick from eclipse.

我还尝试更改 tomcat 安装位置(C:\apache-tomcat-7.0.35\conf)中的 server.xml,但它没有从 eclipse 中选择。

Can anyone please help me on this?

任何人都可以帮我解决这个问题吗?

Thanks

谢谢

采纳答案by Unknown

I found an applicable solution but not a perfect one.

我找到了一个适用的解决方案,但不是一个完美的解决方案。

What I have done is;

我所做的是;

1.Changed server.xml file in installation location (In my case C:\apache-tomcat-7.0.35\conf)

1.在安装位置更改了 server.xml 文件(在我的情况下是 C:\apache-tomcat-7.0.35\conf)

2.Remove tomcat server from eclipse server panel (please see the image below)

2.从eclipse服务器面板中删除tomcat服务器(请看下图)

3.Create a new server in eclipse server panel.

3.在eclipse服务器面板中新建一个服务器。

4.Then Server project will be generated new server.xml with my customized changes.

4.然后将生成带有我自定义更改的新 server.xml 服务器项目。

5.The trick is, initially eclipse picks server.xml from installation location when create a new server in panel.

5.诀窍是,在面板中创建新服务器时,最初 Eclipse 会从安装位置选择 server.xml。

Thanks

谢谢

eclipse server panel

日食服务器面板

回答by Exocom

In {workspace}/Serversyou will find a folder for every Tomcat configuration, containing several configuration files, including the server.xml. There you then can edit the filedirectly.

{workspace}/Servers 中,您会为每个 Tomcat 配置找到一个文件夹,其中包含多个配置文件,包括server.xml。然后就可以直接编辑文件了

To get changes taken into account restart Eclipse. That is imho better than removing and adding the configuration back all the time. Tested using Eclipse Marsand Tomcat 7.

要将更改考虑在内,请重新启动 Eclipse。恕我直言,这比一直删除和添加配置要好。使用 Eclipse MarsTomcat 7 进行测试。

(the solution is from: Eclipse with tomcat - eclipse modifies server.xml)

(解决方案来自:Eclipse with tomcat - eclipse 修改 server.xml

回答by Muhammad Gelbana

Make sure you are editing the files right beneath the tomcat server folder, not the ones beneath the config folder. Check the attached screenshot for the files I'm referring to.

确保您正在编辑 Tomcat 服务器文件夹下的文件,而不是 config 文件夹下的文件。检查我所指文件的附加屏幕截图。

enter image description here

在此处输入图片说明

回答by m4d0

On Eclipse, double click on Server to view properties.
check "publish module contexts to separate XML files", and save it. Run Tomcat server. Eclipse will be create conf/[enginename]/[hostname]/[appname].xml without touching server.xml

在 Eclipse 上,双击服务器以查看属性。
选中“发布模块上下文以分隔 XML 文件”,然后保存。运行Tomcat服务器。Eclipse 将在不触及 server.xml 的情况下创建 conf/[enginename]/[hostname]/[appname].xml

回答by Kabiraj Kharel

Make sure that the path in the server.xml is same as in the Web project Settings.

确保 server.xml 中的路径与 Web 项目设置中的路径相同。

To see the Web Project Settings: Right click on the project >> Properties >> Web Project Settings.

要查看 Web 项目设置:右键单击项目 >> 属性 >> Web 项目设置。

Always give the project path over here. The path in server.xml will automatically updated.

总是在这里给出项目路径。server.xml 中的路径将自动更新。

回答by Pigasus

I had this problem too, and the solution worked (I don't have enough reputation points to vote up the answer).

我也遇到了这个问题,解决方案奏效了(我没有足够的声望点来投票给答案)。

On a similar note, I had to make configuration changes to a port number and that also required me to delete and re-add my tomcat instance from STS (spring tool suite).

同样,我必须对端口号进行配置更改,这还需要我从 STS(spring 工具套件)中删除并重新添加我的 tomcat 实例。

回答by Subhashish

Clean Tomcat Work Directory & Republish the project.

清理 Tomcat 工作目录并重新发布项目。

enter image description here

在此处输入图片说明