Skip to content

Executing MongoDB Example

Suren Konathala edited this page Aug 2, 2018 · 1 revision

Maven let's us run/execute a single Java class from within a web application or a project on the command line. The command structure is like mvn exec:java -Dexec.mainClass="mainclass"

For example, JAQStack core has an example java class file /jaqstack/core/src/main/java/com/jaqstack/data/MongoExample.java to demonstrate the connection to a MongoDB server. And to test this class file, do the following:

  1. Compile the entire project using mvn clean package

screen shot 2018-08-02 at 3 04 44 pm

  1. Run this command mvn exec:java -Dexec.mainClass="com.jaqstack.data.MongoExample"

screen shot 2018-08-02 at 3 08 15 pm

Clone this wiki locally