Answer the question
In order to leave comments, you need to log in
How to run tomcat-plugin in a multi-module project (using Eclipse)?
Faced a problem with running Tomcat in a multi-module Eclipse project. There are three submodules in my project: api, db, impl. The api has classes (interfaces in my case) that are needed in the impl module. I specified in the parent module groupId, artefaktId, version - api. Then I specified this data in the impl submodule. The IDE saw these interfaces in the impl module (i.e. it doesn't swear or underline when implements them). But when I deploy impl (I run it in the built-in tomcat8.5 in Eclipse), I get an error about the lack of interface data from under the api module. How to configure maven to copy (pull) these interfaces and paste them into tomcat? (on the Internet it is only indicated how to add to dependancy pom.xml)
Or how can you run tomcat-plugin so that it picks up classes from another submodule? (Oh yes, my project uses Spring WEB, Spring DATA, Dynamic Web Module - 3.1 - all settings are through annotations, there is no web.xml)
And then it (tomcat7-maven-plugin) starts, but does not respond to requests and errors doesn't even show up!
Here is the pom.xml under the impl module:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<url>http://maven.apache.org</url>
<artifactId>i-impl</artifactId>
<name>java_courses_tlt-impl</name>
<parent>
<groupId>com.potemkin</groupId>
<artifactId>i</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-runner -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.liquibase/liquibase-core -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Мои зависимости -->
<dependency>
<groupId>com.potemkin</groupId>
<artifactId>i-api</artifactId>
</dependency>
</dependencies>
<build>
<finalName>java_courses_tlt-impl</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<path>/java_courses_tlt-impl</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.7.6</version>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<type>embededded</type>
</container>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.tomcat.manager.url>http://localhost:8080</cargo.tomcat.manager.url>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>com.potemkin</groupId>
<artifactId>i-impl</artifactId>
<type>war</type>
<properties>
<context>/</context>
</properties>
</deployable>
</deployables>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Answer the question
In order to leave comments, you need to log in
THROUGH Tomcat7-plugin it was not possible to start. But my dependencies were seen by full-fledged Tomcat9, in the project I used the dynamic web module 3.1. Settings via Spring Annotations. Multi modular project. The installation of tomcat took place according to this video: https://youtu.be/QWLjhk6LeSQ
And then deployed manually. Not very comfortable. I wonder if there is a way to link a full-fledged Tomcat9 with Eclipse so that the project can be launched from the IDE. (I tried to install the tomcat 9 module on Eclipse, it also does not see my dependency from another sub-module, it only sees a full-fledged one).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question