protected void installLooseConfigEar ( MavenProject proj , LooseConfigData config ) throws Exception { LooseEarApplication looseEar = new LooseEarApplication ( proj , config ) ; looseEar . addSourceDir ( ) ; looseEar . addApplicationXmlFile ( ) ; Set < Artifact > artifacts = proj . getArtifacts ( ) ; log . debug ( "Number of compile dependencies for " + proj . getArtifactId ( ) + " : " + artifacts . size ( ) ) ; for ( Artifact artifact : artifacts ) { if ( "compile" . equals ( artifact . getScope ( ) ) || "runtime" . equals ( artifact . getScope ( ) ) ) { if ( ! isReactorMavenProject ( artifact ) ) { if ( looseEar . isEarSkinnyWars ( ) && "war" . equals ( artifact . getType ( ) ) ) { throw new MojoExecutionException ( "Unable to create loose configuration for the EAR application with skinnyWars package from " + artifact . getGroupId ( ) + ":" + artifact . getArtifactId ( ) + ":" + artifact . getVersion ( ) + ". Please set the looseApplication configuration parameter to false and try again." ) ; } looseEar . addModuleFromM2 ( resolveArtifact ( artifact ) ) ; } else { MavenProject dependencyProject = getReactorMavenProject ( artifact ) ; switch ( artifact . getType ( ) ) { case "jar" : looseEar . addJarModule ( dependencyProject ) ; break ; case "ejb" : looseEar . addEjbModule ( dependencyProject ) ; break ; case "war" : Element warArchive = looseEar . addWarModule ( dependencyProject , getWarSourceDirectory ( dependencyProject ) ) ; if ( looseEar . isEarSkinnyWars ( ) ) { // add embedded lib only if they are not a compile dependency in the ear // project. addSkinnyWarLib ( warArchive , dependencyProject , looseEar ) ; } else { addEmbeddedLib ( warArchive , dependencyProject , looseEar , "/WEB-INF/lib/" ) ; } break ; case "rar" : Element rarArchive = looseEar . addRarModule ( dependencyProject ) ; addEmbeddedLib ( rarArchive , dependencyProject , looseEar , "/" ) ; break ; default : // use the artifact from local .m2 repo looseEar . addModuleFromM2 ( resolveArtifact ( artifact ) ) ; break ; } } } } // add Manifest file File manifestFile = MavenProjectUtil . getManifestFile ( proj , "maven-ear-plugin" ) ; looseEar . addManifestFile ( manifestFile ) ; }
install ear project artifact using loose application configuration file