Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 部署到heroku时,在pom.xml中看不到我的jar文件或maven依赖项_Java_Maven_Servlets_Heroku - Fatal编程技术网

Java 部署到heroku时,在pom.xml中看不到我的jar文件或maven依赖项

Java 部署到heroku时,在pom.xml中看不到我的jar文件或maven依赖项,java,maven,servlets,heroku,Java,Maven,Servlets,Heroku,我试图使用heroku网站部署我的应用程序,但它没有看到任何maven依赖项,如HttpServlet,尽管它在我的pom.xml中,但它没有看到Gson.jar,尽管它在lib目录中。我添加了webapprunner插件,但什么也没发生。 这就是我犯的错误。谢谢你的帮助。谢谢大家 [ERROR] COMPILATION ERROR : [INFO] -------------------------------------------------------------

我试图使用heroku网站部署我的应用程序,但它没有看到任何maven依赖项,如
HttpServlet
,尽管它在我的
pom.xml
中,但它没有看到
Gson.jar
,尽管它在lib目录中。我添加了
webapprunner
插件,但什么也没发生。 这就是我犯的错误。谢谢你的帮助。谢谢大家

[ERROR] COMPILATION ERROR : 
       [INFO] -------------------------------------------------------------
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[6,21] package javax.servlet does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[7,26] package javax.servlet.http does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[8,26] package javax.servlet.http does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[9,26] package javax.servlet.http does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[11,48] package com.sun.javafx.collections.MappingChange does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[13,40] cannot find symbol
         symbol: class HttpServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,30] cannot find symbol
         symbol:   class HttpServletRequest
         location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,54] cannot find symbol
         symbol:   class HttpServletResponse
         location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,87] cannot find symbol
         symbol:   class ServletException
         location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[24,64] cannot find symbol
         symbol:   class HttpServletRequest
         location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[14,23] package com.google.gson does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[15,48] package com.sun.javafx.collections.MappingChange does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/Deals.java:[6,48] package com.sun.javafx.collections.MappingChange does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[14,9] method does not override or implement a method from a supertype
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[26,38] cannot find symbol
         symbol:   class Gson
         location: class hotels.HotelDeals
       [INFO] 15 errors 
       [INFO] -------------------------------------------------------------
       [INFO] ------------------------------------------------------------------------
       [INFO] BUILD FAILURE
       [INFO] ------------------------------------------------------------------------
       [INFO] Total time: 9.514 s
       [INFO] Finished at: 2018-03-09T16:25:19+00:00
       [INFO] Final Memory: 19M/177M
       [INFO] ------------------------------------------------------------------------
       [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project hotels: Compilation failure: Compilation failure:
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[6,21] package javax.servlet does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[7,26] package javax.servlet.http does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[8,26] package javax.servlet.http does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[9,26] package javax.servlet.http does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[11,48] package com.sun.javafx.collections.MappingChange does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[13,40] cannot find symbol
       [ERROR] symbol: class HttpServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,30] cannot find symbol
       [ERROR] symbol:   class HttpServletRequest
       [ERROR] location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,54] cannot find symbol
       [ERROR] symbol:   class HttpServletResponse
       [ERROR] location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[15,87] cannot find symbol
       [ERROR] symbol:   class ServletException
       [ERROR] location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[24,64] cannot find symbol
       [ERROR] symbol:   class HttpServletRequest
       [ERROR] location: class hotels.HotelDealsServlet
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[14,23] package com.google.gson does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[15,48] package com.sun.javafx.collections.MappingChange does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/Deals.java:[6,48] package com.sun.javafx.collections.MappingChange does not exist
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDealsServlet.java:[14,9] method does not override or implement a method from a supertype
       [ERROR] /tmp/build_d6140010f65ec320b1605ee2b8276832/khalidCS-deals-hotel-fa63bfd/src/main/java/hotels/HotelDeals.java:[26,38] cannot find symbol
       [ERROR] symbol:   class Gson
       [ERROR] location: class hotels.HotelDeals
       [ERROR] -> [Help 1]
       [ERROR] 
       [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
       [ERROR] Re-run Maven using the -X switch to enable full debug logging.
       [ERROR] 
       [ERROR] For more information about the errors and possible solutions, please read the following articles:
       [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
 !     ERROR: Failed to build app with Maven
       We're sorry this build is failing! If you can't find the issue in application code,
       please submit a ticket so we can help: https://help.heroku.com/
 !     Push rejected, failed to compile Java app.
 !     Push failed
添加OP在答案部分发布的POM

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.khalid.hotels</groupId>
    <artifactId>hotels</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>embeddedTomcatSample Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <properties>
        <tomcat.version>8.5.23</tomcat.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.github.jsimone</groupId>
                                    <artifactId>webapp-runner</artifactId>
                                    <version>8.0.30.2</version>
                                    <destFileName>webapp-runner.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>7.0</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

4.0.0
com.khalid.hotels
旅馆
0.0.1-快照
战争
embeddedTomcatSample Maven Webapp
http://maven.apache.org
8.5.23
org.apache.maven.plugins
maven依赖插件
2.3
包裹
复制
com.github.jsimone
webapprunner
8.0.30.2
webapp-runner.jar
org.apache.maven.plugins
maven战争插件
2.2
假的
org.apache.maven.plugins
maven编译器插件
3.5.1
1.8
1.8
javax.servlet
javax.servlet-api
3.1.0
假如
爪哇
JavaEEAPI
7
假如

请使用以下更新的POM:

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.khalid.hotels</groupId>
    <artifactId>hotels</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>embeddedTomcatSample Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <properties>
        <tomcat.version>8.5.23</tomcat.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.github.jsimone</groupId>
                                    <artifactId>webapp-runner</artifactId>
                                    <version>8.0.30.2</version>
                                    <destFileName>webapp-runner.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

        <dependencies>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>7.0</version>
            </dependency>
        </dependencies>
</project>

4.0.0
com.khalid.hotels
旅馆
0.0.1-快照
战争
embeddedTomcatSample Maven Webapp
http://maven.apache.org
8.5.23
org.apache.maven.plugins
maven依赖插件
2.3
包裹
复制
com.github.jsimone
webapprunner
8.0.30.2
webapp-runner.jar
org.apache.maven.plugins
maven战争插件
2.2
假的
org.apache.maven.plugins
maven编译器插件
3.5.1
1.8
1.8
javax.servlet
javax.servlet-api
3.1.0
爪哇
JavaEEAPI
7

这是我正在尝试部署的github项目,请添加pom.xml,因为我无法从我的国家访问github。请在评论中查看我已在原始帖子中添加了pom,它位于何处。请删除答案部分中的帖子。我在回答部分给出了更新的POM。请试试,让我知道。