The gradle tasks also provide much more granularity in cleaning. Generally, for each task that produces an artifact, we try to have a corresponding cleaning task that removes that artifact. This leads to a plethora of cleaning tasks, but there are only a few that you will probably ever want to use.
In this topic we summarize the most commonly useful cleaning tasks, indicating what the outcome of each task is and providing examples of when you might use each.
This table summarizes the commands used to create and remove the various directories. Note that the cleaning behavior reflected here is accurate as of version 1.2 of the gradlePlguins.
Directory Type | Path (relative to <LABKEY_HOME>) | Added to by... | Removed from by... | Deleted by... |
---|---|---|---|---|
Source | server/modules/<module> | you | you | you |
JavaScript Dependencies | server/modules/<module>/node_modules | :server:modules:<module>:deployModule :server:modules:<module>:npmInstall npm install | N/A | :server:modules:<module>:cleanNodeModules cleanNodeModules |
Build | build | Any build step | Any cleaning step | cleanBuild |
Module build | build/modules/<module> | module | N/A | :server:modules:<module>:clean |
Staging | build/staging | :server:deployApp :server:modules:<module>:deployModule | :server:modules:<module>:undeployModule | :server:cleanStaging :server:cleanDeploy |
Deploy | build/deploy | :server:deployApp :server:modules:<module>:deployModule | :server:modules:<module>:undeployModule | :server:cleanDeploy |
Running 'gradlew cleanDeploy' removes the build/deploy directory. This will also stop the tomcat server if it is running.
Result:
Running 'gradlew cleanStaging' removes the build/staging directory. This does not affect the running server.
Result:
Running 'gradlew cleanBuild' removes the build directory entirely, requiring all of the build steps to be run again. This will also stop the tomcat server if it is running. This is the big hammer that you should avoid using unless there seems to be no other way out.
This is generally not what you want or need to do since Gradle's up-to-date checks should be able to determine when things need to be rebuilt. The one exception to this rule is that when the LabKey version number is incremented with each monthly release, you need to do a cleanBuild to get rid of all artifacts with the previous release version in their names.
Result:
The most important tasks for cleaning modules follow. The example module name used here is "MyModule".
Removes the build directory for the module. This task comes from the standard Gradle lifecycle, and is generally followed by a deployModule or deployApp command.
Result:
Removes all artifacts for this module from the staging and deploy directories. This is the opposite of deployModule. deployModule copies artifacts from the build directories into the staging (LABKEY_HOME/build/staging) and then the deployment (LABKEY_HOME/build/deploy) directories, so undeployModule removes the artifacts for this module from the staging and deployment directories. This will cause a restart of a running server since Tomcat will recognize that the deployment directory is changed.
Result:
Removes the build directory for the module as well as all artifacts for this module from the staging and deploy directories. Use this to remove all evidence of your having built a module. Combines undeployModule and clean to remove the build, staging and deployment directories for a module.
Result: