StormeHawke
2012-05-30 16:07:14 UTC
Hi. I've got two questions that are closely related.
One: I'm currently using the following to copy a spring datasource xml file
into WEB-INF as a dependency of the war task:
[code]
task copyDatasource(type: Copy) {//copy our <datasource>.xml into
dpu-datasource.xml
from('datasource/')
into('src/main/webapp/WEB-INF/')
include(datasource + '.xml')
rename(datasource + '.xml', 'dpu-datasource.xml')
}
[/code]
This can be kind of annoying as it leaves the copied file in the WEB-INF dir
after the build, and can cause us to have bad builds if we have typo in the
-Pdatasource=filename when we invoke the build. Is there a way to
dynamically grab the file and directly insert it into the war at build time
without copying it to WEB-INF, such as this that we use for our jar files:
[code]
processResources {
from('/datasource') {
include(datasource + '.xml')
rename(datasource + '.xml', 'intellistat-datasource.xml')
}
}
[/code]
?
On a closely related note, gradle continues to run quietly if the file
called for doesn't exist. I don't know the reason for this, but it
certainly is unexpected behavior considering that if you try to copy a file
in JAVA that doesn't exist you get a big ugly FileNotFoundException. Which
is what we want and expect - If we have a typo, I don't want to accidentally
get a war file that is missing this crucial file (or, as is currently the
case using the above copyDatasource method, the previous build's leftover
file) - makes for annoying duplicate rebuild/reupload to server cycles. Is
this a gradle bug, or is this some kind of deliberate behavior? How do we
get around it?
Suggestions?
--
View this message in context: http://gradle.1045684.n5.nabble.com/Copy-file-into-WEB-INF-fail-if-not-exists-tp5709846.html
Sent from the gradle-user mailing list archive at Nabble.com.
One: I'm currently using the following to copy a spring datasource xml file
into WEB-INF as a dependency of the war task:
[code]
task copyDatasource(type: Copy) {//copy our <datasource>.xml into
dpu-datasource.xml
from('datasource/')
into('src/main/webapp/WEB-INF/')
include(datasource + '.xml')
rename(datasource + '.xml', 'dpu-datasource.xml')
}
[/code]
This can be kind of annoying as it leaves the copied file in the WEB-INF dir
after the build, and can cause us to have bad builds if we have typo in the
-Pdatasource=filename when we invoke the build. Is there a way to
dynamically grab the file and directly insert it into the war at build time
without copying it to WEB-INF, such as this that we use for our jar files:
[code]
processResources {
from('/datasource') {
include(datasource + '.xml')
rename(datasource + '.xml', 'intellistat-datasource.xml')
}
}
[/code]
?
On a closely related note, gradle continues to run quietly if the file
called for doesn't exist. I don't know the reason for this, but it
certainly is unexpected behavior considering that if you try to copy a file
in JAVA that doesn't exist you get a big ugly FileNotFoundException. Which
is what we want and expect - If we have a typo, I don't want to accidentally
get a war file that is missing this crucial file (or, as is currently the
case using the above copyDatasource method, the previous build's leftover
file) - makes for annoying duplicate rebuild/reupload to server cycles. Is
this a gradle bug, or is this some kind of deliberate behavior? How do we
get around it?
Suggestions?
--
View this message in context: http://gradle.1045684.n5.nabble.com/Copy-file-into-WEB-INF-fail-if-not-exists-tp5709846.html
Sent from the gradle-user mailing list archive at Nabble.com.