Maven: No sources to compile
Are you try to compile project or class ? As the guideline in https://spring.io/guides/gs/maven/#scratch you need to compile for project.
Try to run mvn compile
from project direction.
In my case, I was missing this:
<project>
...
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
</build>
...
</project>
Normally, I'd just use the default directory structure
src/main/java
as asource folder
.src/test/java
as atest folder
.
But I'm working on a class project with existing code, and can't rearrange the file structure.
To create a maven-project you need
- A project-directory containing the
pom.xml
-file - Within this project-directory a subdirectory
src/main/java
containing your java-code (packages go to subdirectories ofsrc/main/java
)
To invoke maven run mvn compile
or something similar from the project-directory.
because there are no java files in $PROJECT_DIR/src/main/java