Bottas
Bottas

Reputation: 13

Could not find artifact - Firebase Messaging dependency for Maven

I am currently developing and Android app using GluonFX, I'm trying to setup push notifications while following the documentation that recommends to use FireBase. Unfortunately when I try to add the Maven dependency of FireBase (I also tried with Gradle and it's the same story), I always get this error message: "Could not find artifact com.google.firebase:firebase-messaging:jar:24.0.0 in google (https://maven.google.com/)".

 <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.clouddroid</groupId>
    <artifactId>clouddroid</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>CloudDroid</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>17</maven.compiler.release>
        <javafx.version>21</javafx.version>
        <attach.version>4.0.19</attach.version>
        <gluonfx.plugin.version>1.0.22</gluonfx.plugin.version>
        <gluonfx.target>android</gluonfx.target>
        <javafx.plugin.version>0.0.8</javafx.plugin.version>
        <mainClassName>com.clouddroid.GluonApplication</mainClassName>
    </properties>


    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq</groupId>
            <artifactId>charm-glisten</artifactId>
            <version>6.2.3</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>display</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>lifecycle</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>statusbar</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>storage</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>util</artifactId>
            <version>${attach.version}</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq</groupId>
            <artifactId>charm-down-core</artifactId>
            <version>3.8.6</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq</groupId>
            <artifactId>charm-down-plugin-storage</artifactId>
            <version>3.8.6</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-jetty-client</artifactId>
            <version>11.0.22</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>2.1.0-alpha1</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>push-notifications</artifactId>
            <version>4.0.21</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>pictures</artifactId>
            <version>4.0.21</version>
        </dependency>
        <dependency>
            <groupId>com.gluonhq.attach</groupId>
            <artifactId>keyboard</artifactId>
            <version>4.0.21</version>
        </dependency>
        <dependency>
            <groupId>com.google.firebase</groupId>
            <artifactId>firebase-messaging</artifactId>
            <version>24.0.0</version>
        </dependency>
    </dependencies>

 <repositories>
     <repository>
         <id>google</id>
         <url>https://maven.google.com/</url>
     </repository>
     <repository>
         <id>Gluon</id>
         <url>https://nexus.gluonhq.com/nexus/content/repositories/releases</url>
     </repository>
 </repositories>

 <build>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
             <version>3.8.1</version>
         </plugin>

         <plugin>
             <groupId>org.openjfx</groupId>
             <artifactId>javafx-maven-plugin</artifactId>
             <version>${javafx.plugin.version}</version>
             <configuration>
                 <mainClass>${mainClassName}</mainClass>
             </configuration>
         </plugin>

         <plugin>
             <groupId>com.gluonhq</groupId>
             <artifactId>gluonfx-maven-plugin</artifactId>
             <version>${gluonfx.plugin.version}</version>
             <configuration>
                 <target>${gluonfx.target}</target>
                 <attachList>
                     <list>display</list>
                     <list>lifecycle</list>
                     <list>statusbar</list>
                     <list>storage</list>
                     <list>push-notifications</list>
                     <list>pictures</list>
                     <list>keyboard</list>
                 </attachList>
                 <mainClass>${mainClassName}</mainClass>
             </configuration>
         </plugin>
     </plugins>
 </build>

 <profiles>
     <profile>
         <id>ios</id>
         <properties>
             <gluonfx.target>ios</gluonfx.target>
         </properties>
     </profile>
     <profile>
         <id>android</id>
         <properties>
             <gluonfx.target>android</gluonfx.target>
         </properties>
     </profile>
 </profiles>
</project>

I am aware that GluonFX is not the best tool to build mobile apps but up until now the experience has been pretty flawless. If anyone can help me it would be amazing, thank you in Advance

I tried adding multiple different repositories but nothing seems to be working.

Upvotes: 0

Views: 146

Answers (1)

John Williams
John Williams

Reputation: 5430

The dependency com.google.firebase:firebase-messaging:24.0.0 is an aar file, not a jar file (default for maven). You need to add the type aar to the dependency as follows:

<dependency>
     <groupId>com.google.firebase</groupId>
     <artifactId>firebase-messaging</artifactId>
     <type>aar</type>
     <version>24.0.0</version>
 </dependency>

I don't have your entire pom but the repository definition for https://maven.google.com/ is not needed for com.google.firebase:firebase-messaging. It's in Maven Central.

Upvotes: 0

Related Questions