I get a BUILD FAILURE error with 'Unsupported major.minor version 52.0'

Symptoms

You may see the following error if you are using the Oracle Java SE Development Kit 7 with the latest version of the Atlassian Plugin SDK:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.102 s
[INFO] Finished at: 2016-09-30T14:50:03+10:00
[INFO] Final Memory: 18M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-jira-plugin:6.2.9-SNAPSHOT:compress-resources (default-compress-resources) on project myPlugin: Execution default-compress-resources of goal com.atlassian.maven.plugins:maven-jira-plugin:6.2.9-SNAPSHOT:compress-resources failed: Unable to load the mojo 'compress-resources' in the plugin 'com.atlassian.maven.plugins:maven-jira-plugin:6.2.9-SNAPSHOT' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com/atlassian/maven/plugins/jira/JiraCompressResourcesMojo : Unsupported major.minor version 52.0

The latest version of the Atlassian Plugin SDK requires Oracle Java SE Development Kit 8.  

How to confirm

You can check which version of JAVA you are using by entering the following command:

atlas-version

The output will look something like:

ATLAS Version:    6.2.9
ATLAS Home:       /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec
ATLAS Scripts:    /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/bin
ATLAS Maven Home: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1
AMPS Version:     6.2.6
--------
Executing: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1/bin/mvn --version -gs /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1/conf/settings.xml
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T04:37:52+10:00)
Maven home: /usr/local/Cellar/atlassian-plugin-sdk/6.2.4/libexec/apache-maven-3.2.1
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

Lines 10 and 11 in the above output show the Java version is 1.7.x rather than 1.8.x

How to fix it

Step 1. Install Oracle Java SE JDK 8

You can download the install files for the latest version on the Oracle website at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

Follow the instructions on the Oracle website to install Java for your system. 

Step 2. Set your JAVA_HOME variable

Windows 

The JAVA_HOME environment variable specifies the location of the JDK on your system. For Windows users, the default directory is C:\Program Files\Java\jdk1.8.x_y , where x_y is the Java JDK 8 version you have installedTo set JAVA_HOME:

  1. Browse to the C:\Program Files\Java\jdk1.8.x_y folder on your system and copy the path to the folder.
  2. Open Control Panel System>Advanced System Settings.
  3. On the Advanced tab click Environment Variables.
  4. Locate the System variables section and click New.
  5. Enter JAVA_HOME in the Variable name field and paste the folder path you copied into the Variable value field.
  6. Click OK to close the dialog.
  7. Click on Path variable in the System variables  section and click Edit
  8. Click New and type %JAVA_HOME%\bin in the available space.
  9. Close all dialog windows.
  10. Open a new  Command Prompt window, and run the following command:

    C:\Users\manthony>javac -version
    javac 1.8.0_91

     verify that your output is similar to what appears above.

Mac / Linux

The JAVA_HOME environment variable specifies the location of the JDK on your system. On Mac OS X, if you accepted the defaults when you installed the JDK, this is /Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home. On Linux, it may be /usr/local/jdk, or a similar location. You should add the JDK's bin directory to your PATH environment variable as well. This ensures your environment is configured and can locate the javac command.

To set your PATH and JAVA_HOME variables:

  1. Edit the .bashrc file in your home directory using your favourite editor (we use vi in this example).

    host:~ test$ vi ~/.bash_profile
  2. Add the following lines at the end of the file:

    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.0_91.jdk/Contents/Home
    export JAVA_HOME
    export PATH=$PATH:$JAVA_HOME/bin

    The path in Line 1 will be the path for the JDK on your system.

    For Mac OS X this is usually /Library/Java/JavaVirtualMachines/1.8.x.jdk. On Linux it may be /usr/local/jdk or similar.

  3. Save and close the file.
  4. Enter the following at the command line to pick up your changes:

    host:~ test$ source ~/.bash_profile
  5. Verify you are now seeing the correct result when you enter the command javac -version in terminal

    host:~ test$ javac -version
    javac 1.8.0_91 
Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport