<groupId>com.mycompany</groupId> <artifactId>myproject</artifactId> <version>0.0.1-SNAPSHOT</version> <modules> <module>model</module> <module>service</module> <module>web-servlet</module> </modules>
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
<dependencyManagement> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1-b01</version> </dependency> </dependencies> </dependencyManagement>
<packaging>war</packaging> <parent> <groupId>com.mycompany</groupId> <artifactId>myproject</artifactId> <version>0.0.1-SNAPSHOT</version> </parent>
<dependencies> <dependency> <groupId>com.mycompany</groupId> <artifactId>service</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> </dependency>
Maven-> build
IDE. I note that for Tomcat 6 and 7, the url lines will be different: <build> <finalName>project</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <version>1.1</version> <configuration> <url>http://localhost:8080/manager/html</url><!-- Tomcat 7 !--> <!--<url>http://localhost:8080/manager</url>!--><!-- Tomcat 6 !--> <server>tomcatServer</server> <path>/project</path> </configuration> </plugin> </plugins> </build>
IDE-> Maven-> User Settings-> Update Settings
. Actually settings.xml: <settings> <servers> <server> <id>tomcatServer</id> <username>admin</username> <password>password</password> </server> </servers> </settings>
<tomcat-users> <role rolename="manager"/> <role rolename="manager-gui"/> <role rolename="admin"/> <user username="admin" password="password" roles="admin,manager,manager-gui"/> </tomcat-users>
Server Location-> Use Tomcat installation
.-> Run As-> Maven build
life cycle for the module: -> Run As-> Maven build
. In line Goals add tomcat: redeploy, run. So, the module crashed on localhost: 8080 / project /. All dance and sing. In Eclipse, it is very convenient to do another deployment on Shift+Atl+X, M
Source: https://habr.com/ru/post/148841/
All Articles