简体   繁体   English

Intellij Vs中的路径。 日食

[英]Path in Intellij Vs. Eclipse

My company is attempting to make a transition from Eclipse to Intellij Idea and I have a (might be silly) question regarding the paths. 我的公司正在尝试从Eclipse过渡到Intellij Idea,我对路径有一个(可能很愚蠢)问题。

I have a library in the root of the eclipse project and a spring configuration file which simply points to it by "folderName/file.txt". 我在eclipse项目的根目录中有一个库,还有一个spring配置文件,该文件仅通过“ folderName / file.txt”指向它。 It works fine in Eclipse since it recognizes the folder. 由于它可以识别文件夹,因此在Eclipse中可以正常工作。 In IntelliJ however it seems to not pick the folder at all. 但是在IntelliJ中,它似乎根本不选择文件夹。

I've tried to mark the folder as a resource/test resource folder but it seems to simply take the contents of the folder and dump it directly into the target folder without the folder itself, just the contents. 我曾尝试将文件夹标记为资源/测试资源文件夹,但它似乎只是获取文件夹的内容并将其直接转储到目标文件夹中,而没有文件夹本身,而只是内容。

Is there a way to configure IntelliJ to work with the folder just like in Eclipse? 有没有一种方法可以像在Eclipse中一样配置IntelliJ以使其与文件夹一起使用? This is important because some are still using Eclipse, some IntelliJ, so we need a solution that will work for both. 这很重要,因为有些人仍在使用Eclipse,有些人则是IntelliJ,因此我们需要一个适用于两者的解决方案。

I am guessing your are using maven since you mention the "target folder" 我猜您正在使用Maven,因为您提到了“目标文件夹”
What happens is that since your imported the project from the maven pom.xml intellij build it by following maven. 发生的是,由于您是从maven pom.xml intellij导入项目的,因此请按照以下maven进行构建。 In maven the default project structure is this Maven中默认的项目结构是

在此处输入图片说明

This in maven everything you copy in the resources folder, will be copied to your root classpath. 在maven中,您复制到资源文件夹中的所有内容都将复制到您的根类路径中。 so if you make for resources/myFolder/my.txt then in the build you will have copied to your classpath myFolder/my.txt Anyway if you are not using maven all you have to do is go to 因此,如果您要使用资源/myFolder/my.txt,那么在构建中,您将已复制到您的类路径myFolder / my.txt。如果您不使用Maven,那么您要做的就是

Project structure ( ctrl + alt + shift + s ) - Modules - go to your module - mark the folder that your want to add as resource 项目结构ctrl + alt + shift + s )- 模块 -转到您的模块-标记要添加为资源的文件夹
在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM