在容器重启时重写Tomcat-users.xml - 如何提供凭据?

时间:2012-11-03 03:57:28

标签: maven cargo

我使用货物将war文件部署到tomcat服务器。我无法登录管理器,因为当我启动容器时会重写conf / tomcat-users.xml,即

mvn cargo:run

我如何提供用户/密码信用来访问经理?

喝彩!

修改:货物配置

<plugins>
    <!-- Start's the plugin tag for Cargo! -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
  <wait>false</wait>
  <container>
    <containerId>tomcat${tomcat.major}x</containerId>
    <zipUrlInstaller>
      <url>http://archive.apache.org/dist/tomcat/tomcat-${tomcat.major}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.tar.gz</url>
      <extractDir>${project.build.directory}/extract/</extractDir>
      <downloadDir>${project.build.directory}/download/</downloadDir>
    </zipUrlInstaller>
    <output>${project.build.directory}/tomcat${tomcat.major}x.log</output>
    <log>${project.build.directory}/cargo.log</log>
  </container>
  <configuration>
    <home>${project.build.directory}/tomcat-${tomcat.version}/container</home>
    <properties>
      <cargo.logging>high</cargo.logging>
      <cargo.servlet.port>9080</cargo.servlet.port>
      <cargo.tomcat.ajp.port>9008</cargo.tomcat.ajp.port>
    </properties>
  </configuration>
</configuration>
<executions>
  <execution>
    <id>start-container</id>
    <phase>pre-integration-test</phase>
    <goals>
      <goal>start</goal>
      <goal>deploy</goal>
    </goals>
    <configuration>
      <deployer>
        <deployables>
          <deployable>
            <groupId>${project.groupId}</groupId>
            <artifactId>mod-war</artifactId>
            <type>war</type>
            <pingURL>http://localhost:9080/mod-war</pingURL>
            <pingTimeout>30000</pingTimeout>
            <properties>
              <context>mod-war</context>
            </properties>
          </deployable>
        </deployables>
      </deployer>
    </configuration>
  </execution>
  <execution>
    <id>stop-container</id>
    <phase>post-integration-test</phase>
    <goals>
      <goal>stop</goal>
    </goals>
  </execution>
</executions>

    

1 个答案:

答案 0 :(得分:0)

找到它。您可以通过以下xml提供自定义配置(链接到上述评论中的货运文档)

      <files>
        <copy>
          <file>tomcat-users.xml</file>
          <tofile>conf/tomcat-users.xml</tofile>
          <configfile>true</configfile>
          <overwrite>true</overwrite>
        </copy>
      </files>

因此,您可以指定自己的conf / * .xml或其他任何内容,并在容器启动之前复制它。我现在可以登录经理:)

干杯