Page 1 of 1

Just Enough Maven

PostPosted: July 30th, 2020, 2:49 pm
by tinjaw
Any suggestions on getting from zero to using Maven enough to build VASSAL? YouTube videos?

Re: Just Enough Maven

PostPosted: July 30th, 2020, 5:32 pm
by Flint1b
Look at this, note the order in which these phases run: ... -of-phases

Then play around with the project:
- clean phase deletes all build-time artifacts (bytecode-compiled code etc)
- validate phase is where we run the checkstyle plugin to check code formatting
- compile phase is where we compile "src/main/"
- test is where we compile and run "src/test"
- package is where the .jar gets built and saved under target/
- verify.. I think we don't do anything during that phase
- install is where the .jar, source-jar and javadoc-jar gets copied into the local maven repository

As a contributor you only really need the phases up to "test" or rarely "package". If you edit code and do a PR, you do a "mvnw clean test" locally, this ensures your code compiles, checkstyle formatting rules are not violated, and unit tests are green.

Also important are these directories:
- src/main/java is where the main java code is which is shipped to the user
- src/main/resources is where resources are e.g. translations, i.e. non-java code that is shipped to the user
- src/test/java & src/test/resources - same as above but for test code, this is not shipped to the user later
- target/ this is where maven puts everything it creates, compiled .class files, resources are copied into this, the .jar is created here, various intermediary files, reports etc, target/ is never committed to git

Re: Just Enough Maven

PostPosted: July 30th, 2020, 6:35 pm
by Cattlesquat
Yeah run through the git setup in the wiki first if you haven't:

After that you'll really just need the "./mvnw clean test" command as far as Maven goes, at least in terms of your "minimal getting started" desire.