如何在IntelliJ IDEA中配置Spring facet

use*_*598 28 spring intellij-idea

我是Intellij 14.0的新手.我当时正在使用Netbeans,但我的同事告诉我转移到intellij,所以我做了.

我需要运行我在Intellij上运行netbeans的同一个项目.我正在研究的项目是用grails和spring制作的.当我尝试使用Intellij运行项目时,这就是我得到的.

Spring配置检查找到未映射的Spring配置文件.请为模块配置/设置Spring facet:.........(1个文件)

这是文件.

applicationContext.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
        <description>Grails application factory bean</description>
        <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
        <property name="grailsResourceLoader" ref="grailsResourceLoader" />
    </bean>

    <bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
        <description>A bean that manages Grails plugins</description>
        <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
        <property name="application" ref="grailsApplication" />
    </bean>

    <bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
        <constructor-arg>
            <ref bean="grailsApplication" />
        </constructor-arg>
        <property name="pluginManager" ref="pluginManager" />
    </bean>

    <bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" />

    <bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
        <property name="encoding">
            <value>utf-8</value>
        </property>
    </bean>

    <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" />
</beans>
Run Code Online (Sandbox Code Playgroud)

老实说,我不知道如何解决它.根据我的理解,它正在寻找一些模块,但我无法解决它.我甚至试过这个"添加框架支持".但我在名单中找不到弹簧.

你能帮我解决这个问题吗?谢谢

Boh*_*rdt 31

转到文件/项目结构/模块,单击绿色加号图标,从下拉列表中选择弹簧,然后在下一个对话框中选择您的模块.

然后单击右窗格中的绿色加号,单击加号并选择Spring配置文件和类,然后单击"确定".

另请参阅 Spring Facet的IntelliJ帮助.

  • 不确定这是版本差异和/或OS差异,但在IDEA 2017.1.3 for Mac中,有一个"Facets"选项与"Modules"分开.此外,加号图标为黑色,而不是绿色. (4认同)
  • 但它是什么?它是干什么用的? (4认同)

Wal*_*ter 6

今天突然遇到这个问题\xe2\x80\x94我的构建昨晚工作正常,今天早上它停止工作\xe2\x80\x94所以我想我会使用IntelliJIDE CE 2019.1发布我的解决方案。

\n\n

错误消息(帮助人们找到这个答案)

\n\n
package org.springframework.transaction.annotation does not exist\npackage org.springframework.boot does not exist\nUnknown facet type: \'Spring\'\nUnknown facet type: \'web\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

在此输入图像描述

\n\n
\n\n

解决方案

\n\n

步骤0:\n更新 IntelliJ

\n\n
Menu: IntelliJIDE > Check for Updates (Mac OSX) \n
Run Code Online (Sandbox Code Playgroud)\n\n

步骤1:\n清理 Maven 存储库并重新下载依赖项以确保源未损坏。这将需要 5 分钟以上。

\n\n
$ cd [project_directory]\n$ mvn dependency:purge-local-repository\n
Run Code Online (Sandbox Code Playgroud)\n\n

第2步:\n执行全新安装。

\n\n
$ mvn clean install\n
Run Code Online (Sandbox Code Playgroud)\n\n

步骤3:\n更新 IntelliJIDE 的存储库索引:

\n\n
    \n
  1. 打开 IntelliJ 设置/首选项
  2. \n
  3. 构建、执行、部署 > 构建工具 > Maven > 存储库
  4. \n
  5. 一一选择存储库(通过单击表行),然后单击更新按钮。具体来说,针对https://repo.mave.apache.org/maven2执行此操作。下载是\xc2\xb1700mb,所以需要一段时间。(10+分钟)\n在此输入图像描述
  6. \n
\n\n
\n\n

相关问题

\n\n\n


归档时间:

查看次数:

50564 次

最近记录:

6 年,7 月 前