S
S
Stepan Gorbatenko2020-06-13 17:41:29
Java
Stepan Gorbatenko, 2020-06-13 17:41:29

I can't deploy a java application to heroku, I've been scratching my head for 3 days, why?

Created a dynamic web application in eclipse. It works perfectly on localhost, but when I try to deploy it to heroku it gives me this error:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project BlagoDari: Compilation failure: Compilation failure:


I just didn’t try to change anything in the pom.xml file, nothing helps ...
Here is the file itself:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>BlagoDari</groupId>
  <artifactId>BlagoDari</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <finalName>blagodari</finalName>
    <plugins>

      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <goal>war:inplace</goal>
          <outputDirectory>artifacts</outputDirectory>
          <webXml>WebContent\WEB-INF\web.xml</webXml>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.1.2</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.heroku</groupId>
                  <artifactId>webapp-runner</artifactId>
                  <version>9.0.31.0</version>
                  <destFileName>webapp-runner.jar</destFileName>
                </artifactItem>
              </artifactItems>
              <outputDirectory>artifacts</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <target>1.8</target>
          <source>1.8</source>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.49</version>
    </dependency>

    <dependency>
      <groupId>javax.json</groupId>
      <artifactId>javax.json-api</artifactId>
      <version>1.1</version>
    </dependency>


  </dependencies>

</project>


Here is the full error log:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project BlagoDari: Compilation failure: Compilation failure: 
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[6,21] package javax.servlet does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[7,32] package javax.servlet.annotation does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[8,32] package javax.servlet.annotation does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[9,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[10,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[11,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[12,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[18,33] cannot find symbol
[ERROR]   symbol: class HttpServlet
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[16,2] cannot find symbol
[ERROR]   symbol: class WebServlet
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[17,2] cannot find symbol
[ERROR]   symbol: class MultipartConfig
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Models/DbHelper.java:[9,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Models/DbHelper.java:[10,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[27,30] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Collectors.NewRequest
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[27,58] cannot find symbol
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class Collectors.NewRequest
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[28,32] cannot find symbol
[ERROR]   symbol:   class ServletException
[ERROR]   location: class Collectors.NewRequest
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[40,31] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Collectors.NewRequest
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[40,59] cannot find symbol
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class Collectors.NewRequest
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/NewRequest.java:[41,32] cannot find symbol
[ERROR]   symbol:   class ServletException
[ERROR]   location: class Collectors.NewRequest
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Models/DbHelper.java:[197,47] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Models.DbHelper
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Models/DbHelper.java:[206,36] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Models.DbHelper
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Models/DbHelper.java:[471,53] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Models.DbHelper
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Models/DbHelper.java:[539,55] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Models.DbHelper
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[6,21] package javax.servlet does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[7,32] package javax.servlet.annotation does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[8,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[9,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[10,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[11,26] package javax.servlet.http does not exist
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[18,28] cannot find symbol
[ERROR]   symbol: class HttpServlet
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[17,2] cannot find symbol
[ERROR]   symbol: class WebServlet
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[27,30] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Collectors.Login
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[27,58] cannot find symbol
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class Collectors.Login
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[28,32] cannot find symbol
[ERROR]   symbol:   class ServletException
[ERROR]   location: class Collectors.Login
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[50,31] cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class Collectors.Login
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/Login.java:[50,59] cannot find symbol
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class Collectors.Login
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class Collectors.RequestOpened
[ERROR] /C:/Users/77052/blagodari_web/blagodari_web-master/src/Collectors/RequestOpened.java:[26,32] cannot find symbol
[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


If anyone has any thoughts on this, please share. I have already searched all over Google, asked questions on the forum, and everything is past ...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nastya1920, 2020-06-13
@Nastya1920

Struggled with the same problem. helped to change in the dependency of maven-plugin: instead of org.apache I took org.springframework.boot.

D
Dmitry Roo, 2020-06-13
@xez

It says "try-with-resources is not supported in -source 1.6"
Your maven compiles with java version 1.6 (apparently by default). You need to set the java version in the maven-compiler-plugin options.
Recipe here: https://maven.apache.org/plugins/maven-compiler-pl...

S
Sergey_USB, 2020-06-13
@Sergey_USB

https://www.notion.so/heroku-com-1b714a79aed445d4a...
May help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question