Search code examples
spring-securityspring-tool-suitebuildship

Errors in Eclipse (Spring Tool Suite) in Spring Security


I'm attempting to become a contributor for Spring Security, it's not going so well. I am getting validation errors in Spring Tool Suite although the build/compilation of the .gradle project is succeeding. The errors show up in the "Markers" view in Eclipse. Here is what I've done so far.

  1. Forked the Spring Security master branch on Github
  2. Copied the https URL for my forked branch
  3. In Spring Tool Suite, Import->Git->Projects from Git->Clone URI
  4. After #3 Spring Tool Suite downloaded the project from Git
  5. Spring Tool Suite prompted asking me what type of project to create
  6. I selected "Import as a general project"
  7. I deleted the project from my workspace (but did not delete it on disk)

Spring Tool Suite prompt to delete project

  1. I imported the project using Import->Gradle->Gradle project and the recommended settings Buildship import in Spring Tool Suite

After everything finishes building, I get the following error in Spring Tool Suite:

Pointcut cannot be resolved to a type

The error is accompanied by several messages including the following:

  1. Pointcut cannot be resolved to a type
  2. The method aspectOf() is undefined for the type ...
  3. The method proceed() is undefined for the type ...

This error can be fixed (with an ugly hack) if I open the Eclipse .project file and add the following:

<buildSpec>
<buildCommand>
    <name>org.eclipse.ajdt.core.ajbuilder</name>
    <arguments>
    </arguments>
</buildCommand>
</buildSpec>
<natures>
    <nature>org.eclipse.ajdt.ui.ajnature</nature>
</natures>

Question

How can I properly set up my development environment? What should I look into for figuring out why I'm getting these errors? I'm currently researching how the gradle/maven configurations relate to the Eclipse .project file, but I have not gotten very far yet.


Solution

  • Here is what works for me (and what I discussed with Rob Winch):

    • download STS 3.7.2 (not the latest 3.7.3, it has a few issues when importing spring-security projects) from https://spring.io/tools/sts/all. There is a link to previous versions of STS. There you find STS 3.7.2.

    • install Groovy-Eclipse into that from here: http://dist.springsource.org/snapshot/GRECLIPSE/e4.5/

    • install the Gradle STS tooling from here: http://download.springsource.com/release/TOOLS/update/3.7.2.RELEASE/e4.5

    • after installing all the components mentioned above, import the spring-security projects using the STS Gradle support ("Import -> Gradle -> ...")

    • it might take a while, but after downloading the necessary artifacts, all those projects should appear in your workspace. The "aspects" one has an error marker on it. Right-click on the project, go to the Groovy context menu entry, and do the "remove Groovy nature" (or something like that). That removes the groovy tooling for that project and it compiles fine.

    After all those steps, I get a workspace with all those projects compiling fine. But it looks like we could/should simplify this procedure in the future using an Eclipse Oomph setup file maybe. But that is a story for the future.

    Hope this helps!!!