Primeiro eu adicionei no pom as bibliotecas do Spring Data JPA, Spring Data JDBC e do PostegreSQL Driver.
Depois, coloquei as seguintes instruções no arquivo application.properties:
#Porta do servidor
server.port=8083
#Caminho do banco de dados
spring.datasource.url=jdbc:postgresql://localhost:5432/mercadinho
#Nome do usuário de conexão com o banco
spring.datasource.username=postgres
#Senha da conexão com o banco
spring.datasource.password=12345
#Nome do driver do banco
spring.datasource.driver-class-name=org.postgresql.Driver
#Configuração para indicar o hibernate para gerar atualizações automáticas constantemente no esquema
spring.jpa.hibernate.ddl-auto=update
Foi quando salvei que apareceu o erro no arquivo pom.xml na tag parent:
Código no arquivo pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.6</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.higormorais</groupId>
<artifactId>primeiroExemplo1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>primeiroExemplo1</name>
<description>Teste Spring</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</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.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Tag do erro:
Input length = 1 (org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources:default-resources:process-resources) org.apache.maven.plugin.MojoExecutionException: Input length = 1
at org.apache.maven.plugins.resources.ResourcesMojo.execute(ResourcesMojo.java:362) at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:336)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$8(MavenImpl.java:1423) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:182) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:117) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1422) at
org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:55) at
org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:135) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:169) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:114) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:182) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:117) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:105) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:182) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:156) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:103) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:88) at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:198) at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:853) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:232) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:281) at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:334) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:337) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:389) at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:410) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:160) at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:251) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by:
org.apache.maven.shared.filtering.MavenFilteringException: Input length = 1 at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:113) at
org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:262) at
org.apache.maven.plugins.resources.ResourcesMojo.execute(ResourcesMojo.java:356) ... 31 more Caused by: java.nio.charset.MalformedInputException: Input length = 1 at java.base/
java.nio.charset.CoderResult.throwException(CoderResult.java:274) at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at java.base/
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188) at java.base/java.io.InputStreamReader.read(InputStreamReader.java:177) at java.base/
java.io.BufferedReader.read1(BufferedReader.java:211) at java.base/java.io.BufferedReader.read(BufferedReader.java:287) at java.base/java.io.BufferedReader.fill(BufferedReader.java:162) at
java.base/java.io.BufferedReader.read(BufferedReader.java:183) at org.apache.maven.shared.filtering.BoundedReader.read(BoundedReader.java:85) at
org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read(MultiDelimiterInterpolatorFilterReaderLineEnding.java:235) at
org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read(MultiDelimiterInterpolatorFilterReaderLineEnding.java:197) at java.base/
java.io.Reader.read(Reader.java:250) at org.apache.maven.shared.utils.io.IOUtil.copy(IOUtil.java:199) at org.apache.maven.shared.utils.io.IOUtil.copy(IOUtil.java:181) at
org.apache.maven.shared.utils.io.FileUtils.copyFile(FileUtils.java:1908) at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:98) ... 33 more
Meu console quando eu rodo o projeto: