java - 找不到 Apache Tomcat Maven 插件 war

标签 java maven tomcat

我正在关注文档 here但我最终得到了一个 jar,它没有找到要执行的 war。这是错误:

java.io.FileNotFoundException: C:\Users\ortizj\Documents\NetBeansProjects\valida
tion-manager\Validation-Manager-Web\target\.extract\webapps\ROOT.war (The system
 cannot find the file specified)

由于某些原因,war 文件没有添加到 jar 中,因此在提取它时失败。

ROOT.war 存在并且存在于目标文件夹中。

相关POM内容如下:

POM Project :

 <profile>
        <id>installer</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.2</version>
                    <executions>
                        <execution>
                            <id>tomcat-run</id>
                            <goals>
                                <goal>exec-war-only</goal>
                            </goals>
                            <phase>package</phase>
                            <configuration>
                                <warRunDependency>
                                    <dependency>
                                        <groupId>${project.groupId}</groupId>
                                        <artifactId>Validation-Manager-Web</artifactId>
                                        <version>${project.version}</version>
                                        <type>war</type>
                                    </dependency>
                                    <charset>utf-8</charset>
                                    <httpPort>9078</httpPort>
                                    <contextPath>/</contextPath>
                                </warRunDependency>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

最佳答案

如何将它添加到您的 pom.xml 文件..

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>${maven-war-plugin.version}</version>
                        <configuration>
                            <warSourceDirectory>src/main/webapp</warSourceDirectory>
                            <warName>your-war-name</warName>
                            <failOnMissingWebXml>false</failOnMissingWebXml>
                            <outputDirectory>${deploy-path}</outputDirectory>
                        </configuration>
                    </plugin>

关于java - 找不到 Apache Tomcat Maven 插件 war ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44835340/

相关文章:

Java方法接受不同父类(super class)的ArrayList,必须使用Interface吗?

java - 使用Tika 1.10 Parser获取文件内容

spring boot 嵌入式tomcat应用 session 不失效

java - Tomcat 上的 Web 应用程序

java - Java中用于匹配整数序列的正则表达式

c# - java字节和C#字节一样吗?

java - Initial Vector的CTR模式使用(四)

java - 无法解决 pom.xml 中的错误

jakarta-ee - 为什么我的 pom.xml 中会出现此依赖项解析错误?

Apache 错误 403 : Forbidden