Generating JUnit HTML Reports
To generate JUnit HTML reports from maven builds we need to add the surefire plugin to generate the xml files and then the site and reporting plugins to create the html report.
Using Both JUnit 4 and Junit 5
I prefer to use either JUnit 4 or JUnit 5, but there may be moments when we want to use both. We can do that with JUnit 5 dependencies.
How to fix Java Language Level Issues
When using other people’s source code you might discover that you receive errors about java soure levels. These are easily fixed.
How to organise resource files for tests using Maven and Java
Resources are a very useful concept in Java. They are essentially files in the project which are compiled into the .jar
Java also has commands for finding them .getResource and reading them .getResourceAsStream
Very Handy.
But, they can be hard to wrap your head around. As evidenced by my own experiences trying to use them and the number of queries on stack overflow.
Simple ways to add and work with a `.jar` file in your local maven setup
TL;DR Hack - add as a library in IntelliJ project. Tactic - add as system scope in maven. Tactic/Strategic - install locally to .m2. Strategic - use a repository management tool, publish to maven central

Sometimes you want to work with a jar file that isn’t hosted in maven central.
It might be a 3rd party jar, it might be one that you have written.
Regardless.
You have a lot of options for this. The approaches that I have used:
- add
.jarfiles as an IntelliJ project dependency - install it locally to your
.m2repository - add it to your project as a system scoped file
- use a repository management tool: like Nexus or Archiva
- publish the dependency to maven central
How to create and release a jar to maven central
TLDR; The instructions on apache and sonatype site are pretty good to help get library released to maven central. But you’ll need to learn about pgp signing and might need more rigour in your pom file. A fairly painless learning process that I recommend you go through and release something to the world.
What is a Java `main` method - simple example
An explanation of the Java Main method, and why we don’t really need it when automating.
Do "Enable Auto-Import" in IntelliJ for "Maven projects need to be imported"
If you see the “Maven projects need to be imported” popup in IntelliJ, then do click “Enable Auto-Import”.
Maven Troubleshooting FAQs and Tips
We use Maven in the Java For Testers book.
Once you have Maven running it tends to work fine. You mainly experience problems when you initially install it, at the point when you know how to nothing with Maven.


