Deploy A Javaee6 Country Of War Inwards Tomcat7 Using Maven

Recently, I'm trying to deploy a unproblematic spider web application (war) inwards tomcat7 merely it seems the one-time maven mode of deploying a nation of war volition non hap it.

The plugin I used to exercise for tomcat6 is:

<plugin>  <groupId>org.codehaus.mojo</groupId>  <artifactId>tomcat-maven-plugin</artifactId>  <configuration>   <url>http://127.0.0.1:8080/manager</url>   <server>MyServer</server>   <path>/myApp</path>  </configuration> </plugin> 
But it doesn't travel for tomcat7 server. After googling, I institute a novel plugin for deploying inwards tomcat7: http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/snapshot-test.html And then here's how I exercise the novel plugin: 1.) Add the ff lines inwards your maven's settings.xml, normally institute inwards %user%/.m2 folder.
<server>  <id>TomcatServer</id>  <username>admin</username>  <password>admin</password> </server> 
2.) Modify tomcat's vii tomcat-users.xml file, which tin travel institute within "%tomcat_installation%/config, together with add together the ff lines:
<role rolename="manager-gui"/> <role rolename="manager-script"/>  <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status"/> 
Take authorities notation that managing director roles has been broken downwards into four roles equally yous tin see. 3.) In your pom.xml file, add together these repository together with plugin repository:
<repositories>  <repository>   <id>people.apache.snapshots</id>   <url>http://repository.apache.org/content/groups/snapshots-group/</url>   <releases>    <enabled>false</enabled>   </releases>   <snapshots>    <enabled>true</enabled>   </snapshots>  </repository> </repositories>  <pluginRepositories>  <pluginRepository>   <id>apache.snapshots</id>   <name>Apache Snapshots</name>   <url>http://repository.apache.org/content/groups/snapshots-group/</url>   <releases>    <enabled>false</enabled>   </releases>   <snapshots>    <enabled>true</enabled>   </snapshots>  </pluginRepository> </pluginRepositories> 
4.) Then, what I normally does is to practise a evolution profile where I tin prepare the deployment machinery inwards my local machine, inwards this illustration using the tomcat7 maven plugin:
<profiles>  <profile>   <id>development</id>   <activation>    <activeByDefault>true</activeByDefault>   </activation>   <build>    <plugins>     <plugin>      <groupId>org.apache.tomcat.maven</groupId>      <artifactId>tomcat7-maven-plugin</artifactId>      <version>2.0-SNAPSHOT</version>      <configuration>       <url>http://localhost:8080/manager/html</url>       <server>TomcatServer</server>      </configuration>     </plugin>    </plugins>   </build>  </profile> </profiles> 
Note that the url needs the additional /html, equally it's updated yesteryear apache, otherwise yous volition larn the error: "403 access denied" 5.) You tin forthwith invoke the tomcat7 deploy dominance equally documented yesteryear the link inwards the altitude of this writing.
mvn tomcat7:deploy 
Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.