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

    Create a Simple Web application with Maven

    Introduction

    In this post, we will create a simple web application with Maven and IntelliJ IDEA. You can create a java web application using maven-archetype-webapp plugin. We can create using IDE tools as well as command-line console.

    Steps to create:

    Click Create New Project on the Welcome screen

    or

    Select File >> New >> Project.

    You can select Maven tool and check the box create from the archetype

    Select maven-archetype-webapp

     

    Maven Archetype Webapp

    Click on the Next button.

    Project details

    Enter groupid, artifactid and version details for the project and click on the Next button.

     

    Maven Project Web Application

     

    Optionally, you can also override the maven local and settings file configuration with custom ones.

     

    Maven Settings

    In the next step, enter Project details like project name and location.

    Click on the Finish button.

    Once you hit on the finish button, the IDE would automatically create and build the project for you and download the dependencies. You can start adding functionality and web-pages on top of it.

     

    Simple Web application IntelliJ IDEA Maven

    POM.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.testingdocs.demo.webapp</groupId>
     <artifactId>simple-webapp</artifactId>
     <packaging>war</packaging>
     <version>1.0-SNAPSHOT</version>
     <name>simple-webapp Maven Webapp</name>
     <url>http://maven.apache.org</url>
     <dependencies>
     <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.12</version>
     <scope>test</scope>
     </dependency>
     </dependencies>
     <build>
     <finalName>simple-webapp</finalName>
     </build>
    </project>

     

    Build, Deploy and Run

    Once you are done with the step, execute maven goals under life cycle

    View >> Tool Windows >> Maven Projects

    Execute clean, compile, verify, and package goals.

    Copy the war file created under the target folder and deploy it on the server.

    Visit the URL: http://<<server>>:<<port>>/simple-webapp/

     

    Simple Web application

    Using Command Line:

     

    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 Build Lifecycle› Maven Integration plugin for 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