Maven cannot find a package with jpa entities

I’m trying to build up application that operates as shelter service. I have 3 micro services: one (external-service) contains external interfaces such as controllers and authorization logic and cats & owners services provide access to my entities. There is also a module that contains all jpa entities and dtos. Communication between micro services takes place via RabbitMQ. As database I use postgres. When I run my program locally, it works perfectly fine, but when I try to push it on github it fails with error “package %package with jpa entities% does not exist”. In services, dependency on the module with entities was added, in code the package was imported.

Here is my pom file for one of the services that uses package with jpa entities:

<?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>
    <artifactId>owner-service</artifactId>
    <packaging>pom</packaging>
    <dependencies>
        <dependency>
            <groupId>com.pllenxx</groupId>
            <artifactId>models</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <version>0.0.1-SNAPSHOT</version>
    <parent>
        <groupId>com.pllenxx</groupId>
        <artifactId>shelter-service</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <properties>
        <maven.compiler.source>19</maven.compiler.source>
        <maven.compiler.target>19</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I have tried to reassign the packages, invalidate caches, change application structure (at first all of my modules had org.springframework.boot as parent, then I made it parent for my root pom and my other services were inherited from root), change CI, but it didn’t work

  • Use mvn dependency:tree and check that the dependency is actually in your dependencies.

    – 

Leave a Comment