tomcat - How to include external files in WAR - java.io.FileNotFoundException -


i'm deploying grails-application (2.3.5) on tomcat (7.0.53) server , deployment without problems. when click on test controller (which uses files in src/data folder), error:

error 500: internal server error uri     /schedulingapi-0.1/tests class    java.io.filenotfoundexception message    /home/student/apache-tomcat-7.0.53/bin/src/data/room 

i know war looks @ tomcat directory whereas should in war itself. tried add src/data folder (properties > add class folder) build path before creating war didn't solve problem.

the grails documentation on deployment talks this. 2 configuration options available grails.war.copytowebapp , grails.war.resources. first of these lets customise files included in war file "web-app" directory. second lets processing want before war file created.

buildconfig.groovy

// closure passed command line arguments used start // war process. grails.war.copytowebapp = { args ->     fileset(dir:"web-app") {         include(name: "js/**")         include(name: "css/**")         include(name: "web-inf/**")     } } // closure passed location of staging directory // zipped make war file, , command line arguments. // here override standard web.xml our own. grails.war.resources = { stagingdir, args ->     copy(file: "grails-app/conf/custom-web.xml",          tofile: "${stagingdir}/web-inf/web.xml") } 

in case may consider custom grails.war.resources command such this:

grails.war.resources = { stagingdir, args ->     copy(file: "src/bin/**",          tofile: "${stagingdir}/bin") } 

all of of course depends on path intend package additional resources in.

update in later versions of antbuilder include multiple files preferred method use fileset instead of ** notation:

grails.war.resources = { stagingdir, args ->     copy(todir: "${stagingdir}/bin") {         fileset(dir: "src/bin")     } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -