Search code examples
javaspringmavensms-gateway

Missing artifact com.msg91.sendotp in maven


When i am adding library in spring tool suits i am getting this error:

'Missing artifact com.msg91.sendotp.library:library:jar:3.2'

I have added this library in my pom.xml https://mvnrepository.com/artifact/com.msg91.sendotp.library/library/3.2

This is my 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 http://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.1.6.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>springdemouser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springdemouser</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>

    <!-- HERE I AM GETTING ERROR -->
    <dependency>
        <groupId>com.msg91.sendotp.library</groupId>
        <artifactId>library</artifactId>
        <version>3.2</version>      
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>


<!-- other dependencies here... -->

</dependencies>

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


Solution

  • I could see couple of things missing in the pom.xml as mentioned below

    1. If you look at the mvnrepository link for this library it states this artifact it located at JCenter repository. Since you have not shared the complete pom.xml file it is not clear if JCenter repo has been added. Simple way is to include below in pom.xml file
    <repositories>
        <repository>
          <id>jcenter</id>
          <name>jcenter</name>
          <url>https://jcenter.bintray.com</url>
        </repository>
    </repositories>
    
    1. you need to add <type> as aar to your maven dependency else it will try to search for .jar file which is not present in the repository
      <!-- https://mvnrepository.com/artifact/com.msg91.sendotp.library/library -->
    <dependency>
        <groupId>com.msg91.sendotp.library</groupId>
        <artifactId>library</artifactId>
        <version>3.2</version>
        <type>aar</type>
    </dependency>
    

    enter image description here