-
配置tomcat和maven
進入tomcat安裝目錄conf\tomcat_users.xml:修改如下:
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin123" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
進入maven安裝目錄conf/settings.xml:修改如下:
<server>
<id>tomcat7</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!--下載下傳包失敗錯誤解決方案。>
<!--搜尋到mirrors,在mirrors節點下配置一下資訊添加代理設定,解決找不到資源問題>
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
2.修改pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<warFile>target/activity_system.war</warFile> <!-- 生成的項目war包>
<server>tomcat7</server>
<url>http://localhost:8088/activity_system</url>
<path>/activity_system</path>
</configuration>
</plugin>
配置完成後進行運作後報錯,沒有進行編,網上找到如下解決方法,已驗證:
<defaultGoal>compile</defaultGoal>
3.運作maven項目
右擊項目 maven -build
成功後會在項目中找到war包