Ignoring Files and Folders

Liferay Cloud allows subscribers to determine which files and folders should be ignored before deploying a service. This is done by creating a .lcpignore file and placed inside the top level of the project folder (for example: /etc/lfrlearn/ where lfrlearn is the project name). By placing the file here, the ignore rules can be shared with other users.

Using the .lcpignore File

  1. Navigate to the location of the project folder.
  2. Create a file called .lcpignore.
  3. Modify the file accordingly.
  4. Run lcp deploy on a terminal to deploy your service with the new .lcpignore rules.

LCP Ignore Patterns

The .lcpignore file uses globbing patterns to match against file names. (These are the same patterns used in a .gitignore file.) Administrators can construct such patterns using various symbols:

PatternExample matchesExplanation*
**/serviceservice/file.txt, or, service/monday/foo.bar, or build/service/file.txtPrepending a pattern with a double asterisk matches folders anywhere in the repository.
**/service/file.txtservice/file.txt; or build/service/file.txt but not service/build/file.txtUsing a double asterisk matches files based on their name and the name of their parent folder.
*.txtfile.txt, foo.txt, .txt, or, service/file.txtAn asterisk is a wildcard that matches zero or more characters.
*.txt or !important.txtfile.txt, trace.txt but not important.txt, service/important.txtPrepending an exclamation mark to a pattern negates it. If a file matches a pattern, but also matches a negating pattern defined later in the file, it will not be ignored.
*.txt or !important/*.txt or trace.*file.txt important/trace.txt but not important/file.txtPatterns defined after a negating pattern ignores any previously negated files.
/file.txtfile.txt, but not service/file.txtPrepending a slash matches files only in the repository root.
file.txtfile.txt, or service/file.txtBy default, patterns match files in any folder
file?.txtfileo.txt, files.txt but not file10.txtUsing a question mark matches exactly one character.
file[0-9].txtfile0.txt, file1.txt, but not file10.txtUsing square brackets matches a single character from a specified range.
file[01].txtfile0.txt, file1.txt, but not file2.txt nor file01.txtUsing square brackets matches a single character from the specified set.
file[!01].txtfile2.txt, but not file0.txt, nor file1.txt, nor file01.txtUsing an exclamation mark matches any character except one from the specified set.
file[a-z].txtfilea.txt, fileb.txt, but not file1.txtRanges can be numeric or alphabetic.
txtstxts, txt/file.txt, txts/latest/foo.bar, build/txts, build/txts/file.txtIf a slash is not appended, the pattern will match both files and the contents of folders with that name. In the example matches on the left, both folders and files named txts are ignored.
txts/txts/file.txt, txts/latest/foo.bar, build/txts/foo.bar, build/txts/latest/file.txtAppending a slash indicates the pattern is a folder. The entire contents of any folder in the repository matching that name – including all of its files and subfolders – will be ignored.
txts/**/file.txttxts/file.txt, txts/monday/file.txt, or txts/monday/pm/file.txtA double asterisk matches zero or more folders.
txts/*day/file.txttxts/monday/file.txt or txts/tuesday/file.txt, but not txts/latest/file.txtWildcards can be used in folder names as well.
txts/file.txttxts/file.txt, but not file.txt build/txts/file.txtPatterns specifying a file in a particular folder are relative to the repository root. Note that prepending a slash has no effect.

As best practice, keep the .lcpignore file in the top level folder of your project. If your repository has multiple .lcpignore files (not recommended), Liferay Cloud will read them as a unified document.

note

If a file or folder has been deployed and administrators want to ignore it later, Liferay Cloud will not ignore the file if a subsequent rule tries to include that file or folder. Rather, that file or folder will not be updated.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy