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

public abstract class AbstractLuteceWebappMojo extends AbstractLuteceMojo
Abstracts functionnality common to mojos that create a Lutece webapp from Lutece artifacts.
  • Field Details

    • localConfDirectory

      @Parameter(property="localConfDirectory", defaultValue="${user.home}/lutece/conf/${project.artifactId}") protected File localConfDirectory
      The directory containing the local, user-specific configuration files.
    • artifacts

      @Parameter(defaultValue="${project.artifacts}", required=true, readonly=true) protected Set<org.apache.maven.artifact.Artifact> artifacts
      The set of artifacts required by this project, including transitive dependencies.
    • repoSession

      @Parameter(defaultValue="${repositorySystemSession}", readonly=true) protected org.eclipse.aether.RepositorySystemSession repoSession
      The Repository System Session
    • remoteProjectRepositories

      @Parameter(defaultValue="${project.remoteProjectRepositories}", readonly=true) protected List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories
      The remote Project Repositories
    • localRepository

      @Parameter(property="localRepository") protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
      The local repository.
    • remoteRepositories

      @Parameter(property="project.remoteArtifactRepositories") protected List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
      The remote repositories.
    • testWebappDirectory

      @Parameter(property="testWebappDirectory", defaultValue="${project.build.directory}/lutece") protected File testWebappDirectory
      The directory where to explode the test webapp.
    • webappDirectory

      @Parameter(property="webappDirectory", defaultValue="${project.build.directory}/${project.build.finalName}") protected File webappDirectory
      The directory where to explode the webapp.
    • targetDatabaseVendor

      @Parameter(property="targetDatabaseVendor", defaultValue="none") protected String targetDatabaseVendor
      When 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 artifactFactory
      The artifact factory.
    • resolver

      @Inject protected org.apache.maven.artifact.resolver.ArtifactResolver resolver
      The artifact resolver.
    • unArchiver

      @Inject protected org.codehaus.plexus.archiver.zip.ZipUnArchiver unArchiver
      The 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 metadataSource
      The artifact metadata source.
  • Constructor Details

    • AbstractLuteceWebappMojo

      public AbstractLuteceWebappMojo()
  • Method Details

    • explodeWebapp

      protected void explodeWebapp(File targetDir) throws org.apache.maven.plugin.MojoExecutionException
      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 directory
      targetDirectory - the destination directory
      isUpdate - true to copy only the modified files
      Returns:
      the number of files copied
      Throws:
      IOException - if an I/O exception occurs
    • logCopied

      protected void logCopied(int nCopied, String strWhat)
      Logs how many files a copy actually wrote.
      Parameters:
      nCopied - the number of files copied
      strWhat - 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

      protected void explodeCore(File webappDir) throws org.apache.maven.plugin.MojoExecutionException
      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

      protected void explodePlugins(File webappDir) throws org.apache.maven.plugin.MojoExecutionException
      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

      protected void explodeSites(File webappDir) throws org.apache.maven.plugin.MojoExecutionException
      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

      protected Collection<File> getDependentJars()
      Gets the jars this project depends on. Lutece artifacts are excluded : they are deployed by addToExplodedWebapp(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

      protected File getRootProjectBuildDirectory()
      Used for multiproject, return the output directory ( /target/lutece/ ) of root project.
      Returns:
      File corresponding to the root project output directory
    • getRootProjectBuildDirectoryTarget

      protected File 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