2010-09-30 50 views
1

我想部署一个使用mavencargo插件的web应用程序到tomcat服务器。未能在tomcat中使用maven货物部署webapp

但我在命令提示符下运行命令mvn cargo:deploy时出现下面的错误。

[INFO]未能部署 [C:\用户\拉梅什\工作空间\ SimpleSpringMvcExample \靶向 \ SimpleSpringMvcExample.war] FAIL - 遇到异常 java.io.FileNotFoundException: C:\ Program Files文件\阿帕澈软件 基金会\ Tomcat的 6.0 \的webapps \ SimpleSpringMvcExample.war(访问被拒绝)

的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.SimpleSpringMvcExample</groupId> 
    <artifactId>SimpleSpringMvcExample</artifactId> 
    <packaging>war</packaging> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>SimpleSpringMvcExample Maven Webapp</name> 
    <url>http://maven.apache.org</url> 

    ..... 

    <build> 
     <finalName>SimpleSpringMvcExample</finalName> 
     <plugins> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.0.2</version> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
      <plugin> 

       <groupId>org.codehaus.cargo</groupId> 
       <artifactId>cargo-maven2-plugin</artifactId> 
       <version>1.0</version> 
       <configuration> 
        <container> 
         <containerId>tomcat6x</containerId> 
         <type>remote</type> 
        </container> 
        <configuration> 
         <type>runtime</type> 
         <properties> 
          <cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url> 
          <cargo.remote.username>admin</cargo.remote.username> 
          <cargo.remote.password>admin</cargo.remote.password> 
         </properties> 
        </configuration> 
        <deployer> 
         <type>remote</type> 
         <deployables> 
          <deployable> 
           <groupId>com.SimpleSpringMvcExample</groupId> 
           <artifactId>SimpleSpringMvcExample</artifactId> 
           <type>war</type> 
          </deployable> 
         </deployables> 
        </deployer> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>tomcat-maven-plugin</artifactId> 
       <version>1.0-beta-1</version> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

的tomcat-users.xml中

<?xml version='1.0' encoding='cp1252'?> 

<tomcat-users> 
<user name="admin" password="admin" roles="admin,manager" /> 
</tomcat-users> 

行家的settings.xml

<?xml version="1.0" encoding="UTF-8"?> 
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
    <pluginGroups> 
    </pluginGroups> 
    <proxies> 
    </proxies> 
    <servers> 
    </servers> 
    <mirrors> 
    </mirrors> 
    <profiles> 
    </profiles> 
</settings> 

我想我给Tomcat管理的正确的ID &密码在pom.xml但不知道什么是错的?

有人突然工作fine..but开始抛出这个错误...我使用的Maven的Tomcat的插件样本春天项目之一以后。

我不知道,如果它有什么用此...

请帮我找出问题所在..

在此先感谢。

回答

3

从错误中可以看出,存在权限问题 - maven似乎没有权限将.war文件放在tomcat的webapps文件夹中。

你是否在Vista/Windows 7上打开了UAC?

+0

是的,我使用Windows 7 ..但我不知道什么是UAC? – javanoob 2010-09-30 14:58:25

+0

我搜索了UAC关闭它,现在它工作正常..感谢哥们。 – javanoob 2010-09-30 15:06:43