Search code examples
javaeclipsespring-tool-suitests-springsourcetoolsuitespring-nature

Enable Spring Project Nature in STS 4 to fix XML Schema problems


I'm trying to apply the solutions (proper XML schema resolution) mentioned here which requires me to enable Spring project nature in an existing project in STS 4. According to this, there would be a Spring Tools context menu on which one can do “Spring Tools -> Add Spring Project Nature”. I'm not seeing that menu:

enter image description here

enter image description here

My .project file has the following already:

<natures>
        <nature>org.springframework.ide.eclipse.core.springnature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    </natures>

What am I missing?

Update:

As per Martin's second comment, the following works:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-5.0.xsd
       http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
       http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">

Solution

  • The Spring Nature feature that you are referring to doesn't exist anymore in the STS4 public beta that you seem to use. Therefore there is no "Spring" section in the context-menu anymore that offers the Spring Nature. It is not simply not needed anymore in STS4.

    The question here is: What exactly are you trying to do in STS4 that doesn't work? If something is strange and missing in STS4 that you would like to see it getting back from STS3, you should raise an issue at https://github.com/spring-projects/sts4/issues and attach a sample project that reproduces the underlying issue. I would be happy to take a more detailed look then.

    As a workaround, you can go back and download the latest STS 3.9.2 distribution and work from there, it still has all the old features included.