Just Enough Maven

Any suggestions on getting from zero to using Maven enough to build VASSAL? YouTube videos?

Look at this, note the order in which these phases run: maven.apache.org/guides/introdu … -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

Yeah run through the git setup in the wiki first if you haven’t: vassalengine.org/wiki/Using_Git

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.