{"id":3930,"date":"2018-08-27T07:34:31","date_gmt":"2018-08-27T07:34:31","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=3930"},"modified":"2025-06-21T10:00:31","modified_gmt":"2025-06-21T10:00:31","slug":"how-to-fix-source-option-5-is-no-longer-supported-use-7-or-later","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/how-to-fix-source-option-5-is-no-longer-supported-use-7-or-later\/","title":{"rendered":"How to fix Source option 5 is no longer supported. Use 7 or later"},"content":{"rendered":"<h1>How to fix Source option 5 is no longer supported.<\/h1>\n<p>When we create Maven projects using artifacts and try to run them, we sometimes get the following error: <strong>Source option 5 is no longer supported. Use 7 or later<\/strong>. In this post, we will see the steps involved in fixing the error in the Maven project.<\/p>\n<p>The error (Source option 5 is no longer supported) is common when we create a Maven project from the old archetypes. In this case, we need to specify the source and target version to the Maven compiler. We can specify these properties in the Maven <em><strong>pom.xml<\/strong> <\/em>file.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.testingdocs.com\/maven-project-from-archetype\/\">https:\/\/www.testingdocs.com\/maven-project-from-archetype\/<\/a><\/li>\n<\/ul>\n<h2>Error<\/h2>\n<p>Sample error trace:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">[ERROR] COMPILATION ERROR : \r\n[INFO] -------------------------------------------------------------\r\n[ERROR] Source option 5 is no longer supported. Use 7 or later.\r\n[ERROR] Target option 5 is no longer supported. Use 7 or later.\r\n[INFO] 2 errors \r\n[INFO] -------------------------------------------------------------\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] BUILD FAILURE\r\n[INFO] ------------------------------------------------------------------------\r\n[INFO] Total time:  3.025 s\r\n------------------------------------------------------------------------\r\n[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:\r\n3.1:testCompile (default-testCompile) on project AppiumProject: \r\nCompilation failure: Compilation failure: \r\n[ERROR] Source option 5 is no longer supported. Use 7 or later.\r\n[ERROR] Target option 5 is no longer supported. Use 7 or later.<\/pre>\n<p>&nbsp;<\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3935\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Source-option-5-is-no-longer-supported.png\" alt=\"Source option 5 is no longer supported\" width=\"1730\" height=\"1007\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Source-option-5-is-no-longer-supported.png 1730w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Source-option-5-is-no-longer-supported-300x175.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Source-option-5-is-no-longer-supported-1024x596.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Source-option-5-is-no-longer-supported-768x447.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Source-option-5-is-no-longer-supported-1536x894.png 1536w\" sizes=\"auto, (max-width: 1730px) 100vw, 1730px\" \/><\/h3>\n<h3><\/h3>\n<h2>Fix<\/h2>\n<p>The fix for the problem is to use the latest Java environment for the project: JDK 7 or Later version.<\/p>\n<p>Identify the JDK version installed on your machine or the IDE workspace&#8217;s version. Update the project build path with the latest library settings.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6209\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/1.5-Java-Compiler.png\" alt=\"1.5 Java Compiler\" width=\"1718\" height=\"1023\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/1.5-Java-Compiler.png 1718w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/1.5-Java-Compiler-300x179.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/1.5-Java-Compiler-1024x610.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/1.5-Java-Compiler-768x457.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/1.5-Java-Compiler-1536x915.png 1536w\" sizes=\"auto, (max-width: 1718px) 100vw, 1718px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Right-click <strong><em>Project properties &gt;&gt; Java Compiler<\/em><\/strong>.<\/p>\n<p>Change the JDK compliance parameters from 1.5 -&gt; 1.7 or above.<\/p>\n<p>Click on the <strong><em>Execution Environments<\/em><\/strong> link and select the latest or suitable JDK above JDK 1.7<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3938\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Java-Execution-Environments.png\" alt=\"Java Execution Environments\" width=\"1797\" height=\"1023\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Java-Execution-Environments.png 1797w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Java-Execution-Environments-300x171.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Java-Execution-Environments-1024x583.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Java-Execution-Environments-768x437.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Java-Execution-Environments-1536x874.png 1536w\" sizes=\"auto, (max-width: 1797px) 100vw, 1797px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Click on the <strong><em>Apply and Close<\/em><\/strong> button.<\/p>\n<h3>Maven POM.xml<\/h3>\n<p>Follow the below steps to avoid this error in the Maven project,<\/p>\n<ul>\n<li>Check the Java compiler version. (Project-specific settings)<\/li>\n<li>Workspace settings. (Configure Workspace settings)<\/li>\n<li>Project build path.<\/li>\n<li>Maven <em>POM.xml<\/em> build file.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3941\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Jenkins-Error-Source-and-Target.png\" alt=\"Jenkins Error Source and Target\" width=\"1920\" height=\"872\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Jenkins-Error-Source-and-Target.png 1920w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Jenkins-Error-Source-and-Target-300x136.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Jenkins-Error-Source-and-Target-1024x465.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Jenkins-Error-Source-and-Target-768x349.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Jenkins-Error-Source-and-Target-1536x698.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Examples<\/h3>\n<p>For example, to specify JDK 8 we can add the properties like the below to the POM.xml file:<\/p>\n<pre class=\"default prettyprint prettyprinted\"><code class=\"\" data-line=\"\">&lt;span class=&quot;tag&quot;&gt;&lt;properties&gt;&lt;\/span&gt;\n    &lt;span class=&quot;tag&quot;&gt;&lt;maven.compiler.source&gt;&lt;\/span&gt;&lt;span class=&quot;pln&quot;&gt;1.8&lt;\/span&gt;&lt;span class=&quot;tag&quot;&gt;&lt;\/maven.compiler.source&gt;&lt;\/span&gt;\n    &lt;span class=&quot;tag&quot;&gt;&lt;maven.compiler.target&gt;&lt;\/span&gt;&lt;span class=&quot;pln&quot;&gt;1.8&lt;\/span&gt;&lt;span class=&quot;tag&quot;&gt;&lt;\/maven.compiler.target&gt;&lt;\/span&gt;\n&lt;span class=&quot;tag&quot;&gt;&lt;\/properties&gt;&lt;\/span&gt;<\/code><\/pre>\n<h3><\/h3>\n<h3>JDK 14<\/h3>\n<p>Change the Ja<em>va compiler and the project build path. After the changes specify the JDK version in the POM.xml<\/em> Maven build file.<\/p>\n<p>For example, specify the JDK 14 to the Maven pom.xml.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6188\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/source-option-5-is-no-longer-supported-1.png\" alt=\"source option 5 is no longer supported\" width=\"1502\" height=\"874\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/source-option-5-is-no-longer-supported-1.png 1502w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/source-option-5-is-no-longer-supported-1-300x175.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/source-option-5-is-no-longer-supported-1-1024x596.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/source-option-5-is-no-longer-supported-1-768x447.png 768w\" sizes=\"auto, (max-width: 1502px) 100vw, 1502px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>Sample pom.xml\u00a0 file <\/strong><\/h2>\n<p>Sample pom.xml file with JDK 14 version<\/p>\n<p>&nbsp;<\/p>\n<pre>&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" \r\nxmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \r\nxsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 \r\nhttps:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n&lt;groupId&gt;com.testingdocs&lt;\/groupId&gt;\r\n&lt;artifactId&gt;TestNGTutorials&lt;\/artifactId&gt;\r\n&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n&lt;properties&gt;\r\n   &lt;maven.compiler.source&gt;14&lt;\/maven.compiler.source&gt;\r\n   &lt;maven.compiler.target&gt;14&lt;\/maven.compiler.target&gt;\r\n&lt;\/properties&gt;\r\n&lt;dependencies&gt;\r\n&lt;dependency&gt;\r\n   &lt;groupId&gt;org.seleniumhq.selenium&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;selenium-java&lt;\/artifactId&gt;\r\n   &lt;version&gt;4.0.0-alpha-7&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n&lt;dependency&gt;\r\n   &lt;groupId&gt;org.seleniumhq.selenium&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;selenium-firefox-driver&lt;\/artifactId&gt;\r\n   &lt;version&gt;4.0.0-alpha-7&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n&lt;dependency&gt;\r\n   &lt;groupId&gt;org.seleniumhq.selenium&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;selenium-edge-driver&lt;\/artifactId&gt;\r\n   &lt;version&gt;4.0.0-alpha-7&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n&lt;dependency&gt;\r\n   &lt;groupId&gt;org.testng&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;testng&lt;\/artifactId&gt;\r\n   &lt;version&gt;6.8&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n&lt;\/dependencies&gt;\r\n&lt;build&gt;\r\n&lt;pluginManagement&gt;\r\n&lt;plugins&gt;\r\n&lt;plugin&gt;\r\n   &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\r\n   &lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\r\n   &lt;version&gt;3.0.0-M5&lt;\/version&gt;\r\n&lt;\/plugin&gt;\r\n&lt;\/plugins&gt;\r\n&lt;\/pluginManagement&gt;\r\n&lt;\/build&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>Verify the fix<\/h2>\n<p>Run the Maven project. The error should be fixed now.<\/p>\n<p>After changing the settings and adding the properties information to the <em>pom.xml<\/em> file. Verify by running the project. In Eclipse IDE, to build the project, choose the following option<\/p>\n<p><em>Run As &gt;&gt; Maven Build<\/em><\/p>\n<p>That&#8217;s it.<\/p>\n<p>&nbsp;<\/p>\n<h2>Maven Tutorial<\/h2>\n<p>Maven tutorial on this website:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.testingdocs.com\/apache-maven-tutorial\/\">https:\/\/www.testingdocs.com\/apache-maven-tutorial\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>How to fix Source option 5 is no longer supported :  When we create Maven projects using artifacts and try to run them, we sometimes get the following error: Source option 5<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[242],"class_list":["post-3930","post","type-post","status-publish","format-standard","hentry","category-java","tag-most-visited","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/3930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=3930"}],"version-history":[{"count":30,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/3930\/revisions"}],"predecessor-version":[{"id":27608,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/3930\/revisions\/27608"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=3930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=3930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=3930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}