Cannot deploy the gradle ear project with webmodule using overlay in STS or Eclipse


(Thota) #1

While deploying the project in application server through STS or Eclipse the files from the overlay/shared resources web project are not deployed to workspace. The application is starting but it is throwing error stating the files are missing, which are part of the overlay project. Below are the Project structure and build.gradle files. Please advise.

Project structure:

|- test-app

    - test-app-ear

    - test-app-web
|- test-app-web-overlay

Ear project - build.gradle

apply plugin: 'ear'
apply plugin: 'eclipse-wtp'

dependencies {
  deploy project(path: ':test-app-web', configuration: 'archives')
}

eclipse {
	wtp {
	   facet {
		facet name:'jst.ear', version:'6.0'
	   }
	}
}


ear {
  archiveName = 'test-app.ear'	
  deploymentDescriptor {
  displayName = 'test-app'	
  webModule("test-app-web", "/test-app-web") }
}

War project - build.gradle

apply plugin: 'war'
apply plugin: 'eclipse-wtp'

configurations {
  testAppOverlay
}

jar.enabled = true
description = 'test-app-web'


eclipse {
  wtp {
	facet {
	  facet name: 'java', version: '1.6'
	  facet name: 'jst.web', version: '3.0'
	  facet name: 'wst.jsdt.web', version:'1.0'
	}
	}
  }


dependencies {
  compile project(':test-app-beans')
  runtime testAppOverlay (group: 'com.mycom.common.framework.sso', name: 'test-app-web-overlay', version:'1.1'){ transitive = false }
}

war {
  archiveName = project.name + ".war"

  from(zipTree(configurations.testAppOverlay.singleFile)) {
	duplicatesStrategy 'exclude'
  }
  into("/")
}

War overlay project - build.gradle
Please note that this war name is saved as jar in order to add as a dependency to the above web module.

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'war'
jar.enabled = false

group = 'com.mycom.common.framework.sso'
version = '1.0.1'

description = """test-app-web-overlay"""


war {
	archiveName = project.name + "-" + project.version + ".jar"
}