How could I set up NetBeans and Maven so that:
For these tests, I have separate NetBeans projects that collect all the code necessary to run the tests. Because they are larger than usual "unit" tests, they don't use junit or such that NetBeans understands. To run the tests outside NetBeans, I basically run:
java -jar mytestframework.jar some other args TestClass1
where mytestframework.jar
is the same JAR for all test projects (defined in some separate project), and TestClass1
is the main class defining the tests in that particular project.
If I declare TestClass1
to be the "main class" in NetBeans, it meets all the requirements except that NetBeans will obviously run the main method in TestClass1
, and not in mytestframework.jar
. I cannot pick mytestframework.jar
interactively in NetBeans, but I can open nbactions.xml
and manually set the run and debug invocations to what they need to be. That's a lot of work, and hard to maintain, given that I have many such test projects.
Is there a better way? Some kind of custom NetBeans action invoking some kind of Maven plugin inherited from a shared parent pom, perhaps, or such?
Tools -> Options -> Java -> Maven -> Edit Global Custom Goal Definitions...
Here you can create actions available to all projects, eg. execute a jar using the exec:exec goal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.