IntelliJ没有看到资源文件夹 [英] IntelliJ not seeing resources folder

查看:119
本文介绍了IntelliJ没有看到资源文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Maven模块在IntelliJ中从头创建了一个新项目。我没有选择任何特定的原型,我点击完成。项目得到很好的创建,我按预期在src / main下有 java resources 文件夹。

I created a new Project from scratch in IntelliJ by using a Maven Module. I didn't select any specific archetypes and I clicked on finish. The project gets created nicely and I have the java and resources folders under src/main as expected.

不幸的是,我的应用程序在 resources 文件夹中找不到任何属性文件,因为它在项目基础文件夹中查找。

Unfortunately, my application does not find any property files in the resources folder because it looks in the project base folder instead.

我仔细检查了资源文件夹在项目结构中被标记为源文件夹,我还尝试将以下内容添加到pom.xml中但没有成功:

I double checked that the resources folder is marked as 'source folder' in the Project Structure and I also tried to add the following to the pom.xml with no success:

<resources>
  <resource>
    <directory>src/main/resources</directory>
  </resource>
</resources>

我正在使用Maven 2.2.1和IntelliJ 11.1,有什么想法吗?

I'm using Maven 2.2.1 and IntelliJ 11.1, Any thoughts??

推荐答案

Intellij 12中有一个错误请转到Settings-> Compiler并取消勾选Use external build复选框 - 它背后的想法是因为假设编译器在一个单独的进程中运行得更快,但实际上存在一个错误,当使用maven时它不会复制资源。

There is a bug in Intellij 12 please go to Settings->Compiler and un-check "Use external build" check box - the idea behind it was that it was suppose to run faster with a compiler run in a separate process but in fact there is a bug and when using maven it does not copy resources.

这篇关于IntelliJ没有看到资源文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