【问题标题】:Maven tomcat plugin does not accept pathMaven tomcat 插件不接受路径
【发布时间】:2014-09-19 17:26:28
【问题描述】:

我目前正在尝试设置与我的 maven 项目的 artifactId 不同的路径。不幸的是,我的尝试没有奏效。

我尝试通过设置它

   <build>
      <plugins>
        [...]
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <path>/AWV</path>
            </configuration>
        </plugin>
      </plugins>
      <finalName>AWV</finalName>
    </build>

但是当调用mvn tomcat7:run-war 时,它们都不起作用(但战争被正确地命名为 AWV.war)。

我能找到的所有文档(http://mojo.codehaus.org/tomcat-maven-plugin/configuration.htmlhttp://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/run-war-mojo.html)都说我可以通过这样设置路径来做到这一点。

或者,我尝试使用mvn tomcat7:run-war -Dmaven.tomcat.path=/AWV 运行tomcat,但也没有成功。其他提示,例如在 (Eclipse maven run configuration using 'run' goal from tomcat7 maven plugin doesn't respect default context path) 之前执行 clean 也不起作用。

有人知道如何解决这个问题吗?

编辑:在使用 tomcat-maven-plugin 的 2.3-SNAPSHOT 时也会发生这种情况。

【问题讨论】:

  • 你用的是什么版本的tomcat?
  • 我使用的是Tomcat7和对应的plugin-version。

标签: java maven tomcat


【解决方案1】:

搜索了一段时间,发现错误:在src/main/webapps/META-INF/context.xml里面有文字:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/awv-seite"/>

我不知道这个文件是如何到达那里的,可能是 eclipse 或 NetBeans 创建的。这阻止了我所有其他尝试成功,在那里设置路径后,一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-23
    • 1970-01-01
    • 2013-10-08
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2011-06-11
    • 1970-01-01
    相关资源
    最近更新 更多