I use an application server function that allows me to deploy resources and classes directly from Gradle output folders and static files from source folders. I donβt want to waste time packing EAR , WAR or JAR , and I want to use HotSwap functions without redistributing them.
Let me demonstrate the idea using a simple Gradle and Tomcat 7 project.
Suppose we have a folder with the following structure:
.
|
`
|
| `
|
| `
`
`
4 directories, 4 files
I am creating a simple Gradle project:
build.gradle
apply plugin: 'war'
war {
destinationDir temporaryDir
into 'META-INF/resources', {
from 'src/html/index.html'
}
into 'META-INF/resources/static', {
from 'src/css'
}
into 'META-INF/resources/static', {
from 'src/images'
}
}
Then it would be great to be able to automatically create the following configuration:
$ CATALINA_HOME / Catalina / local / myApp.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="">
<Resources className="org.apache.naming.resources.VirtualDirContext" extraResourcePaths="
/META-INF/resources/index.html=C:/myapp/src/html/index.html,
/META-INF/resources/static=C:/myapp/src/css,
/META-INF/resources/static=C:/myapp/src/images
"/>
</Context>
, ( ), :
/META-INF/resources/index.html=C:/myapp/src/html/index.html
/META-INF/resources/static/main.css=C:/myapp/src/css/main.css,
/META-INF/resources/static/logo.png=C:/myapp/src/images/logo.png
, .
1
issue Gradle github
2
, - , . java.
- CopySpec . CopySpec ( CopySpec), , .