Results 1 to 2 of 2

Thread: Source folder confusion

  1. #1
    Join Date
    Apr 2010
    Posts
    104

    Default Source folder confusion

    Hi,

    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 …

    http://screencast.com/t/An2eytJDNZ

    Namely, the error "The declared package 'com.criticalmass.infinitiusa.tests' does not match the expected package 'test.java.com.criticalmass.infinitiusa.tests'" 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. #2
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,637

    Default

    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.

    HTH,
    Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •