javamavengithubgithub-package-registry

Maven it's installing dependencies from Github packages, but when performing Maven install it's giving error


I've created two projects, one is an API (I'll call it search-api) to elasticsearch and the other an API (persistence-api) to postgreSQL, I need to have search-api as an dependency in persistence-api.

I fallowed the docs and I've watched some videos, but nothing seems to work when I'm performing the maven command "install -D skipTests"

Here's my files:

search-api's pom:

<?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.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.fatec.stacktec</groupId>
    <artifactId>search-api</artifactId>
    <version>0.0.3-SNAPSHOT</version>
    <name>search-api</name>
    <description>Completeltion project of the Systems Development Analysis course.</description>
    <properties>
        <java.version>11</java.version>
        <github.global.server>github</github.global.server>
    </properties>
    
    
    <repositories>
        <repository>
            <id>github</id>
            <url>https://maven.pkg.github.com/isaqueChaves/maven-repository</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
    
    <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub isaqueChaves Apache Maven Packages</name>
            <url>https://maven.pkg.github.com/isaqueChaves/maven-repository</url>
        </repository>
    </distributionManagement>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>     
                <configuration>
                    <source>11</source>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>           
            </plugin>
        </plugins>
    </build>

</project>

persistence-api's pom:

<?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.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.fatec.stacktec</groupId>
    <artifactId>persistence-api</artifactId>
    <version>0.0.3-SNAPSHOT</version>
    <name>persistence-api</name>
    <description>Persistence API for relational and NoSQL DB</description>
    <properties>
        <java.version>11</java.version>
        <stacktec-search-api.version>0.0.3-SNAPSHOT</stacktec-search-api.version>       
    </properties>   
    
    <dependencies>
        <dependency>
          <groupId>com.fatec.stacktec</groupId>
          <artifactId>search-api</artifactId>
          <version>0.0.3-SNAPSHOT</version>
        </dependency>
   </dependencies>

    <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
            <id>github</id>
            <url>https://maven.pkg.github.com/isaqueChaves/maven-repository</url>               
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>        
        </repository>
    </repositories>
    
    <distributionManagement>
        <snapshotRepository>
            <id>github</id>
            <url>https://maven.pkg.github.com/isaqueChaves/maven-repository</url>
        </snapshotRepository>
        <repository>
            <id>github</id>
            <name>GitHub isaqueChaves Apache Maven Packages</name>
            <url>https://maven.pkg.github.com/isaqueChaves/maven-repository</url>
        </repository>
    </distributionManagement>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>     
                <configuration>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>           
            </plugin>
        </plugins>
    </build>
    
</project>

Maven settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>
  
  <profiles>
  
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
        </repository>
        <repository>
          <id>github</id>
          <url>https://maven.pkg.github.com/isaqueChaves/maven-repository</url>        
        </repository>
      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>github</id>
      <username>isaquechaves</username>
      <password>>mytoken</password>
    </server>
  </servers>
</settings>

And here's the output when I run "maven install -D skipTests":

 Downloading from : https://repo1.maven.org/maven2/com/fatec/stacktec/search-api/0.0.3-SNAPSHOT/search-api-0.0.3-20230409.024122-1.pom
 Downloading from : https://maven.pkg.github.com/isaqueChaves/maven-repository/com/fatec/stacktec/search-api/0.0.3-SNAPSHOT/search-api-0.0.3-20230409.024122-1.pom
Downloaded from : https://maven.pkg.github.com/isaqueChaves/maven-repository/com/fatec/stacktec/search-api/0.0.3-SNAPSHOT/search-api-0.0.3-20230409.024122-1.pom (3.1 kB at 3.3 kB/s)
 Downloading from : https://maven.pkg.github.com/isaqueChaves/maven-repository/com/fatec/stacktec/search-api/0.0.3-SNAPSHOT/search-api-0.0.3-20230409.024122-1.jar
Downloaded from : https://maven.pkg.github.com/isaqueChaves/maven-repository/com/fatec/stacktec/search-api/0.0.3-SNAPSHOT/search-api-0.0.3-20230409.024122-1.jar (63 MB at 14 MB/s)

[1m--- [0;32mmaven-resources-plugin:3.1.0:resources[m [1m(default-resources)[m @ [36mpersistence-api Using 'UTF-8' encoding to copy filtered resources.
 Copying 1 resource
 Copying 1 resource

[1m--- [0;32mmaven-compiler-plugin:3.8.1:compile[m [1m(default-compile)[m @ [36mpersistence-api[0;
Changes detected - recompiling the module!
Compiling 29 source files to C:\Users\Administrador\Documents\workspace-spring-tool-suite-4-4.18.0.RELEASE\persistence-api\target\classes
-------------------------------------------------------------
COMPILATION ERROR : 
 -------------------------------------------------------------
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/Role.java:[18,48] package com.fatec.stacktec.searchapi.holder.user does not exist
Failed to execute goal [32morg.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile[m  Compilation failure: 
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/Role.java:[18,48] package com.fatec.stacktec.searchapi.holder.user does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/UserInternal.java:[27,48] package com.fatec.stacktec.searchapi.enumeration does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/UserInternal.java:[28,43] package com.fatec.stacktec.searchapi.holder does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/Role.java:[45,25] cannot find symbol
symbol:   class RoleHolder
location: class com.fatec.stacktec.persistenceapi.model.user.Role
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/UserInternal.java:[69,17] cannot find symbol
symbol:   class SemestreType
location: class com.fatec.stacktec.persistenceapi.model.user.UserInternal
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/UserInternal.java:[73,25] cannot find symbol
symbol:   class UserInternalHolder
location: class com.fatec.stacktec.persistenceapi.model.user.UserInternal
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/UserInternal.java:[69,30] cannot find symbol
symbol:   class SemestreType
location: class com.fatec.stacktec.persistenceapi.model.user.UserInternal
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/model/user/UserInternal.java:[34,1] cannot find symbol
symbol:   class SemestreType
location: class com.fatec.stacktec.persistenceapi.model.user.UserInternal
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/enumeration/EnvironmentType.java:[6,41] package com.fatec.stacktec.searchapi.util does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[13,48] package com.fatec.stacktec.searchapi.holder.user does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[14,52] package com.fatec.stacktec.searchapi.repository.user does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[15,43] package com.fatec.stacktec.searchapi.search does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[21,46] cannot find symbol
symbol: class ESBaseStoreServiceImpl
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[21,69] cannot find symbol
symbol: class RoleSearchRepository
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[21,91] cannot find symbol
symbol: class RoleHolder
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/RoleSearchServiceFacade.java:[47,25] cannot find symbol
symbol:   class RoleHolder
location: class com.fatec.stacktec.persistenceapi.search.facade.user.RoleSearchServiceFacade
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[13,43] package com.fatec.stacktec.searchapi.holder does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[14,52] package com.fatec.stacktec.searchapi.repository.user does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[15,43] package com.fatec.stacktec.searchapi.search does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[21,54] cannot find symbol
symbol: class ESBaseStoreServiceImpl
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[21,77] cannot find symbol
symbol: class UserInternalSearchRepository
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[21,107] cannot find symbol
symbol: class UserInternalHolder
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/search/facade/user/UserInternalSearchServiceFacade.java:[49,25] cannot find symbol
symbol:   class UserInternalHolder
location: class com.fatec.stacktec.persistenceapi.search.facade.user.UserInternalSearchServiceFacade
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/listener/user/RoleEntityListener.java:[11,48] package com.fatec.stacktec.searchapi.holder.user does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/listener/user/RoleEntityListener.java:[12,43] package com.fatec.stacktec.searchapi.search does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/listener/user/RoleEntityListener.java:[13,41] package com.fatec.stacktec.searchapi.util does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/listener/user/UserInternalEntityListener.java:[11,43] package com.fatec.stacktec.searchapi.holder does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/listener/user/UserInternalEntityListener.java:[12,43] package com.fatec.stacktec.searchapi.search does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/listener/user/UserInternalEntityListener.java:[13,41] package com.fatec.stacktec.searchapi.util does not exist
/C:/Users/Administrador/Documents/workspace-spring-tool-suite-4-4.18.0.RELEASE/persistence-api/src/main/java/com/fatec/stacktec/persistenceapi/configuration/FlywayMigrationConfig.java:[13,43] package com.fatec.stacktec.searchapi.search does not exist
[INFO] 30 errors 

All the imports comming from the search-api dependency failed

Thank you all in advance, because change the configuration of these snapshots will take many hours


Solution

  • As @Amir Azizkhan said "before trying to install persistence-api, you need to install search-api. because these project aren't in the same parent module. I tested it and I didn't see any problem"

    The problem seems resolved, probably some errors with Maven cache, my configs seem to be correct, so I'm closing this question, thank you all for helping me!