Open MehrabRahman opened 4 years ago
This is basically directing the command to run the specific location so that you don't have to cd it to this specific location every time you run the code to save some time and effort.
Another way to do it is literally: cd src.com.github.MehrabRahman.App, then mvn compile, then exec java.
This essentially specifies which location is the main location of your project. When you specify this within the properties of your pom.xml file you can simply use mvn exec:java within the terminal and it will automatically execute this part of your program without any extra input.
Changing it would only mean that you would need to specify this location within your mvn command moving forward.
Example: mvn exec:java -Dexec.mainClass="class path"
You can replace this property by typing mvn compile or mvn exec:java with or without arguments.
Specifies the main location of the project so you don't have to cd to it and can be executed with mvn exec:java in target location.
point the mvn to the main class to execute. I think we can just use mvn test here but not too sure.
Alternate ways: mvn compile then mvn exec:java -Dexec.mainClass="com.github.MehrabRahman.App"
This line of code tells maven what the main class of your project is, so when you use the exec:java command it knows which class to run. Changing the line would change where maven tries to execute your code.
Instead of putting that line in the pom.xml, you can type -Dexec.mainClass="com.github.MehrabRahman.App"
when running the program to tell maven where the main class is. The whole command would look like:
mvn exec:java -Dexec.mainClass="com.github.MehrabRahman.App"
Basically, it tells Maven which class to execute when invoked. This tag can be configured inside the pom.xml either inside the plugins or inside the parameter sections. Another way of using it is through the command-line arguments (mvn exec:java -Dexec.mainClass="..." -Dexec.args="..."). Together with the "mainClass" argument, Maven also provides a way of passing arguments to the invoked class. Again, either through the pom.xml file, or, in the command-line (-Dexec.args="...").
This line tells Maven what file to look for the main method in/which file to run during execution. Changing it would point Maven to a different file to look for the main method in/run during execution.
https://github.com/200803-java-devops/http-server/blob/4dbbddbe2df1fd298902532af196afabd4580dfd/pom.xml#L17
What does this line do? How is it used by Maven, and what would changing it mean?
Bonus (3 points): What are some ways we can replace this property with a command line argument or plugin configuration?