| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| package org.apache.jackrabbit.filevault.maven.packaging; |
| |
| import java.io.File; |
| import java.util.Set; |
| |
| import org.apache.maven.plugin.logging.Log; |
| import org.apache.maven.plugins.annotations.Parameter; |
| import org.apache.maven.shared.utils.io.DirectoryScanner; |
| |
| /** |
| * Commons ancestor for all mojos dealing with package source files and meta data files |
| */ |
| public abstract class AbstractSourceAndMetadataPackageMojo extends AbstractMetadataPackageMojo { |
| |
| /** |
| * The directory containing the content to be packaged up into the content |
| * package. |
| * |
| * This property is deprecated; use {@link #jcrRootSourceDirectory} instead. |
| */ |
| @Deprecated |
| @Parameter |
| private File builtContentDirectory; |
| |
| /** |
| * The directory that contains the jcr_root of the content. Multiple directories can be specified as a comma separated list, |
| * which will act as a search path and cause the plugin to look for the first existing directory. |
| */ |
| @Parameter(property = "vault.jcrRootSourceDirectory", required = true, defaultValue = "${project.basedir}/jcr_root," |
| + "${project.basedir}/src/main/jcr_root," + "${project.basedir}/src/main/content/jcr_root," |
| + "${project.basedir}/src/content/jcr_root," + "${project.build.outputDirectory}") |
| private File[] jcrRootSourceDirectory; |
| |
| |
| /** |
| * The file name patterns to exclude (in addition to the default ones if {@link AbstractSourceAndMetadataPackageMojo#addDefaultExcludes}. The format of each pattern is described in {@link DirectoryScanner}. |
| * The comparison is against the path relative to the according filter root. |
| * Since this is hardly predictable it is recommended to use only filename/directory name patterns here |
| * but not take into account file system hierarchies! |
| * <p> |
| * Each value is either a regex pattern if enclosed within {@code %regex[} and {@code ]}, otherwise an |
| * <a href="https://ant.apache.org/manual/dirtasks.html#patterns">Ant pattern</a>. |
| */ |
| @Parameter(property = "vault.excludes", defaultValue = "**/.vlt,**/.vltignore", required = true) |
| protected Set<String> excludes; |
| |
| /** |
| * By default files like {@code .gitignore}, {@code .cvsignore} etc. are excluded which means they will not being |
| * copied. If you need them for a particular reason you can do that by settings this to {@code false}. This means |
| * all files like the following will be copied. |
| * <ul> |
| * <li>Misc: **/*~, **/#*#, **/.#*, **/%*%, **/._*</li> |
| * <li>CVS: **/CVS, **/CVS/**, **/.cvsignore</li> |
| * <li>RCS: **/RCS, **/RCS/**</li> |
| * <li>SCCS: **/SCCS, **/SCCS/**</li> |
| * <li>VSSercer: **/vssver.scc</li> |
| * <li>MKS: **/project.pj</li> |
| * <li>SVN: **/.svn, **/.svn/**</li> |
| * <li>GNU: **/.arch-ids, **/.arch-ids/**</li> |
| * <li>Bazaar: **/.bzr, **/.bzr/**</li> |
| * <li>SurroundSCM: **/.MySCMServerInfo</li> |
| * <li>Mac: **/.DS_Store</li> |
| * <li>Serena Dimension: **/.metadata, **/.metadata/**</li> |
| * <li>Mercurial: **/.hg, **/.hg/**</li> |
| * <li>GIT: **/.git, **/.gitignore, **/.gitattributes, **/.git/**</li> |
| * <li>Bitkeeper: **/BitKeeper, **/BitKeeper/**, **/ChangeSet, |
| * **/ChangeSet/**</li> |
| * <li>Darcs: **/_darcs, **/_darcs/**, **/.darcsrepo, |
| * **/.darcsrepo/****/-darcs-backup*, **/.darcs-temp-mail |
| * </ul> |
| * |
| * @since 1.1.0 |
| */ |
| @Parameter(defaultValue = "true") |
| protected boolean addDefaultExcludes; |
| |
| protected File getJcrSourceDirectory() { |
| return getJcrSourceDirectory(jcrRootSourceDirectory, builtContentDirectory, getLog()); |
| } |
| |
| protected static File getJcrSourceDirectory(File[] jcrRootSourceDirectory, File builtContentDirectory, Log log) { |
| final File jcrSourceDirectory; |
| if (builtContentDirectory != null) { |
| log.warn("The 'builtContentDirectory' is deprecated. Please use the new 'jcrRootSourceDirectory' instead."); |
| jcrSourceDirectory = builtContentDirectory; |
| } else { |
| jcrSourceDirectory = getFirstExistingDirectory(jcrRootSourceDirectory); |
| } |
| return jcrSourceDirectory; |
| } |
| } |