Wednesday, April 25, 2018

Maven exception "Fatal error compiling: invalid target release:..."

>PROBLEM
When running "mvn clean install" you get:
  Fatal error compiling: invalid target release:


>SOLUTION
Set JAVA_HOME envvar or include it into the script which runs maven.
  export JAVA_HOME="/home/portables_d/jdk1.8.0_144"

>ENV
linux/debian

Maven fails to load spring references



>PROBLEM
Maven fails to load spring references

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from http://maven.repository.redhat.com/ga/ was cached in the local repository, resolution will not be reattempted until the update 
 interval of redhat-ga-repository has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to redhat-ga-repository (http://
 maven.repository.redhat.com/ga/): maven.repository.redhat.com





>SOLUTION
Check the repository location into ".m2\settings.xml".

For instance:
C:\Users\YourLogin\.m2\settings.xml

In this case the localRepository was configured with linux's location and not windows as it was supposed to be:

***WRONG:
/home/portables_d/mvnlibs

+++RIGHT:
${env.LOCAL}\portables_d\mvnlibs



>ENV
windows
eclipse
java8

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...