3

I want to compile sources from different directories.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <includes>
                    <include>src/main/java/**/*.java</include>
                    <include>generated-sources</include>
                </includes>
                <source>1.6</source>
            </configuration>
        </plugin>

Each time when I'm trying to build I get errors on test classes:

[INFO] [compiler:testCompile {execution: default-testCompile}]

[ERROR] /home/user/project/src/test/java/com/company/model/hub/ToplogyFileUtilsTest.java:[8,45] error: package com.company.model.logic.hub does not exist

[ERROR] /home/user/project/src/test/java/com/company/model/entity/cfg/dto/OidDTOTest.java:[11,43] error: package com.company.model.dto.cfg does not exist

[ERROR] /home/user/project/src/test/java/com/company/model/fault/EventTest.java:[12,48] error: package com.company.model.entity.fault does not exist
...
Ion C
  • 213
  • 3
  • 13
  • 24
  • Did U started from working example ? – SkorpEN Dec 18 '14 at 11:09
  • @SkorpEN Yes, it worked before I added tag – Ion C Dec 18 '14 at 11:10
  • 1
    possible duplicate of [Maven compile with multiple src directories](http://stackoverflow.com/questions/270445/maven-compile-with-multiple-src-directories) – Joe Dec 18 '14 at 12:29
  • Why would you like to compile classes from a different folder? The problem i have is your configuration shows you are trying to define the existing defaults an other time cause `src/main/java/*`? Which does not really sense to me? The message says you are trying to reference classes which do not exist (`com.company.model.entity.fault`) Furthermore why are you using such an old maven version (2.2.X)... – khmarbaise Dec 25 '14 at 20:17

1 Answers1

0

You missed to add the sources of your test classes. Add it to the includes

<include>src/test/java/**/*.java</include>
shylynx
  • 597
  • 1
  • 7
  • 25