Package org.nuiton.i18n.plugin.bundle
Class CollectI18nArtifactsMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.nuiton.plugin.AbstractPlugin
org.nuiton.i18n.plugin.AbstractI18nMojo
org.nuiton.i18n.plugin.bundle.AbstractI18nBundleMojo
org.nuiton.i18n.plugin.bundle.CollectI18nArtifactsMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo,org.nuiton.plugin.Plugin,org.nuiton.plugin.PluginWithEncoding
@Mojo(name="collect-i18n-artifacts",
defaultPhase=GENERATE_RESOURCES,
requiresProject=true,
requiresDependencyResolution=RUNTIME)
public class CollectI18nArtifactsMojo
extends AbstractI18nBundleMojo
Detects any i18n artifacts in the dependencies of the project and store
their references in a file.
The generated file will be used by
bundle mojo to generate the final
aggregated bundle.- Since:
- 1.0.2
- Author:
- Tony Chemit - chemit@codelutin.com
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.maven.shared.dependency.graph.DependencyGraphBuilderdependencyTreeBuilderDependency tree builder component.protected org.apache.maven.artifact.repository.ArtifactRepositorylocalRepositoryLocal Repository.protected java.io.FilesrcDirectory where to find project i18n files.Fields inherited from class org.nuiton.i18n.plugin.bundle.AbstractI18nBundleMojo
collectOutputDir, collectOutputNameFields inherited from class org.nuiton.i18n.plugin.AbstractI18nMojo
bundles, encoding, locales, mavenSession, project, silent, verbose -
Constructor Summary
Constructors Constructor Description CollectI18nArtifactsMojo() -
Method Summary
Modifier and Type Method Description protected voiddetectBundles(I18nArtifact i18nArtifact, java.util.List<org.apache.maven.artifact.Artifact> artifacts, java.util.Map<org.apache.maven.artifact.Artifact,I18nArtifact> dico)protected I18nArtifact[]detectI18nArtifacts()Detecte lesI18nArtifactet les retourne dans l'ordre de chargement dans le système i18n, i.e l'ordre des dependances entre artifacts.protected voiddoAction()protected java.net.URL[]getCollectI18nResources(java.util.Locale locale)Pour obtenir les urls des fichiers i18n d'un projet (avec recherche dans ses dépendances).voidinit()protected voidstoreCollectI18nResources(java.io.File bundleOut, java.net.URL[] urls)Methods inherited from class org.nuiton.i18n.plugin.bundle.AbstractI18nBundleMojo
getCollectOutputFileMethods inherited from class org.nuiton.i18n.plugin.AbstractI18nMojo
backupFile, checkBundle, checkPackaging, failsIfAnyKeyMissingInBundle, failsIfAnyKeyMissingValue, getBackupFile, getEncoding, getProject, isSilent, isVerbose, setEncoding, setProject, setVerboseMethods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, checkEncoding, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, needInvoke, needInvoke, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFileMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
src
@Parameter(property="i18n.src", defaultValue="${basedir}/src/main/resources/i18n", required=true) protected java.io.File srcDirectory where to find project i18n files. -
localRepository
@Parameter(property="localRepository", required=true, readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepositoryLocal Repository.- Since:
- 1.0.2
-
dependencyTreeBuilder
@Component protected org.apache.maven.shared.dependency.graph.DependencyGraphBuilder dependencyTreeBuilderDependency tree builder component.- Since:
- 1.0.2
-
-
Constructor Details
-
CollectI18nArtifactsMojo
public CollectI18nArtifactsMojo()
-
-
Method Details
-
init
public void init() throws java.lang.Exception- Overrides:
initin classAbstractI18nMojo- Throws:
java.lang.Exception
-
doAction
protected void doAction() throws java.lang.Exception- Specified by:
doActionin classorg.nuiton.plugin.AbstractPlugin- Throws:
java.lang.Exception
-
getCollectI18nResources
protected java.net.URL[] getCollectI18nResources(java.util.Locale locale) throws java.io.IOExceptionDescription copied from class:AbstractI18nBundleMojoPour obtenir les urls des fichiers i18n d'un projet (avec recherche dans ses dépendances). Note: L'ordre des urls reflète l'ordre des dépendances.- Specified by:
getCollectI18nResourcesin classAbstractI18nBundleMojo- Parameters:
locale- la locale a traiter- Returns:
- les urls des bundles i18n detectees pour le projet.
- Throws:
java.io.IOException
-
storeCollectI18nResources
protected void storeCollectI18nResources(java.io.File bundleOut, java.net.URL[] urls) throws java.io.IOException- Throws:
java.io.IOException
-
detectI18nArtifacts
protected I18nArtifact[] detectI18nArtifacts() throws java.io.IOException, org.apache.maven.shared.dependency.graph.DependencyGraphBuilderExceptionDetecte lesI18nArtifactet les retourne dans l'ordre de chargement dans le système i18n, i.e l'ordre des dependances entre artifacts.- Returns:
- les artifacts i18nables triés par leur ordre de chargement dans le système i18n.
- Throws:
java.io.IOException- while detecting bundles from artifactsorg.apache.maven.shared.dependency.graph.DependencyGraphBuilderException
-
detectBundles
protected void detectBundles(I18nArtifact i18nArtifact, java.util.List<org.apache.maven.artifact.Artifact> artifacts, java.util.Map<org.apache.maven.artifact.Artifact,I18nArtifact> dico) throws java.io.IOException- Throws:
java.io.IOException
-