Java library management with Maven and Gradle

In the last blog, I showed you some of the cases that uses the library in the Central Repository with Maven.  In the following test cases, I show you how the library can be incorporated into your project by using Maven (ComplexMaven) and Gradle (ComplexGradle).  The projects uses the library called Complex.  Complex is available from the Central Repository.  Maven and Gradle use different configuration files for library dependency.

In case with Maven, the library dependency is in the pom.xml file (POM file).  The file format goes as folllows:

 
        <dependency>
            <groupId>com.github.easai.math</groupId>
            <artifactId>Complex</artifactId>
            <version>0.0.1</version>
        </dependency>


If you are using Gradle, the configuration should be in the build.gradle file.

 
 compile group: 'com.github.easai.math', name: 'Complex', version:'0.0.1'


Now you can instantiate the Complex class.

 
 import com.github.easai.math.Complex;
...
    Complex c=new Complex(1.0,1.0);


You can download the entire projects from GitHub (ComplexMaven, ComplexGradle).

Comments

Popular posts from this blog

Logging your Maven project with Logback

TreeEditor: Customizing Drag and Drop

Spring Tool Suite