I am having trouble deploying my app on Heroku.
It builds successfully on localhost without any errror. It even builds successfully when I do mvn clean install
or mvn clean package
.
This is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
4.0.0 com.furntrade SpringBoot 1.0 org.springframework.boot spring-boot-starter-parent 2.5.6 FurntradeManagmentServet
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<webjars-bootstrap.version>4.1.3</webjars-bootstrap.version>
<webjars-jquery-ui.version>1.12.1</webjars-jquery-ui.version>
<webjars-jquery.version>3.3.1-1</webjars-jquery.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>${webjars-jquery.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery-ui</artifactId>
<version>${webjars-jquery-ui.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>${webjars-bootstrap.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.30</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>${project.build.sourceEncoding}</encoding.source>
<encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
</build>
This is application.properties file (I removed my db credentials)
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.maxActive=10
spring.datasource.maxIdle=5
spring.datasource.minIdle=2
spring.datasource.initialSize=5
spring.datasource.removeAbandoned=true\
spring.datasource.url=jdbc:postgresql://DNLOCATION:5432/DBTANLENAME
spring.datasource.username=USERNAME
spring.datasource.password=PASSWORD
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.format_sql=true
lspring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true
logging.level.org.hibernate.type=trace
hibernate.cache.auto_evict_collection_cache=true
server.error.include-message=always
spring.data.rest.base-path=/api
logging.level.org.springframework=INFO
spring.profiles.active=production
server.port=${PORT:5000}
Procfile
web: java $JAVA_OPTS -jar target/SpringBoot-1.0.jar -Dserver.port=$PORT $JAR_OPTS
settings.properties file
java.runtime.version=1.8
This is the error im getting in logs
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/build_530e329c/src/main/java/com/furntrade/furntrademanagmentservet/Security/SecurityConfig.java:[40,48] cannot find symbol
symbol: method of(java.lang.String,java.lang.String,java.lang.String)
location: interface java.util.List
[ERROR] /tmp/build_530e329c/src/main/java/com/furntrade/furntrademanagmentservet/Security/SecurityConfig.java:[41,48] cannot find symbol
symbol: method of(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
location: interface java.util.List
[ERROR] /tmp/build_530e329c/src/main/java/com/furntrade/furntrademanagmentservet/Security/SecurityConfig.java:[42,48] cannot find symbol
symbol: method of(java.lang.String)
location: interface java.util.List
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.426 s
[INFO] Finished at: 2022-04-14T22:40:26Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project FurntradeManagmentServet: Compilation failure: Compilation failure:
[ERROR] /tmp/build_530e329c/src/main/java/com/furntrade/furntrademanagmentservet/Security/SecurityConfig.java:[40,48] cannot find symbol
[ERROR] symbol: method of(java.lang.String,java.lang.String,java.lang.String)
[ERROR] location: interface java.util.List
[ERROR] /tmp/build_530e329c/src/main/java/com/furntrade/furntrademanagmentservet/Security/SecurityConfig.java:[41,48] cannot find symbol
[ERROR] symbol: method of(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
[ERROR] location: interface java.util.List
[ERROR] /tmp/build_530e329c/src/main/java/com/furntrade/furntrademanagmentservet/Security/SecurityConfig.java:[42,48] cannot find symbol
[ERROR] symbol: method of(java.lang.String)
[ERROR] location: interface java.util.List
[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]
I have to mention that I don't have those java.util.List
errors on my localhost.
I have no idea where I am doing wrong.
I suggest you to create a file named system.properties in project directory and write
java.runtime.version=11
. I hope it should work as because this had worked for me.