Package fr.paris.lutece.maven
Class AbstractLuteceWebappMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
fr.paris.lutece.maven.AbstractLuteceMojo
fr.paris.lutece.maven.AbstractLuteceWebappMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AssemblyMojo,AssemblySiteMojo,CleanMojo,ExplodedLiteMojo,ExplodedMojo,ExplodedWebappMojo,InplaceMojo,LiquiBaseSqlMojo,UpdaterMojo,WarMojo
Abstracts functionnality common to mojos that create a Lutece webapp from
Lutece artifacts.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.maven.artifact.factory.ArtifactFactoryThe artifact factory.protected org.apache.maven.artifact.handler.manager.ArtifactHandlerManagerprotected Set<org.apache.maven.artifact.Artifact>The set of artifacts required by this project, including transitive dependencies.protected FileThe directory containing the local, user-specific configuration files.protected org.apache.maven.artifact.repository.ArtifactRepositoryThe local repository.protected org.apache.maven.artifact.metadata.ArtifactMetadataSourceThe artifact metadata source.protected List<org.eclipse.aether.repository.RemoteRepository>The remote Project Repositoriesprotected List<org.apache.maven.artifact.repository.ArtifactRepository>The remote repositories.protected org.eclipse.aether.RepositorySystemSessionThe Repository System Sessionprotected org.eclipse.aether.RepositorySystemprotected org.apache.maven.artifact.resolver.ArtifactResolverThe artifact resolver.protected StringWhen used, the name of the database vendor.protected FileThe directory where to explode the test webapp.protected org.codehaus.plexus.archiver.zip.ZipUnArchiverThe unarchiver.protected FileThe directory where to explode the webapp.Fields inherited from class fr.paris.lutece.maven.AbstractLuteceMojo
ANT_PATH, ARCHIVE_TIMESTAMP_PATTERN, ARCHIVE_TIMESTAMP_TIME_ZONE, ARTIFACT_BUILD_CONFIG, ASSEMBLY_WEBAPP_EXCLUDES, ASSEMBLY_WEBAPP_INCLUDES, ASSEMBLY_WEBAPP_SITE_EXCLUDES, ASSEMBLY_WEBAPP_SITE_INCLUDES, BUILD_CONFIG_PATH, BUILD_PROPERTIES_FILE, classesDirectory, DATABASE_VENDOR_AUTO, DATABASE_VENDOR_NONE, DATABASE_VENDORS, defaultConfDirectory, EXCLUDE_PATTERN_ASSEMBLY, EXCLUDE_PATTERN_BUSINESS, EXCLUDE_PATTERN_CLASSES, EXCLUDE_PATTERN_JAVA, EXCLUDE_PATTERN_LIB, EXCLUDE_PATTERN_PACKAGE_HTML, EXCLUDE_PATTERN_RESOURCES, EXCLUDE_PATTERN_SERVICE, EXCLUDE_PATTERN_SITE, EXCLUDE_PATTERN_SVN, EXCLUDE_PATTERN_TARGET, EXCLUDE_PATTERN_TEST, EXCLUDE_PATTERN_UTIL, EXCLUDE_PATTERN_UTILS, EXCLUDE_PATTERN_WEB, EXCLUDE_PATTERN_WEBAPP, EXCLUDE_PATTERN_WEBINF_TEST, INCLUDE_PATTERN_ALL, INCLUDE_PATTERN_RESOURCES, INCLUDE_PATTERN_SITE_USER, INCLUDE_PATTERN_SQL, INCLUDE_PATTERN_SRC, INCLUDE_PATTERN_WEBAPP, JUNIT, LUTECE_CORE_PACKAGING, LUTECE_CORE_TYPE, LUTECE_DIRECTORY, LUTECE_PLUGIN_PACKAGING, LUTECE_PLUGIN_TYPE, LUTECE_SITE_PACKAGING, LUTECE_SITE_TYPE, META_INF_DIRECTORY, outputDirectory, PACKAGE_CLASSES_EXCLUDES, PACKAGE_CLASSES_INCLUDES, PACKAGE_WEBAPP_EXCLUDES, PACKAGE_WEBAPP_INCLUDES, PACKAGE_WEBAPP_RESOURCES_EXCLUDES, PACKAGE_WEBAPP_RESOURCES_INCLUDE, PACKAGE_WEBAPP_SITE_EXCLUDES, PACKAGE_WEBAPP_SITE_INCLUDES, pluginVersion, POM_PACKAGING, project, reactorProjects, SERVLET_API, session, siteDirectory, sqlDirectory, WEB_INF_BUILD_PROPERTIES_PATH, WEB_INF_CLASSES_SQL_PATH, WEB_INF_DB_PROPERTIES_PATH, WEB_INF_DOC_XML_PATH, WEB_INF_SQL_PATH, WEBAPP_CLASSIFIER, webappSourceDirectoryFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToExplodedWebapp(org.apache.maven.artifact.Artifact luteceArtifact, File webappDir) Adds a Lutece artifact to an exploded webapp.protected voidcopyBuildConfig(File targetDir) protected intcopyDirectory(File sourceDirectory, File targetDirectory, boolean isUpdate) Copies a directory structure, either wholesale or only the files newer than their target.protected voidcopyThirdPartyJars(File webappDir) Copy third-party JARs to an exploded webapp directory.protected voidexplodeConfigurationFiles(File targetDir) protected voidexplodeCore(File webappDir) Add the lutece-core dependency's files to an exploded webapp directory.protected voidexplodePlugins(File webappDir) Add the lutece-plugin dependencies' files to an exploded webapp directory.protected voidexplodeSites(File webappDir) Add the lutece-site dependencies' files to an exploded webapp directory.protected voidexplodeSqlFiles(File explodedDirectory, String targetDatabaseVendor) explode sql files in WEB-INF/classes/sql directoryprotected voidexplodeWebapp(File targetDir) Creates an exploded webapp structure from the current project.protected Set<org.apache.maven.artifact.Artifact>filterArtifacts(org.apache.maven.artifact.resolver.filter.ArtifactFilter filter) Filters the project's set of artifacts with an ArtifactFilter.protected Collection<File>Gets the jars this project depends on.protected FileUsed for multiproject, return the output directory ( /target/lutece/ ) of root project.protected FileUsed for multiproject, return the output directory ( /target ) of root project.protected voidLogs how many files a copy actually wrote.Methods inherited from class fr.paris.lutece.maven.AbstractLuteceMojo
countExplodedModules, getDeployedJars, getSharedDirectoryLock, logBanner, validatePackagingMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
localConfDirectory
@Parameter(property="localConfDirectory", defaultValue="${user.home}/lutece/conf/${project.artifactId}") protected File localConfDirectoryThe directory containing the local, user-specific configuration files. -
artifacts
@Parameter(defaultValue="${project.artifacts}", required=true, readonly=true) protected Set<org.apache.maven.artifact.Artifact> artifactsThe set of artifacts required by this project, including transitive dependencies. -
repoSession
@Parameter(defaultValue="${repositorySystemSession}", readonly=true) protected org.eclipse.aether.RepositorySystemSession repoSessionThe Repository System Session -
remoteProjectRepositories
@Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true) protected List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositoriesThe remote Project Repositories -
localRepository
@Parameter(property="localRepository") protected org.apache.maven.artifact.repository.ArtifactRepository localRepositoryThe local repository. -
remoteRepositories
@Parameter(property="project.remoteArtifactRepositories") protected List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositoriesThe remote repositories. -
testWebappDirectory
@Parameter(property="testWebappDirectory", defaultValue="${project.build.directory}/lutece") protected File testWebappDirectoryThe directory where to explode the test webapp. -
webappDirectory
@Parameter(property="webappDirectory", defaultValue="${project.build.directory}/${project.build.finalName}") protected File webappDirectoryThe directory where to explode the webapp. -
targetDatabaseVendor
@Parameter(property="targetDatabaseVendor", defaultValue="none") protected String targetDatabaseVendorWhen used, the name of the database vendor. Authorized value are:- hsqldb
- mysql
- oracle
- postgresql
- none : does not process anything (default)
- auto : will try to determine behaviour from contents of db.properties
-
artifactFactory
@Inject protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactoryThe artifact factory. -
resolver
@Inject protected org.apache.maven.artifact.resolver.ArtifactResolver resolverThe artifact resolver. -
unArchiver
@Inject protected org.codehaus.plexus.archiver.zip.ZipUnArchiver unArchiverThe unarchiver. -
artifactHandlerManager
@Inject protected org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager -
repoSystem
@Inject protected org.eclipse.aether.RepositorySystem repoSystem -
metadataSource
@Inject protected org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSourceThe artifact metadata source.
-
-
Constructor Details
-
AbstractLuteceWebappMojo
public AbstractLuteceWebappMojo()
-
-
Method Details
-
explodeWebapp
Creates an exploded webapp structure from the current project.- Parameters:
targetDir- the destination directory.- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs while exploding the webapp.
-
copyDirectory
protected int copyDirectory(File sourceDirectory, File targetDirectory, boolean isUpdate) throws IOException Copies a directory structure, either wholesale or only the files newer than their target.- Parameters:
sourceDirectory- the source directorytargetDirectory- the destination directoryisUpdate- true to copy only the modified files- Returns:
- the number of files copied
- Throws:
IOException- if an I/O exception occurs
-
logCopied
Logs how many files a copy actually wrote.- Parameters:
nCopied- the number of files copiedstrWhat- what was copied, for the message
-
explodeConfigurationFiles
protected void explodeConfigurationFiles(File targetDir) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
explodeCore
Add the lutece-core dependency's files to an exploded webapp directory.- Parameters:
webappDir- the webapp directory.- Throws:
org.apache.maven.plugin.MojoExecutionException- if there is no lutece-core dependency, or more than one, or if an error occurs while resolving the artifact.
-
explodePlugins
Add the lutece-plugin dependencies' files to an exploded webapp directory.- Parameters:
webappDir- the webapp directory.- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs while resolving the artifacts.
-
explodeSites
Add the lutece-site dependencies' files to an exploded webapp directory.- Parameters:
webappDir- the webapp directory.- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs while resolving the artifacts.
-
copyThirdPartyJars
protected void copyThirdPartyJars(File webappDir) throws org.apache.maven.plugin.MojoExecutionException Copy third-party JARs to an exploded webapp directory.- Parameters:
webappDir- the webapp directory- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs while copying the files.
-
addToExplodedWebapp
protected void addToExplodedWebapp(org.apache.maven.artifact.Artifact luteceArtifact, File webappDir) throws org.apache.maven.plugin.MojoExecutionException Adds a Lutece artifact to an exploded webapp.- Parameters:
luteceArtifact- the Lutece artifact.webappDir- the exploded webapp's base directory.- Throws:
org.apache.maven.plugin.MojoExecutionException- if an error occurs while unpacking.
-
getDependentJars
Gets the jars this project depends on. Lutece artifacts are excluded : they are deployed byaddToExplodedWebapp(Artifact, File). Provided and test artifacts are excluded too, as are junit and the servlet API, whose transitive scope is not reliable.- Returns:
- the jar files, never null
-
filterArtifacts
protected Set<org.apache.maven.artifact.Artifact> filterArtifacts(org.apache.maven.artifact.resolver.filter.ArtifactFilter filter) Filters the project's set of artifacts with an ArtifactFilter.- Parameters:
type- the type to retain.- Returns:
- a new Set containing the filtered elements.
-
getRootProjectBuildDirectory
Used for multiproject, return the output directory ( /target/lutece/ ) of root project.- Returns:
- File corresponding to the root project output directory
-
getRootProjectBuildDirectoryTarget
Used for multiproject, return the output directory ( /target ) of root project.- Returns:
- File corresponding to the root project output directory
-
copyBuildConfig
protected void copyBuildConfig(File targetDir) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
explodeSqlFiles
protected void explodeSqlFiles(File explodedDirectory, String targetDatabaseVendor) throws org.apache.maven.plugin.MojoExecutionException explode sql files in WEB-INF/classes/sql directory- Parameters:
explodedDirectory-targetDatabaseVendor-- Throws:
org.apache.maven.plugin.MojoExecutionException
-