我想要在工具链中添加一个JUnit项目。这个工具链使用Makefile。 Makefile不在我的prject目录中。 所以我试着做一个"测试"此makefile中的规则如下:
PROJPATH=TestJUnit/Test/
PACKAGE=com/project/package/name/
LIB=$(PROJPATH)lib/
SRC=$(PROJPATH)src/$(PACKAGE)
BIN=$(PROJPATH)bin/$(PACKAGE)
--------- All the acces to lib.jar and .class used during the 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)
当我尝试启动' make test'
我收到了以下消息:
JUnit version 4.11
Exception in thread "main" java.lang.NoClassDefFoundError: Test1 (wrong name: com/project/name/Test1)
我尽可能尝试在我的项目目录中启动java命令,但没有任何效果。 所有.class和.java分别位于bin和src directorys中。
答案 0 :(得分:0)
类似的东西:
PROJPATH=TestJUnit/Test/
PACKAGE=com.project.package.name.
LIB=$(PROJPATH)lib/
SRC=$(PROJPATH)src/
BIN=$(PROJPATH)bin/
--------- All the acces to lib.jar and .class used during the 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)