1

我正在尝试使用maven cargo插件将 Web 应用程序部署到tomcat服务器中。

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

[信息] 无法部署 [C:\Users\Ramesh\workspace\SimpleSpringMvcExample\target\SimpleSpringMvcExample.war] 失败 - 遇到异常 java.io.FileNotFoundException: C:\Program Files\Apa che Software Foundation\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>

行家设置.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>

我想我在pom.xml但不知道出了什么问题?

它工作正常......但突然开始抛出这个错误......在我将 maven-tomcat-plugin 用于其中一个示例 spring 项目之后......

不知道跟这个有没有关系...

请帮我定位问题..

提前致谢。

4

1 回答 1

3

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

您是否在打开 UAC 的 Vista/Windows 7 上?

于 2010-09-30T14:55:03.897 回答