how to build and run an IDE Maven project

Asked

Viewed 193 times

0

Good afternoon,

I’m trying to generate an application for studies using Maven, but this disastrous and very frustrating.

I’m trying to create a web project using Maven, but I can’t do anything to make it run, however I’m trying to do everything for IDE, ta tried several web Servers and web containers, but none of them actually goes up the application.

I tried to configure the wildfly in a traditional way, so the project goes up normally, but when converting msm to Maven it stops running, the same happens if I create the project as a project Maven webapp.

I tried to add the wildfly plugin and later Jetty and in none of the cases I succeeded, when trying "Maven>update project" it does not even download the server, consequently it does not run it, the same happens with Jetty and it is clear if it keeps the error:

Description Resource Path Location Type The superclass "javax.servlet.http.Httpservlet" was not found on the Java Build Path

clearly due to lack of a web server or container Servlet

follow my 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>br.com.lsoft</groupId>
  <artifactId>gameapi</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>gameapi Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies> 

  <build>
    <finalName>gameapi</finalName>

    <plugins>
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>13.0.0.Final</version>
            <configuration>
                <port>8081</port>
            </configuration>
        </plugin>
    </plugins>

  </build>
</project>

That leaves me with a few simple questions:

whenever I go to work with Maven I am obliged to use cmd to compile and run the project? if it is not, because this was not demonstrated in the class in question, in this case it is already the suggestion to redo this class, or create one more for this course, teaching how to do it.

when analyzing the created "web.xml" I realized that the project was created with the default Servlet 2.3, how do I make the project to be created with a later version?? follows the web.xml

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
</web-app>
  • Calm down that every build tool is like this. It’s catastrophic at first. The important thing is to be resilient and focus on documentation and usage examples. By the error message, hints that you have created an application jsp and is trying to run it as a desktop. Read this tutorial from Oracle and see if it helps you: Building and Running a Java SE Application by Using Maven

1 answer

0

Good night.

I think the simplest option is to create the project through the Spring Boot start site, in case you mentioned using only MAVEN, https://start.spring.io/ after you download and import a Maven project by selecting the unzipped directory.

  • Hi Daniel, think creating a new project and migrate all the changes of the current project would be the best way?

  • Hello André, I mentioned creating a project from scratch because you mentioned that you are trying to create, so I passed the step by step that I use for test projects, but you can create one and compare the pom with yours and try to find the differences so you can adjust and find the possible fault.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.