Create JAR file as Aggregation in maven multi module package - maven

I have following architecture
Now if i am creating parent child relationship and building child first and parent end it will working fine
<packaging>jar</packaging>
Requirements :
I need packaging with following features :
Command run on parent project "A" - mvn clean install package etc
First create Jar "B" ,"C","D"
then create Jar "A"
then add "B","C","D" jar inside Jar A
When i am adding modules
<modules>
<module>../B</module>
<module>../C</module>
<module>../D</module>
</modules>
then maven force to add
<packaging>pom</packaging>
insted of
<packaging>jar</packaging>
Issue :
When i am adding packaging pom so jar "A" is not crearing
SO i have tried to create one super pom
POM Super :
<packaging>pom</packaging>
<modules>
<module>../A</module>
</modules>
POM A:
<parent>
<groupId>com.khan.vaquar</groupId>
<artifactId>Super</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath/>
</parent>
<packaging>pom</packaging>
<modules>
<module>../B</module>
<module>../C</module>
<module>../D</module>
</modules>
<dependencies>
<!-- B -->
<dependency>
<groupId>com.khan.vaquar</groupId>
<artifactId>B</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- C -->
<dependency>
<groupId>com.khan.vaquar</groupId>
<artifactId>C</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- D-->
<dependency>
<groupId>com.khan.vaquar</groupId>
<artifactId>D</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
POM B:
<packaging>jar</packaging>
<parent>
<groupId>com.khan.vaquar</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath/>
</parent>
POM C:
<packaging>jar</packaging>
<parent>
<groupId>com.khan.vaquar</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
POM D:
<packaging>jar</packaging>
<parent>
<groupId>com.khan.vaquar</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath/>
</parent>
Problem : maven not allow to add jar if we are adding module , so how can i add child jar into parent jar and create build .

To create fat jar from multiple modules you can use maven-shade-plugin in A project
as
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>create-fat-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.nk.test.Application</mainClass>
</transformer>
</transformers>
<finalName>A</finalName>
</configuration>
</execution>
</executions>
</plugin>
For your example you can create structure as
parent module
<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.nk.test</groupId>
<artifactId>P</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../C</module>
<module>../B</module>
<module>../A</module>
</modules>
</project>
Core project A with maven-shade-plugin and project B & C as dependencies
<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.nk.test</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<artifactId>B</artifactId>
<version>0.0.1-SNAPSHOT</version>
<groupId>com.nk.test</groupId>
</dependency>
<dependency>
<artifactId>C</artifactId>
<version>0.0.1-SNAPSHOT</version>
<groupId>com.nk.test</groupId>
</dependency>
</dependencies>
<build>
<plugins>
**<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>create-fat-jar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.nk.test.Application</mainClass>
</transformer>
</transformers>
<finalName>A</finalName>
</configuration>
</execution>
</executions>
</plugin>**
</plugins>
</build>
</project>
Dependency module B
<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.nk.test</groupId>
<artifactId>B</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>
Dependenc Module C
<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.nk.test</groupId>
<artifactId>C</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>
run maven install on parent project.
This will result in Fat jar named named A.jar with B and C as dependencies inside it.
you can find example at : https://github.com/nomanbplmp/maven-multimodule-fat-jar

Related

Multi module web application maven architecture with Spring boot

