Hello,
i have problem with maven. When i try to compile test classes (mvn test-compile
), it fails to find the tested classes used in test classes. For example class UserTest
can't be compiled because compiler can't find class User
which is being used inside the UserTest
class. The problem is most likely in the class path not including target folder during test-compile
phase, which is weird because i thought maven does include it.
If anyone had any ideas how to fix this issue, i would be greatful.
The pom.xml file can be found here http://github.com/tomasherman/JBTBackup/blob/master/pom.xml, just like rest of the project.
The maven output is as follows:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building JBTBackup Maven Webapp
[INFO] task-segment: [test-compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[WARNING] While downloading hibernate:hibernate:3.0.5
This artifact has been relocated to org.hibernate:hibernate:3.0.5.
[INFO] [compiler:compile {execution: default-compile}]
[INFO] No sources to compile
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/arg/workspace/JBTBackup/src/test/resources
[INFO] [sql:execute {execution: add-test-data}]
[INFO] Executing file: /tmp/pre-test-editdb.1278025605sql
[INFO] 0 of 0 SQL statements executed successfully
[INFO] [compiler:testCompile {execution: default-testCompile}]
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /home/arg/workspace/JBTBackup/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[26,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[27,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[28,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[23,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[25,15] cannot find symbol
symbol : class BTFile
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[26,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[27,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[28,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[23,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
[ERROR] /home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[25,31] cannot find symbol
symbol : class BTFile
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
[INFO] 10 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[26,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[27,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[28,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[23,15] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[25,15] cannot find symbol
symbol : class BTFile
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[26,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[27,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/UserTest.java:[28,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.UserTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[23,29] cannot find symbol
symbol : class User
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
/home/arg/workspace/JBTBackup/src/test/java/org/tomasherman/JBTBackup/Resource/Entity/BTFileTest.java:[25,31] cannot find symbol
symbol : class BTFile
location: class org.tomasherman.JBTBackup.Resource.Entity.BTFileTest
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Thu Aug 26 12:54:37 CEST 2010
[INFO] Final Memory: 17M/172M
[INFO] ------------------------------------------------------------------------
Thanks for all comments, Tomas Herman