Jenkins - create a tar.gz from various ear and deliver it on a distant server - maven

I have a maven build which produces a target/myModule.ear for each module it builds.
I want to create a Jenkins job which :
1) Build the project with a "mvn clean install"
2) Archive all the ear into a tar.gz
3) Deliver this tar.gz on a distant server
I am very new to Jenkins so I don't know how to do 2) and 3). The only solution I can come up with is to create a script, but if I do that there is no point in using Jenkins.

You need a parent project which has a war/jar and an ear project to wrap the war, then a distribution project to assemble the tar.gz.
parent looks like:
<?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>com.greg</groupId>
<artifactId>ear-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<myproject.version>1.0-SNAPSHOT</myproject.version>
</properties>
<name>ear-example</name>
<modules>
<module>example-ear</module>
<module>example-war</module>
<module>distribution</module>
</modules>
</project>
ear project has dependency to the war project and looks like:
<?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>com.greg</groupId>
<artifactId>ear-example</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>example-ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.greg</groupId>
<artifactId>example-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<modules>
<webModule>
<groupId>com.greg</groupId>
<artifactId>example-war</artifactId>
<contextRoot>/appname</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
The distribution project looks like this:
<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.greg</groupId>
<artifactId>ear-example</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>distribution</artifactId>
<packaging>pom</packaging>
<name>Distribution</name>
<dependencies>
<dependency>
<groupId>com.greg</groupId>
<artifactId>example-ear</artifactId>
<version>${project.version}</version>
<type>ear</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The assembly.xml which builds the zip looks like:
<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>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<binaries>
<outputDirectory>modules/maven-assembly-plugin</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
The deployment you will have to do yourself

Related

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)]

Merge two maven modules in one jar and have third module generate jar at specified location

I have been trying this now for 5 hours and not sure what am I missing.
I have following
+- parent
pom.xml
+- core-module
pom.xml
+- excel-module
pom.xml
+- client-module
pom.xml
+- assembly-module
pom.xml
I want to create one core.jar file for core-module and excel-module ( which I have achieved already) assembly-module/target/dist/server/core.jar
I want to create separate client.jar file at assembly-module/target/dist/client/client.jar
Following are my pom files.
core/pom.xml
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.test.project</groupId>
<artifactId>parent</artifactId>
<version>1.0.0.0-SNAPSHOT</version>
</parent>
<artifactId>core</artifactId>
<dependencies>
<dependency>
<groupId>com.test.project</groupId>
<artifactId>excel</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
excel/pom.xml
<?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.0http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>com.test.project</groupId>
<version>1.0.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>excel</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</project>
client/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>com.test.project</groupId>
<version>1.0.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client</artifactId>
<packaging>jar</packaging>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Build-Version>${project.version}</Build-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.test.project</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>>
</dependency>
</dependencies>
assembly/pom.xml
<?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">
<parent>
<artifactId>parent</artifactId>
<groupId>com.test.project</groupId>
<version>1.0.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>assembly</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly- descriptor.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}/target/dist/server/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>core</finalName>
</build>
<dependencies>
<dependency>
<groupId>com.test.project</groupId>
<artifactId>excel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.test.project</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
assembly/descriptor.xml
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>all-jar</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<useTransitiveDependencies>false</useTransitiveDependencies>
</dependencySet>
</dependencySets>
</assembly>
in what way I need to update assembly.xml and/or descriptor.xml to achieve 2nd point. I have look almost all related posts here on SO
Any help is greatly appreciated.
EDIT
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>core-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/core-assembly-descriptor.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}/target/dist/framework/lib/server/</outputDirectory>
<finalName>core.jar</finalName>
</configuration>
</execution>
<execution>
<id>client-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/client-descriptor.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}/target/dist/framework/runtime/</outputDirectory>
<finalName>client.jar</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
I would actually try to add another execution tag in the assembly/pom.xml as below:
<execution>
<id>assembly-client</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/client-assembly-descriptor.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>${project.basedir}/target/dist/client/</outputDirectory>
</configuration>
</execution>
And add a new assembly descriptor file (client-assembly-descriptor.xml) as below:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>all-jar</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
<include>com.test.project:client</include>
</includes>
</dependencySet>
You will need to add the client jar as a dependency too in the assembly project.

Multiple maven web application

This is the structure:
simple-project(pom)
simple-common(jar)
simple-web(war) -->(depend on) simple-common
Now once I run maven-tomcat7-plugin in simple-web with goal tomcat7:run, it told me that it can not find xxxx-simple-common-1.0.jar.
While I have ran the mvn install inside simple-common to install it to my local repository, and I can find the jar in my local maven repository directory.
Do I miss anything?
Update POMs:
simple-project(pom.xml):
<?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>test</groupId>
<artifactId>simple-project</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>simple-web</module>
<module>simple-common</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<javax.version>1.7</javax.version>
</properties>
<dependencyManagement>
<dependencies>
....
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>when-package</id>
<activation>
<property>
<name>p</name>
<value>true</value>
</property>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>application.properties</exclude>
<exclude>logback.xml</exclude>
</excludes>
</resource>
</resources>
</build>
</profile>
</profiles>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>proxy</id>
<url>http://192.168.1.96:8888/nexus/content/groups/public//</url>
</repository>
</repositories>
</project>
simple-common(pom.xml):
<?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>simple-project</artifactId>
<groupId>test</groupId>
<version>1.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>simple-common</artifactId>
</project>
simple-web(pom.xml):
<?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>test</groupId>
<artifactId>simple-project</artifactId>
<version>1.0</version>
</parent>
<artifactId>simple-web</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>simple-common</artifactId>
<version>${project.version}</version>
</dependency>
....
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>win</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/win.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8080</port>
<path>/web</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
For guys who meet the same problem, I found "Install the parent project" is necessary.
Which means install simple-common is not enough, you may have to install simple-project as well, then you can run tomcat:run plugin in the simple-web module.
While I suspect with this logic, when I tried to run tomcat:run which means I am DEBUGGING this module, it is not stable yet, but I HAVE to install a un-stable artifact to repository before I can debug. This logic seems strange

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