Skip to content

julian-alarcon/simplesum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple java library to sum to numbers

Simple test to create a Java Library and upload it to Maven Central.

It adds two integer numbers

package simplesum;

public class Simplesum {
    public static int add(int a, int b){
        return a+b;
    }
}

Requirements

  • Java version: 11
  • Maven version: 3.8.3

Steps

To create the Java package run this command (-X option is optional to show the Debug output):

mvn package -X

Then install it to your Maven local repository (by default it's located in ~/.m2/repository

mvn install:install-file -Dfile=target/simplesum-1.0.jar -DpomFile=pom.xml -Dpackaging=jar -DcreateChecksum=true

Sample Java code

Below is a simple java code (8+9) and the pom.xml fragment that calls the library:

import simplesum.Simplesum;

public class Main {
    public static void main(String[] args) {
        System.out.println(Simplesum.add(8, 9));
    }
}

pom.xml fragment:

.
.
.
<dependencies>
    <dependency>
        <groupId>io.github.julian-alarcon</groupId>
        <artifactId>simplesum</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>
.
.
.

References

About

Simple Library build using Maven as a demo/test to upload to Maven Central

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages