I'm trying to automatically deploy a Maven webapp from Eclipse Java EE to my local Tomcat server. I'm using Windows XP. This is the error:
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project practicaIW: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://127.0.0.1:8080/manager/deploy?path=%2Fpractica-3&war= -> [Help 1]
I think I know the reason of this error:
- If I run the Tomcat server inside eclipse, 127.0.0.1:8080 is my workspace/target. There is any manager folder and rest of classes on it, so it does not work. Possible botched solution: copy this folder and files inside my project.
- If I run the Tomcat server outside eclipse, 127.0.0.1:8080 is tomcat_location/webapps. It does not work because Eclipse creates the war file in my workspace so Tomcat cannot find it. Possible solution: configure the maven-war-plugin to create the war file into 127.0.0.1:8080. How could I do it? Is it the best way to procceed?
pom.xml extract:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://127.0.0.1:8080/manager</url>
<username>admin</username>
<password>password</password>
<server>TomcatServer</server>
<path>/practica-3</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
tomcat-users.xml extract:
<tomcat-users>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<role rolename="manager-script"/>
<user password="password" roles="admin,manager,manager-gui,manager-script" username="admin"/>
</tomcat-users>
UPDATE: pvm14 answered the question. But previously you have to open the file: Tomcat v7.0 Server at localhost.server. Here is how:
- Properties
- Clicking on Switch location, the file that the arrow 3 indicate will appear.
- Open the file