Showing posts with label maven project. Show all posts
Showing posts with label maven project. Show all posts

Wednesday, 1 February 2017

Adding multiple modules in one project : eclipse


A project can consist multiple modules, where a module is a project with some dependency on each other.


Create a Parent project:  ( which behaves like parent to further maven modules)

File – New – Other – Maven Project
Check “Create a simple Project (Skip archetype selection)
Next
Group id : com.parent
Artifact id : parent
Packaging : POM ß
Finish

This is how pom.xml looks like

<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.parent</groupId>
  <artifactId>parent</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
</project>

Create a child / maven module:

File – New – Other – Maven Module
Check “Create a simple Project (Skip archetype selection)
Module Name: Child
Parent Project: Parent
Finish

This is how pom.xml looks like
<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>com.parent</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>child</artifactId>
</project>

Observations:

In child pom.xml:  observe that parent tag, which talks about who is my parent

Note: any dependencies declared in parent pom.xml are available to child pom.xml by default.

Testing:

GO to parent pom.xml file folder and say > mvn clean
Now two projects will be created.





Thursday, 21 April 2016

Git - Adding a project into gitHub.com

Do you want to move your project into git hub?

Pre requisites:
1.       Account in GitHub.com
2.       GitBash software ( Download here https://git-scm.com/download/win )
3.       Some project in local


Here are the steps.

1.       Create a Repository in gitHub.com
a.       Click on New Repository button

b.      Enter Repository name (EmptyMavenProject)and click on create button

c.       Copy ssh key for further use. ( Ex: https://github.com/kasthurikranthikumar/EmptyMavenProject.git)

2.       Commit project via GitBash

a.       Open Project folder in Explorer

b.      Right click and select Git bash



c.       $git init


d.      $git add *


e.      $git commit –m “my first commit”


f.        $git remote add origin https://github.com/kasthurikranthikumar/EmptyMavenProject.git


g.       $git push origin master

j.    Now, we can see project in github.com.


Do you want to download this project? here is it.
https://github.com/kasthurikranthikumar/EmptyMavenProject