I'm building a web application that contains several modules and I want to split each of these modules to a single project. This is the first time I'm trying to do such thing, I used to make the application in one project and I don't want to start the development with a wrong architecture.
What I want to do:
--Maven parent project
-- main app: Spring boot, Database connection, authentication, user management.
-- Module 1,2 .. n: modules, repositories, controllers
So the idea is splitting the project by functionality on the use case perspective. The question is: can this architecture work without problems and how can I configure it with maven?
You need something like this:
1) have a parent pom that holds it all together, this is your parent that has a parent of spring-boot:
<?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>1.4.3.RELEASE</version>
</parent>
<groupId>com.essexboy</groupId>
<artifactId>boot-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>boot-library</module>
<module>boot-web</module>
</modules>
</project>
2) have as many library modules as you wish:
<?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>
<artifactId>boot-parent</artifactId>
<groupId>com.essexboy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>boot-library</artifactId>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
3) Then have as many spring boot modules as you wish that will pull in the required libraries from the same project:
<?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>
<artifactId>boot-parent</artifactId>
<groupId>com.essexboy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>boot-web</artifactId>
<dependencies>
<dependency>
<groupId>com.essexboy</groupId>
<artifactId>boot-library</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- tag::actuator[] -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- end::actuator[] -->
<!-- tag::tests[] -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- end::tests[] -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

How to generate jar files of dependencies from maven project multi-module and spring boot

I have
project A (parent)
pom.xml
project B
pom.xml
project C
pom.xml
project D
pom.xml contains (dependencies B and C)
when I build project D, I have not B.jar and C.jar. I have 2 folders named B and C.
I need B.jar and C.jar. Please, how to do that?
<?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>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ticket</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-parent </artifactId>
<version> 2.1.2.RELEASE </version>
</parent>
<!-- Ajouter des dépendances typiques pour une application Web -->
<dependencies>
<dependency>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-web </artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Le package est un fichier jar exécutable -->
<build>
<plugins>
<plugin>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-maven-plugin </artifactId>
</plugin >
</plugins>
</build>
<modules>
<module>ticket-consumer</module>
<module>ticket-provider</module>
<module>ticket-business</module>
<module>ticket-webapp</module>
<module>ticket-model</module>
<module>ticket-technical</module>
</modules>
</project>
the code above is the parent.
<!-- begin snippet: js hide: false console: true babel: false -->
This code has many dependencies. but, the build of this project don't generate jar files.
this child with dependencies:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-webapp</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ticket-webapp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-provider</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-model</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-maven-plugin </artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
org.exemple.demo.App
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin >
</plugins>
</build>
</project>

JAR library in WAR module not seen

I have Maven project with WAR and EAR module. EAR module has WAR as a dependency and is included as a war module in maven-ear-plugin. There's also JAR library added in EAR module and is used by WAR module.
EAR module pom.xml:
<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.example</groupId>
<artifactId>MyApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>MyEar</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>MyWar</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>MyJar</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9</version>
<configuration>
<modules>
<jarModule>
<groupId>com.example</groupId>
<artifactId>MyJar</artifactId>
</jarModule>
<webModule>
<groupId>com.example</groupId>
<artifactId>MyWar</artifactId>
<contextRoot>/MyWebApp</contextRoot>
</webModule>
</modules>
<version>6</version>
</configuration>
</plugin>
</plugins>
</build>
</project>
And WAR module pom.xml:
<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.example</groupId>
<artifactId>MyApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>MyWar</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>MyJar</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
I'm trying to build EAR that includes MyWar and MyJar in root. The problem is that if I use EAR pom like the one above, MyJar library is not "seen" by MyWar.
What am I missing here?
The only modules that should be in the root of the EAR archive are ejb-jars, wars and rars.
Utility library jars should be placed in a "lib" directory within the EAR.
You just need to add one line to your EAR plugin configuration to accomplish this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9</version>
<configuration>
<modules>
<jarModule>
<groupId>com.example</groupId>
<artifactId>MyJar</artifactId>
</jarModule>
<webModule>
<groupId>com.example</groupId>
<artifactId>MyWar</artifactId>
<contextRoot>/MyWebApp</contextRoot>
</webModule>
</modules>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir> <--- this!
</configuration>
</plugin>
If you're going to be using EAR files you should familiarise yourself with the class visibility rules for the various modules within them. This is loosely summarised in My ear is not able to find ejb module classes.
In general you should not be using EAR files these days. In most cases a simple WAR file will be sufficient

Maven assembly plugin not loading dependency from local repository

