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
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.maven.shared.dependency.graph.DependencyGraphBuilderDependency tree builder component.protected org.apache.maven.artifact.repository.ArtifactRepositoryLocal Repository.protected FileDirectory 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, verboseFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddetectBundles(I18nArtifact i18nArtifact, List<org.apache.maven.artifact.Artifact> artifacts, Map<org.apache.maven.artifact.Artifact, I18nArtifact> dico) protected I18nArtifact[]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 URL[]getCollectI18nResources(Locale locale) Pour obtenir les urls des fichiers i18n d'un projet (avec recherche dans ses dépendances).voidinit()protected voidstoreCollectI18nResources(File bundleOut, 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, 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, getLog, setLog
-
Field Details
-
src
@Parameter(property="i18n.src", defaultValue="${basedir}/src/main/resources/i18n", required=true) protected 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
- Overrides:
initin classAbstractI18nMojo- Throws:
Exception
-
doAction
- Specified by:
doActionin classorg.nuiton.plugin.AbstractPlugin- Throws:
Exception
-
getCollectI18nResources
Description 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:
IOException
-
storeCollectI18nResources
- Throws:
IOException
-
detectI18nArtifacts
protected I18nArtifact[] detectI18nArtifacts() throws 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:
IOException- while detecting bundles from artifactsorg.apache.maven.shared.dependency.graph.DependencyGraphBuilderException
-
detectBundles
protected void detectBundles(I18nArtifact i18nArtifact, List<org.apache.maven.artifact.Artifact> artifacts, Map<org.apache.maven.artifact.Artifact, I18nArtifact> dico) throws IOException- Throws:
IOException
-