-1

I am using intellij.

The way I am creating project is "File -> New -> Project -> JavaEnterprise -> Web Application (Select Server)"

I want to know how to set it up with Maven.

I need JSP, Servlet, TOMCA, MySQL

3 Answers3

1

In intelliJ, select maven from new project. Then check, "create from archetype". Select "archetype-maven-webapp"

After the project is created, add

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>5.1.38</version>
</dependency>

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.5</version>
</dependency>

in the pom file. Wait till it loads. Hope this helps.

Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87
0

You should learn about maven archetypes.

Alexandre Cartapanis
  • 1,513
  • 3
  • 15
  • 19
  • can you please give me a sample of required archetypes. – Miguel Ángel Aug 20 '16 at 05:52
  • You can use the command line ``mvn archetype:generate``. This is normally used to create a new project from an archetype, but it will list availables archetypes if you do not specify one. Please note that i'm not sure you will find a "servlet+tomcat+mysql" archetype, i think the "archetype-maven-webapp" archetype will be ok for start – Alexandre Cartapanis Aug 22 '16 at 08:21
0

Maven has concept of archetypes.

From the list of available archetypes you could potentially use spring-boot-sample-web-jsp-archetype. It will create Spring Boot application (by default based on Tomcat). It should also suit for development of servlets.

Unfortunately concerning MySQL dependency you need to provide it manually or check what is generated by other archetypes.

Marek J
  • 1,364
  • 8
  • 18
  • 33