I am having difficulty with the Gradle deployment procedure and need some clarification and assistance.
Local Development Environment:
CUBA Platform version: 7.2.10
CUBA Studio plugin version: 15.1-202
IntelliJ version: CUBA Studio 2020.2
Datebase: MySQL 8.0.19
Operating System: macOS Big Sur 11.2 (20D64)
Browser: Safari 14.0.3 (16610.4.3.1.4)
Hardware: iMac (Retina 5K, 27-inch, 2020)
Graphics: AMD Radeon Pro 5700 8 GB
File System: Case-Sensitive Journaled HFS+ (APFS)
Use Case: I need to copy several static HTML and PDF files into the “deploy” directory tree, so that I can display them in a BrowserFrame fragment.
Source Path: /modules/web/src/com/company/demo/html
Destination Path: /deploy/app_home/app/conf/com/company/demo/html
(Note: I have tried other Source Paths without success.)
This is my very first time modifying a CUBA build.gradle file, so I decided to try and explicitly code my own primitive task named “deployStaticWebResources” (class StaticWebResourcesTask extends DefaultTask) and not modify the other tasks except for a few dependencies.
Problem: If I run the “deployment->deploy” task by itself in CUBA Studio it works as expected; my destination directory tree is created and my two test files are copied into the destination directory. My “println” output is also displayed in the order that I expect it….
Task :app-web:assemble UP-TO-DATE
Deploy HTML resources - SRC dir: /Users/bhc/Development/Projects/CUBA/src/examples/anonymous-screens-access/modules/web/src/com/company/demo/html
Deploy HTML resources - DES dir: /Users/bhc/Development/Projects/CUBA/src/examples/anonymous-screens-access/deploy/app_home/app/conf/com/company/demo/html
However, if I run the entire “CUBA Application” build and run/debug task in CUBA Studio I see my “println” output but I also see the “deploy/app_home/app/conf/com” directory of my destination being created but then “com” and everything below it is immediately deleted during this procedure. My new directories and files are gone.
What task is deleting my directories and why? What am I missing or doing wrong?
If I enter the following commands in the CUBA Studio terminal, then my destination directories are created and the files are copied and everything is still there after I start the application:
sh gradlew build
sh gradlew deploy
sh gradlew start
Please note that I also tried the suggestion found here: Add files to conf directory from IntelliJ - CUBA.Platform but I could not get it to work either.
Could someone please explain what is happening here and make a suggestion how I can avoid it. Here is my demo project: anonymous-screens-access.zip (96.6 KB)
Many thanks in advance!