Troubleshooting

This is a troubleshoot guide for working on / building the AndHow project itself. If you need help with using AndHow in an application and your issue is not addressed in the User Guide, post a question in the User Forum or open an Issue/Bug on the project.

General Build Advice

AndHow is known to compile with JDK 8 - 16 and current Maven versions (see the Workstation setup page for details). However, to remove all other possibilities, try building with JDK 1.8 via maven from command line:

mvn --version #should report Maven 3.8+ and JDK 1.8.x
mvn clean test

If that works, the issue is with the IDE setup.

AndHow's pom.xml files specify the source and target to be 1.8, but there are some profiles that activate for other JDKs - a possible source of issues. Setting your IDE to use JDK 1.8 may solve a build issue. Travis and AppVeyor builds happen automatically to ensure that builds do work on other JDKs in a clean environment, so if there is a real issue, the CI will catch it.

Issues with IntelliJ

IntelliJ is great, but it really does not do well with Maven based projects. If you are getting weird javac errors, here are some things to try.

  • In Preferences | Build, Execution, Deployment | Compiler | Java Compiler

    • Ensure the selected compiler is javac

    • Ensure the Use ''--relase' option is not selected. In theory this setting would help fix compile issues, but it may be causing issues for AndHow. See Issue 630.

    • Verify that no special settings are listed for any over the AndHow modules (two places on the page)

  • In File | Project Structure | Project

    • Verify the Project SKD and language level is set to 1.8 / 8

  • In File | Project Structure | Modules

    • Ensure each module is set to language level 8 I think IntelliJ tries to guess what the source and target versions are from the pom and gets it wrong because the annotation-processor modules have some profile logic to determine this.

IntelliJ will also make a guess as to what the source and target Java values are for the project and write them into the pom files - especially the 'stubs' module for some reason. If that happens, undo the change and check all the settings listed in the bullet points above.

If all else fails with IntelliJ, it helps to just check the project out fresh and reload it in IntelliJ. This drops all existing preferences for the the project and often fixes things.

Issues running the andhow-samples project locally from locally compiled AndHow

If you are developing AndHow, making local builds and then trying to run the samples project from a snapshot of that build, problems can happen if the JDK used to build AndHow is newer than the JDK used to build the samples. The safest is to build AndHow with JDK 8, then any JDK can be used to build and run the samples. Otherwise, the JDK used to build AndHow must be the same version or older as the JDK used to build the samples.

Last updated