Announcement Announcement Module
No announcement yet.
Source folder confusion Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Source folder confusion


    I'm using STS 2.6.0.SR1. I have a Java project, with a Maven directory structure. I have test files in my src/test/java directory. I added this folder as a source folder, but I'm still getting compilation errors

    Namely, the error "The declared package 'com.criticalmass.infinitiusa.tests' does not match the expected package ''" complaining about my package declaration. Everything runs fine from the command line (e.g. "mvn test").

    Can you tell me how to repair my setup so this compilation error goes away? - Dave

  • #2
    Hi Dave!

    Are you sure you have selected the correct folder as source folder? When I create a Maven project, I typically end up with two folders:
    - src/main/java
    - src/test/java

    I have these two folders declared as two separate source folders (via the project properties). Having done this, the package explorer shows me as the name of the source folders directly "src/test/java" and not just "java" as in your case. It looks like you created a new source folder as a link pointing to the real source folder. You don't need to create a new source folder for this, just select your existing folder "src/test/java" as source folder from the "java build path" settings in your project properties.