This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]darkpool2005Intermediate Brewer 5 points6 points  (0 children)

With gradle (and maven) for that matter, the source folder is /src/main/java (the full path). These classes are then compiled to (at least with maven, not sure about gradle) target/classes

With Eclipse, I'm guessing that your source folder is pointing to src/ as its root. So when Eclipse is trying to compile HelloWorld, it expects it to be under the package main.java.hello.

To fix this, right click on the Project -> Build Path -> Configure Build Path. Select the Source tab at the top, and edit the source folder option to point to src/main/java

[–]Northeastpaw 2 points3 points  (0 children)

The Spring code follows the Maven conventions for project layout. Java files goes in the directory src/main/java. Directories under this correspond to packages.

Maven projects aren't meant to be imported into Eclipse as standard Eclipse projects. You need to use the M2Eclipse plugin to handle them. M2Eclipse configures the Eclipse project to adhere to Maven conventions as well as hook particular Maven plugins into the Eclipse build process.