TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Apache Maven

    Specify Java version in a Maven Project.

    Maven

    Introduction

    In this post, we will learn how to specify the Java version in the Maven pom.xml file. This is very useful when you are upgrading the Maven project to higher version of Java. Fixing errors during building Maven project. Example of one such error shown.

    Sample Error

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Sample: Compilation failure: Compilation failure:

    [ERROR] Source option 5 is no longer supported. Use 7 or later.

    [ERROR] Target option 5 is no longer supported. Use 7 or later.

    Specifying Java version in POM

    Configure the Maven compiler plugin in the POM.xml

    <plugins>
     <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-compiler-plugin</artifactId>
     <version>3.8.1</version>
     <configuration>
     <source>1.8</source>
     <target>1.8</target>
     </configuration>
     </plugin>
    </plugins>

    Screenshot:

    Source Target Version Java

     

    We can cross check the settings in the Project settings window >> Java Compiler setting.

     

     

    Maven Tutorials on this website can be found at:
    https://www.testingdocs.com/apache-maven-tutorial/

    For more details on the Apache Maven, visit the official website at:
    https://maven.apache.org/

    Related Posts

    Maven Download Verification Win11

    Apache Maven /

    Download Maven on Windows 11

    Invalid Target Java Error

    Apache Maven /

    Fix Fatal Error compiling: Invalid target release in Maven Project

    Maven Project from archetype

    Apache Maven /

    Create Maven Project from Archetype in NetBeans

    Create New Project

    Apache Maven /

    Create a Maven Project skip archetype

    Maven Download Button

    Apache Maven /

    Install Maven on Ubuntu Linux

    ‹ Maven dependency management in Eclipse› Create Quickstart Maven Project in Eclipse IDE

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com