Run JUnit from makefile (java.lang.NoClassDefFoundError) -
i've got junit project want add in toolchain. toolchain using makefile. makefile not in prject directory. tryied put "test" rules in makefile following :
projpath=testjunit/test/ package=com/project/package/name/ lib=$(projpath)lib/ src=$(projpath)src/$(package) bin=$(projpath)bin/$(package) --------- acces lib.jar , .class used during test ------ classpath=.:$(lib)junit.jar:$(lib)opal-library.jar:$(src):$(bin) --------- name of test in order of wanted excecution ------------- javasrc= test1\ test2\ test3\ test: java -classpath $(junitpath) org.junit.runner.junitcore $(javasrc)
when try launch 'make test'
i've got following message:
junit version 4.11 exception in thread "main" java.lang.noclassdeffounderror: test1 (wrong name: com/project/name/test1)
i try possible launch java command in project directory nothing work. .class , .java respectivly in bin , src directorys.
ok guys fond problem. it's seems class path not bad way of calling test wrong. add /src , /bin in classpath (without sub package directory) , concat package name test class name test succesfully launched.
something that:
projpath=testjunit/test/ package=com.project.package.name. lib=$(projpath)lib/ src=$(projpath)src/ bin=$(projpath)bin/ --------- acces lib.jar , .class used during test ------ classpath=.:$(lib)junit.jar:$(lib)opal-library.jar:$(src):$(bin) --------- name of test in order of wanted excecution ------------- javasrc= $(package)test1\ $(package)test2\ $(package)test3\ test: java -classpath $(junitpath) org.junit.runner.junitcore $(javasrc)
Comments
Post a Comment