Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Spring facet in IntelliJ IDEA

I'm new to Intellij 14.0 . I was using Netbeans, but my colleagues told me to shift to intellij and so I did.

I need to run the same project that I ran on netbeans in Intellij. The project that I'm working on is made of grails and spring. When I tried to run the project using Intellij this is what I get.

Spring Configuration Check Unmapped Spring configuration files found. Please configure/setup Spring facet for modules: ......... (1 file)

And this is the file.

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>

Honestly, I dont have any idea how to fix it. Based on my understanding it is looking for some modules but I could not fix it. I even tried this "Add framework support" . But I couldn't find spring in the list.

Could you help me fix this? Thanks

like image 300
user3714598 Avatar asked Sep 30 '15 08:09

user3714598


People also ask

What is a Spring facet?

A facet represents configuration specific for a particular framework/technology, associated with a module. A module can have multiple facets. E.g. Spring Framework specific configuration is stored in a Spring facet.

How do I set up a facet website?

Create an application server-specific deployment descriptor (for example glassfish-web. xml, jboss-web. xml) and add it to the list. Specify the directories that contain your web app resources such as web pages, images, etc.


3 Answers

Go to File/Project Structure/Modules, click the green plus icon, select Spring from the dropdown and select your module in the next dialog.

Then click the green plus in the right pane, click plus and select your Spring configuration files and classes and click OK.

Also take a look at IntelliJ Help for Spring Facet.

like image 89
Bohuslav Burghardt Avatar answered Oct 18 '22 17:10

Bohuslav Burghardt


Just ran into this issue out of the blue today—my build was working last night, and this morning it stopped working—so I figured I'd post my solution using IntelliJIDE CE 2019.1.

Error Messages (to help people find this answer)

package org.springframework.transaction.annotation does not exist
package org.springframework.boot does not exist
Unknown facet type: 'Spring'
Unknown facet type: 'web'

enter image description here


Solution

Step 0: Update IntelliJ

Menu: IntelliJIDE > Check for Updates (Mac OSX) 

Step 1: Clean out Maven repo and re-download dependencies to ensure that the sources are not corrupt. This will take 5+min.

$ cd [project_directory]
$ mvn dependency:purge-local-repository

Step 2: Preform a clean install.

$ mvn clean install

Step 3: Update IntelliJIDE's Repository Indexes:

  1. Open IntelliJ Settings/Preferences
  2. Build, Execution, Deployment > Build Tools > Maven > Repositories
  3. Select repositories one by one (by clicking on the table row) and click the update button. Specifically, do it for https://repo.mave.apache.org/maven2. The download is ±700mb so it will take a while. (10+min) enter image description here

Related Questions

  • getting package org.springframework.transaction.annotation does not exist error while packaging app
  • package org.springframework.boot does not exist
like image 6
Wallter Avatar answered Oct 18 '22 18:10

Wallter


IntelliJ Ultimate 2018 - the manual way:

  1. Menu File -> Project Structure
  2. Right-click on your module and choose "Add..." -> Spring
  3. Optionally click "fix" if spring is not listed as a dependency
  4. Click the + icon at the top to add your spring configuration .xml file(s)

enter image description here

The automatic way:

  1. Click the body of the popup notification
  2. Click the "Create Default" option

enter image description here

like image 4
Marc Avatar answered Oct 18 '22 19:10

Marc