Error: Unable to access jarfile

Asked

Viewed 76 times

-2

I’ve been trying to deploy my application to Heroku for weeks and I always get errors. i had a dynos error, I created a Procfile file with the following content: web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/CadUnico-0.0.1-SNAPSHOT.jar, but now in Logs I have the following error: Error: Unable to access jarfile target/CadUnico-0.0.1-SNAPSHOT.jar.

I don’t have the . jar file in target folder, because I don’t know how to generate such file, I need help to resolve this error and upload the application correctly.

repository link: https://github.com/Rafael472/CadUnico I am willing to add more information if necessary.

inserir a descrição da imagem aqui

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.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.pio</groupId>
    <artifactId>CadUnico</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>CadUnico</name>
    <description>Cadastro de Pessoas/Usuarios </description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <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-tomcat</artifactId>
            <scope>provided</scope>
        </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-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>   
        </plugins>
    </build>
</project>

  • It’s complicated guys, I’m trying to question and learn, and instead of commenting or hinting or something like that, people just vote negative on the question, and from that the question doesn’t rank well and is probably not answered. toxic community.

  • One important thing... you should post your code in writing (copying and pasting here in stackoverflow) and not an image of it. When posting any code, make sure you’re doing it the right way, as per the forum instructions.

  • @leandro.dev ok, I will change the question and remember this in the next. thanks for the tip.

  • @leandro.dev thank you very much, I was able to generate the jar file. I will edit the question by putting my Pom.xml in code mode, I guarantee that your answer will help a lot of people.

1 answer

1


Access a terminal project folder and run mvn package to generate the jar. The jar will be generated inside the folder target.

This mvn command is from Maven.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.