I am trying to build a parent project containing several sub-modules and a "packaging" sub-module - exactly as described under https://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-binary-inclusion-simple.html
The sub-modules get built and installed in the local repository, but when the "packaging" sub-module gets built, maven complains about not being able to find one of the other sub-modules - instead it tries to download it from the Central Maven Nexus (where it can't find it, of course).
Anyone have an idea what I could be missing?
package/pom.xml:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>group</groupId>
<artifactId>parent</artifactId>
<version>CURRENT</version>
</parent>
<groupId>group</groupId>
<artifactId>package</artifactId>
<version>CURRENT</version>
<packaging>pom</packaging>
<name>package module</name>
<properties>
<project.reporting.outputEncoding>ISO-8859-15</project.reporting.outputEncoding>
<project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>common</artifactId>
<version>CURRENT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>metaserviceclient</artifactId>
<version>CURRENT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>hierarchyclient</artifactId>
<version>CURRENT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>package.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
package/package.xml
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>group:*</include>
</includes>
<binaries>
<includeDependencies>true</includeDependencies>
<unpack>false</unpack>
<outputDirectory>opt/lib</outputDirectory>
<outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
hierarchyclient/pom.xml
<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>group</groupId>
<artifactId>hierarchyclient</artifactId>
<name>Hierarchy client</name>
<parent>
<groupId>group</groupId>
<artifactId>parent</artifactId>
<version>CURRENT</version>
</parent>
<dependencies>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>common</artifactId>
<version>CURRENT</version>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
pom.xml
<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>
<artifactId>parent</artifactId>
<groupId>group</groupId>
<version>CURRENT</version>
<packaging>pom</packaging>
<modules>
<module>hierarchyclient</module>
<module>common</module>
<module>metaserviceclient</module>
<module>package</module> <!-- responsible for package preparation -->
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
<project.reporting.outputEncoding>ISO-8859-15</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
maven output:
[15:27:28][INFO] --- maven-install-plugin:2.3.1:install (default-install) # hierarchyclient ---
[15:27:28][INFO] Installing /opt/frisk/teamcity_prd1/work/ac40d96bc266d196/hierarchyclient/target/hierarchyclient-CURRENT.jar to /opt/frisk/home/friskpkg/.m2/repository/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.jar
[15:27:28][INFO] Installing /opt/frisk/teamcity_prd1/work/ac40d96bc266d196/hierarchyclient/pom.xml to /opt/frisk/home/friskpkg/.m2/repository/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom
and later
[15:27:31][group:package] Downloading: http://$REPOSITORY/nexus/content/groups/public/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom
[15:27:31][group:package] Downloading: http://repo.maven.apache.org/maven2/coba/frisk/legacy/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom
[15:27:31][group:package] Failed to execute goal on project package: Could not resolve dependencies for project group:package:pom:CURRENT: Failed to collect dependencies for [group:common:jar:CURRENT (compile), group:metaserviceclient:jar:CURRENT (compile), group:hierarchyclient:jar:CURRENT (compile), junit:junit:jar:4.12 (test)]

Maven Ear with two war files

I am trying to develop an application which will upon packaging will generate an "ear" file which will contain 2 war files. Folders for those war files are called "hello" and "bye" and are placed on the same level as of the parent pom that contains the info about the ear.
The pom's for hello and bye packages fine when i ran them individually. When i tried packaging this pom it says cannot find poms for both hello and bye.
Here is the content for the parent pom.
<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>MR</groupId>
<artifactId>MREAR</artifactId>
<packaging>ear</packaging>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>MR.hello</groupId>
<artifactId>hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>MR.bye</groupId>
<artifactId>bye</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<modules>
<webModule>
<groupId>MR.hello</groupId>
<artifactId>hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
</webModule>
<webModule>
<groupId>MR.bye</groupId>
<artifactId>bye</artifactId>
<version>0.0.1-SNAPSHOT</version>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>

Resources