[英]How to add class files to a Maven2 project
So I'm working on a java project (an exitsing java project that uses maven2, not mine). 因此,我正在研究一个Java项目(使用maven2而不是我的现有的Java项目)。 Everything works fine. 一切正常。 I add a new class to the source directory. 我将新类添加到源目录。
I do mvn compile
and get success. 我做mvn compile
并获得成功。 I then do `mvn exec:java -Dexec.mainClass="package.NewClass" 然后我执行`mvn exec:java -Dexec.mainClass =“ package.NewClass”
and get classNotFoundException
. 并获取classNotFoundException
。
It does compile the new file, and I can see the NewClass.class in the right directory with the other classes. 它确实编译了新文件,并且我可以在其他目录的正确目录中看到NewClass.class。 So I don't get the classNotFoundException. 所以我没有得到classNotFoundException。 Do I need to make any changes to the pom.xml? 我是否需要对pom.xml进行任何更改?
Thanks!! 谢谢!!
Try 尝试
mvn exec:java -Dexec.mainClass="package.NewClass"
Resources : 资源:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.