我应该在哪里获得tomcat7-maven-plugin的context.xml

时间:2014-12-11 19:10:46

标签: java maven tomcat maven-tomcat-plugin embedded-tomcat-7

当我在 tomcat7-maven-plugin 的帮助下运行嵌入式tomcat时,它崩溃了以下 错误:

SEVERE: Missing context.xml

我在maven插件中有以下配置:

                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.0</version>
                        <configuration>
                            <path>/project_name_test</path>
                        </configuration>
                        <executions>
                            <execution>
                                <id>tomcat-run</id>
                                <goals>
                                    <goal>run-war-only</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <fork>true</fork>
                                </configuration>
                            </execution>
                            <execution>
                                <id>tomcat-shutdown</id>
                                <goals>
                                    <goal>shutdown</goal>
                                </goals>
                                <phase>post-integration-test</phase>
                            </execution>
                        </executions>
                    </plugin>

我们是否有默认上下文选项?我不想创建任何上下文 - 我有war文件将上传到此应用程序服务器。

修改

我发现了这个问题。为了加入contextore,你应该添加你需要的参数属性。例如:

                        <configuration>
                            <url>http://localhost:8080/manager</url>
                            <server>localhost</server>
                            <path>/${project.build.finalName}</path>
                        </configuration>

1 个答案:

答案 0 :(得分:1)

你能先试试这个吗?

<plugins>
   <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.2</version>
   </plugin>
</plugins>

如果您需要context.xml文件,它应该位于META-INF文件夹下。