配置方式
在pom.xml中配置
<build>
<finalName>WebProject01</finalName>
<!-- 配置构建过程中需要使用的插件 -->
<plugins>
<plugin>
<!-- cargo是一家专门从事“启动Servlet容器”的组织 -->
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.12</version>
<!-- 针对插件进行的配置 -->
<configuration>
<!-- 配置当前系统中容器的位置 -->
<container>
<containerId>tomcat8x</containerId>
<home>D:\TomCat\apache-tomcat-8.5.47</home>
</container>
<!--确认一下系统中容器的位置 -->
<configuration>
<type>existing</type>
<home>D:\TomCat\apache-tomcat-8.5.47</home>
<!-- 如果Tomcat端口为默认值8080则不必设置该属性 -->
<properties>
<cargo.servlet.port>80</cargo.servlet.port>
</properties>
</configuration>
</configuration>
<!-- 配置插件在什么情况下执行 -->
<executions>
<execution>
<id>cargo-run</id>
<!-- 生命周期的阶段 -->
<phase>install</phase>
<goals>
<!-- 插件的目标 -->
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
运行
在eclipse中运行maven构建中的deploy命令,但是不能关闭端口,去tomcat服务器中关闭。
在命令行中运行,可以ctrl -c直接关闭。
查看中央仓库的配置信息
1进入.maven中央仓库
2.搜索想要的jar包,点击核心架包,选择想要的版本。
3.复制坐标