0

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.

KyleM
  • 4,445
  • 9
  • 46
  • 78

2 Answers2

0

I found this walkthrough on how to bring spring projects into eclipse via gradle. It actually looks like it was based on Spring Security which might create a nice process flow for you.

My guess is, eclipse is not defaulting to use the gradle configuration for its dependency management.

TheNorthWes
  • 2,661
  • 19
  • 35
  • I'm using "Buildship" when importing the project. I should have explicitly said so in my question, but that's the 'Import Gradle Project' screenshot. If you walk through the steps I posted you'll see what I mean (if you have time). Thanks for the suggestion though - I will try with your tool when I get home. I'm using Buildship because it's the recommended tool by STS. I also tried the legacy Gradle import tool in STS - it doesn't work either. – KyleM May 02 '16 at 22:39
  • Hmm interesting. Building fails i assume? Perhaps it hasn't pulled a dependency quite yet... – TheNorthWes May 02 '16 at 22:41
  • Building/compiling succeed. The .gradle scripts obviously work because compilation succeeds. It's only Eclipse showing an error due to some validation problem.... – KyleM May 02 '16 at 23:43
0

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!!!

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
  • Yes, I removed the groovy nature on "spring-security-aspects-4.1.x" and on "spring-security-samples-javaconfig-aspectj-4.1.x". No errors are shown now. I understand that it may take time to get different environments working, but it would help to put these instructions somewhere that contributors will find them. Thanks for the assistance! – KyleM May 04 '16 at 05:34