最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - mvn package throws compilation error for getters and setters with lombok - Stack Overflow

programmeradmin7浏览0评论

When i do mvn package it throws the followiing errors for my @getter and @setter as it can not find the specific methods getNeueEinstellungen() etc., i have tried fixing it using advice from chatgpt and read simmilar reports here, i have not been able to fix it. This is my code:

package com.ostfalia.data.entity.core.unternehmen.config;

import lombok.Getter;
import lombok.Setter;

public class PersonalInputsDTO {

@Getter @Setter
private int neueinstellungen;

@Getter @Setter
private int entlassungen;

@Getter @Setter
private double kurzarbeit;

@Getter @Setter
private double ueberstunden;

@Getter @Setter
private double praemie;

@Getter @Setter
private int arbeitskapazitaet;


public void SetWithStandardValues() {
    this.neueinstellungen = 0;
    this.entlassungen = 16;
    this.kurzarbeit = 0.0;
    this.ueberstunden = 0.0;
    this.praemie = 5.0;
    this.arbeitskapazitaet = 18000;
}}

I get these Errors:

[ERROR] Failed to execute goal .apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project EuroManager: Compilation failure: Compilation failure:
[ERROR] /C:/Users/max/OneDrive/Desktop/teamprojekt/em-backend/src/main/java/com/ostfalia/services/UnternehmenService.java:[34,47] Symbol nicht gefunden
[ERROR]   Symbol: Methode getNeueinstellungen()
[ERROR]   Ort: Variable personalInputs von Typ com.ostfalia.data.entity.core.unternehmen.config.PersonalInputsDTO
[ERROR] /C:/Users/max/OneDrive/Desktop/teamprojekt/em-backend/src/main/java/com/ostfalia/services/UnternehmenService.java:[35,46] Symbol nicht gefunden
[ERROR]   Symbol: Methode getEntlassungen()

This is my Pomxml:

<project xmlns=".0.0"
    xmlns:xsi="; xsi:schemaLocation=".0.0 .xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ostfalia</groupId>
    <artifactId>EuroManager</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>EuroManager</name>
    <url>;/url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>.testcontainers</groupId>
            <artifactId>mysql</artifactId>
            <version>1.17.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>1.17.6</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

        <!-- Spring Boot Dependencies -->
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.5.4</version>
        </dependency>

        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
            <version>2.5.4</version>
        </dependency>

        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.15</version>
        </dependency>

        <!-- Spring Boot Starter Data JPA für Hibernate -->
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>2.5.4</version>
        </dependency>

        <!-- MySQL JDBC-Treiber -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.33</version>
            <scope>runtime</scope>
        </dependency>

        <!-- JWT -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>0.11.5</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>0.11.5</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <version>0.11.5</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.17.0</version>
        </dependency>

        <dependency>

            <groupId>.projectlombok</groupId>

            <artifactId>lombok</artifactId>

            <version>1.18.24</version>

            <scope>provided</scope>

        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <mavenpiler.source>17</mavenpiler.source>
        <mavenpiler.target>17</mavenpiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>


</project>

Thank you in advance for helping me, im fairly new to coding and this is my first bigger project, i have not started this project we where given this as an project in Uni

When i do mvn package it throws the followiing errors for my @getter and @setter as it can not find the specific methods getNeueEinstellungen() etc., i have tried fixing it using advice from chatgpt and read simmilar reports here, i have not been able to fix it. This is my code:

package com.ostfalia.data.entity.core.unternehmen.config;

import lombok.Getter;
import lombok.Setter;

public class PersonalInputsDTO {

@Getter @Setter
private int neueinstellungen;

@Getter @Setter
private int entlassungen;

@Getter @Setter
private double kurzarbeit;

@Getter @Setter
private double ueberstunden;

@Getter @Setter
private double praemie;

@Getter @Setter
private int arbeitskapazitaet;


public void SetWithStandardValues() {
    this.neueinstellungen = 0;
    this.entlassungen = 16;
    this.kurzarbeit = 0.0;
    this.ueberstunden = 0.0;
    this.praemie = 5.0;
    this.arbeitskapazitaet = 18000;
}}

I get these Errors:

[ERROR] Failed to execute goal .apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project EuroManager: Compilation failure: Compilation failure:
[ERROR] /C:/Users/max/OneDrive/Desktop/teamprojekt/em-backend/src/main/java/com/ostfalia/services/UnternehmenService.java:[34,47] Symbol nicht gefunden
[ERROR]   Symbol: Methode getNeueinstellungen()
[ERROR]   Ort: Variable personalInputs von Typ com.ostfalia.data.entity.core.unternehmen.config.PersonalInputsDTO
[ERROR] /C:/Users/max/OneDrive/Desktop/teamprojekt/em-backend/src/main/java/com/ostfalia/services/UnternehmenService.java:[35,46] Symbol nicht gefunden
[ERROR]   Symbol: Methode getEntlassungen()

This is my Pomxml:

<project xmlns="http://maven.apache./POM/4.0.0"
    xmlns:xsi="http://www.w3./2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache./POM/4.0.0 http://maven.apache./maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ostfalia</groupId>
    <artifactId>EuroManager</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>EuroManager</name>
    <url>http://maven.apache.</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>.testcontainers</groupId>
            <artifactId>mysql</artifactId>
            <version>1.17.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>1.17.6</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

        <!-- Spring Boot Dependencies -->
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.5.4</version>
        </dependency>

        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
            <version>2.5.4</version>
        </dependency>

        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.15</version>
        </dependency>

        <!-- Spring Boot Starter Data JPA für Hibernate -->
        <dependency>
            <groupId>.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>2.5.4</version>
        </dependency>

        <!-- MySQL JDBC-Treiber -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.33</version>
            <scope>runtime</scope>
        </dependency>

        <!-- JWT -->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>0.11.5</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>0.11.5</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <version>0.11.5</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.17.0</version>
        </dependency>

        <dependency>

            <groupId>.projectlombok</groupId>

            <artifactId>lombok</artifactId>

            <version>1.18.24</version>

            <scope>provided</scope>

        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <mavenpiler.source>17</mavenpiler.source>
        <mavenpiler.target>17</mavenpiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>


</project>

Thank you in advance for helping me, im fairly new to coding and this is my first bigger project, i have not started this project we where given this as an project in Uni

Share Improve this question edited Mar 21 at 17:45 John Williams 5,5552 gold badges10 silver badges25 bronze badges asked Mar 21 at 14:36 KalleKalle 315 bronze badges 2
  • Why using ancient old maven-surefire-plugin version? Mixing different versions of JUnit 3.X, 4.X and junit-jupiter.. .will not work and does not make sense..Also why using an ancient old Spring Boot version? Long time end of support since 2022-05-19 (for OSS and since 2023 for Enterprise) spring.io/projects/spring-boot#support manually defining jackson version.. use the spring boot parent or the spring-boot-dependencies instead... – khmarbaise Commented Mar 21 at 21:43
  • We got this project from the university and just need to continue it, i dont really know if we are allowed to change that, or how much work that will be, we have a specific time window in which we need to be finished – Kalle Commented Mar 22 at 9:36
Add a comment  | 

1 Answer 1

Reset to default 2

You need to tell the maven compiler plugin to process the lombok annotations. Try adding the following to your plugins definitions:

            <plugin>
                <groupId>.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
        <version>1.18.24</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
发布评论

评论列表(0)

  1. 暂无评论