Preferenc-6ren">
gpt4 book ai didi

java - 如何更改 Eclipse 中的 "Dynamic Web Project"默认源和输出文件夹?

转载 作者:搜寻专家 更新时间:2023-11-01 03:13:43 26 4
gpt4 key购买 nike

如何在“动态 Web 项目”中更改“构建路径上的源文件夹”和“默认输出文件夹”的默认值Eclipse 中的向导,可能就像我们在

中为“ Java 项目”所做的那样

Windows > Preferences > Java > Build Path

目的是:每次我创建新的动态 Web 项目时,向导应该显示我选择的默认源和输出文件夹。
由于此选项可用于 Java 项目,所以我相信 Web 项目也应该有类似的东西,但我找不到它。顺便说一句,我尝试更改 Java 项目的默认值,但它不会影响动态 Web 项目。

最佳答案

您能否将 Web 功能添加到现有的 Java 项目中?

此外,this是如何通过编辑 .project 文件来转换 Java 项目(与我记得在 Eclipse 中的做法不同)。这可能会让您深入了解如何修改您的 .project 文件。

docs似乎表明 JavaSource 是指示动态 Web 项目的 Java 源文件的属性。

JavaSource Contains the project's Java source code for classes, beans, and servlets. When these resources are added to a Web project, they are automatically compiled and the generated files are added to the WEB-INF/classes directory. The contents of the source directory are not packaged in WAR files unless an option is specified when a WAR file is created. Note: Though the default name given to the folder is JavaSources, you can change the name by right clicking on the name in the Project Explorer and clicking on Refactor > Rename.

此外,我认为由于动态 Web 项目旨在遵守 J2EE 标准,因此您不能更改项目中输出文件夹的路径。但是,您可以根据需要重命名它。

WebContent folder The mandatory location of all Web resources, including HTML, JSP, graphic files, and so on. If the files are not placed in this directory (or in a subdirectory structure under this directory), the files will not be available when the application is executed on a server. The Web content folder represents the contents of the WAR file that will be deployed to the server. Any files not under the Web content folder are considered development-time resources (for example, .java files, .sql files, and .mif files), and are not deployed when the project is unit tested or published. Note: Though the default name given to the folder is WebContent, you can change the name in the Project Explorer by right-clicking the folder and selecting RefactorRename or from the Web page of the project's Properties dialog. In a dynamic Web project, changing the folder name will update the Java build output directory.

关于java - 如何更改 Eclipse 中的 "Dynamic Web Project"默认源和输出文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4511406/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com