The <packaging> will cause by the build failed. I mean it would working fine for building WAR file but not for building EAR file. Now I have knew the root cause, changing to ear in <packaging> line but I'm still not satisfied with the final output. Because I have a special requirement to this EAR file not to contain all other libraries except the custom build library. Now the EAR file has mess up all others libraries in it, this could a disaster when I deploy to WebSphere Application Server.
4.0.0 org.huahsin MyWebService 0.0.1-SNAPSHOT war MyWebService ... ... org.huahsin MyWebService 0.0.1-SNAPSHOT war ... ... org.apache.maven.plugins maven-ear-plugin 2.9.1 7 org.huahsin MyWebService MyWebService.war MyWebService
To make it clean, I create another pom.xml that only perform one task, which is EAR packaging. And this pom.xml contain only one dependency which is my newly created WAR. To make the picture clear, the WAR file should contain all only the libraries, whereas EAR file should contain only the WAR file. This is the primary objective of having a separate pom.xml, following code snippet worth thousand of these nonsense.
Now I have another question, how could I fit 2 pom.xml in one project? I don't know??? I just put them somewhere as long as there wouldn't crash each other in the project. Am I doing this in the right approach?
4.0.0 org.huahsin MyWebServiceEar 0.0.1-SNAPSHOT ear MyWebServiceEar org.huahsin MyWebService 0.0.1-SNAPSHOT war org.apache.maven.plugins maven-ear-plugin 2.9.1 7 org.huahsin MyWebService MyWebService.war MyWebService