0

My application is running on localhost successfully ,but When I deploy my application on AWS server ,it is unable to run online. I have an external JAR of paytm-checksum-2.0 . What should I do for deployment of my Spring Boot application with external JAR? I have converted into my application to one jar file but I am unable to deploy it...

File pom.xml is

<?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.3.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>Spring-payment-integration</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Spring-payment-integration</name>
    <description>Payment integration with paytm</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

1 Answers1

0

I do not see see this custom jar in your pom.xml, you might have added it to your IDE configurations(or any other method which only works locally) so although it might work locally on remote this jar won't be present and you won't be able to reference it. From what I see this is the official jar: https://github.com/Paytm-Payments/Paytm_Web_Sample_Kit_Java/tree/master/Java%20Kit%201.8

However, it does not seem to be there on the paytm artifacts hosted on maven: https://mvnrepository.com/artifact/com.paytm. So you have 2 options now:

  1. Add the jar to a nexus repo, or to a public repo(like maven) and reference it from there, this is quite complicated(https://www.baeldung.com/install-local-jar-with-maven/)

  2. You can package this custom jar with your springboot jar.

a. Add it to your project location.<file>${basedir}/dependencies/PaytmChecksum.jar</file>

b. Now add this to your pom

<build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-Transformation lib</id>
                        <phase>clean</phase>
                        <configuration>
                            <file>${basedir}/dependencies/PaytmChecksum.jar</file>
                            <repositoryLayout>default</repositoryLayout>
                            <groupId>org.paytm</groupId>
                            <artifactId>paytmchecksum</artifactId>
                            <version>1.0</version>
                            <packaging>jar</packaging>
                            <generatePom>true</generatePom>
                        </configuration>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

c. Clean the project mvn clean

d. Now reference the file using

<dependency>
    <groupId>org.paytm</groupId>
    <artifactId>paytmchecksum</artifactId>
    <version>1.0</version>
</dependency>

e. build it using mvn clean install The packaged jar will now contain your Paytm jar.

srinivas kumar
  • 373
  • 2
  • 8