Maven modifies the implementation of the tomcat run version and port

  • 2020-11-20 06:20:13
  • OfStack

By default, maven runs with tomcat6. This section lets maven run with tomcat7

Add in pom.xml


<build>
		<!-- we dont want the version to be part of the generated war file name -->
		<finalName>${project.artifactId}</finalName>
		<defaultGoal>compile</defaultGoal>
		<plugins>
			<plugin>
			<groupId>org.apache.tomcat.maven</groupId>
			<artifactId>tomcat7-maven-plugin</artifactId><span style="white-space:pre;">	</span><!-- use tomcat7 run --><span style="white-space:pre;">
</span>
			<version>2.2</version>
			<configuration>
			<port>8082</port><span style="white-space:pre;">		</span><!-- Run the port -->
<!-- 			<path>/mgr</path> -->
			<uriEncoding>UTF-8</uriEncoding>
			<finalName>mgr</finalName>
			<path>/KBase</path><span style="white-space:pre;">		</span><!-- The project name -->
			<server>tomcat7</server><span style="white-space:pre;">	</span>
			</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>

Related articles: