[Arakhnę-Dev] [194] * Add maven plugin to replace special Javadoc constants |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 194
Author: galland
Date: 2011-01-03 21:47:53 +0100 (Mon, 03 Jan 2011)
Log Message:
-----------
* Add maven plugin to replace special Javadoc constants
Modified Paths:
--------------
trunk/pom.xml
Added Paths:
-----------
trunk/maven-javadoc-tag-replacer/
trunk/maven-javadoc-tag-replacer/pom.xml
trunk/maven-javadoc-tag-replacer/src/
trunk/maven-javadoc-tag-replacer/src/main/
trunk/maven-javadoc-tag-replacer/src/main/java/
trunk/maven-javadoc-tag-replacer/src/main/java/org/
trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/
trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/
trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/
trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/AbstractArakhneMojo.java
trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/ReplaceMojo.java
trunk/maven-javadoc-tag-replacer/src/site/
trunk/maven-javadoc-tag-replacer/src/site/apt/
trunk/maven-javadoc-tag-replacer/src/site/apt/usage.apt
trunk/maven-javadoc-tag-replacer/src/site/fml/
trunk/maven-javadoc-tag-replacer/src/site/fml/faq.fml
trunk/maven-javadoc-tag-replacer/src/site/site.xml
Added: trunk/maven-javadoc-tag-replacer/pom.xml
===================================================================
--- trunk/maven-javadoc-tag-replacer/pom.xml (rev 0)
+++ trunk/maven-javadoc-tag-replacer/pom.xml 2011-01-03 20:47:53 UTC (rev 194)
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>afc</artifactId>
+ <groupId>org.arakhne.afc</groupId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>maven-javadoc-tag-replacer</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+ <name>maven-javadoc-tag-replacer Maven Plugin</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.5.1</version>
+ <executions>
+ <execution>
+ <id>generated-helpmojo</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <goalPrefix>maven-javadoc-tag-replacer</goalPrefix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/AbstractArakhneMojo.java
===================================================================
--- trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/AbstractArakhneMojo.java (rev 0)
+++ trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/AbstractArakhneMojo.java 2011-01-03 20:47:53 UTC (rev 194)
@@ -0,0 +1,176 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 Stéphane GALLAND
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * This program is free software; you can redistribute it and/or modify
+ */
+package org.arakhne.maven.javadoc_tag_replacer;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.plugin.AbstractMojo;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Abstract implementation for all Arakhnê maven modules.
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+public abstract class AbstractArakhneMojo extends AbstractMojo {
+
+ /**
+ * Maven tag for artifcat id
+ */
+ public static final String PROP_ARTIFACTID = "artifactId"; //$NON-NLS-1$
+
+ /**
+ * Maven tag for goup id
+ */
+ public static final String PROP_GROUPID = "groupId"; //$NON-NLS-1$
+
+ /**
+ * Maven tag for version description
+ */
+ public static final String PROP_VERSION = "version"; //$NON-NLS-1$
+
+ /** Copy a file.
+ *
+ * @param in
+ * @param out
+ * @throws IOException
+ */
+ public static void fileCopy(File in, File out) throws IOException {
+ assert(in!=null);
+ assert(out!=null);
+ FileChannel inChannel = new FileInputStream(in).getChannel();
+ FileChannel outChannel = new FileOutputStream(out).getChannel();
+ try {
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+ }
+ finally {
+ if (inChannel!=null) inChannel.close();
+ if (outChannel!=null) outChannel.close();
+ }
+ }
+
+ /**
+ * Location of the file.
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ protected File outputDirectory;
+
+ /**
+ * Name of the pom project
+ * @parameter default-value="${project.name}"
+ * @required
+ */
+ protected String name;
+
+ /**
+ * The resolver used to get the launcher artifact jar.
+ *
+ * @component
+ */
+ private ArtifactResolver resolver;
+
+ /** @component
+ */
+ protected ArtifactFactory artifactFactory;
+
+ /** @parameter expression="${localRepository}"
+ */
+ protected ArtifactRepository localRepository;
+
+ /** @parameter expression="${project.remoteArtifactRepositories}"
+ */
+ protected List<ArtifactRepository> remoteRepositories;
+
+ /** Invocation date.
+ */
+ protected final Date invocationDate = new Date();
+
+ /**
+ * @param artifact
+ * @throws ArtifactResolutionException
+ * @throws ArtifactNotFoundException
+ */
+ protected void resolveArtifact(Artifact artifact)
+ throws ArtifactResolutionException, ArtifactNotFoundException {
+ this.resolver.resolve(artifact, this.remoteRepositories, this.localRepository);
+ }
+
+ /** Replies a list of files which are found on the file system.
+ *
+ * @param directory is the directory to search in.
+ * @param filter is the file selector
+ * @return the list of files.
+ */
+ protected Collection<File> findFiles(File directory, FileFilter filter) {
+ Collection<File> selectedFiles = new ArrayList<File>();
+ if (directory!=null && filter!=null) {
+ File candidate;
+ List<File> candidates = new ArrayList<File>();
+
+ getLog().info("Retreiving " //$NON-NLS-1$
+ +filter.toString()
+ +" files from " //$NON-NLS-1$
+ +directory.getAbsolutePath());
+
+ candidates.add(directory);
+
+ while (!candidates.isEmpty()) {
+ candidate = candidates.remove(0);
+ if (candidate.isDirectory()) {
+ File[] children = candidate.listFiles(filter);
+ if (children!=null) {
+ for(File child : children) {
+ if (child!=null && child.isDirectory()) {
+ candidates.add(child);
+ }
+ else {
+ selectedFiles.add(child);
+ }
+ }
+ }
+ }
+ }
+
+ getLog().info("Found " //$NON-NLS-1$
+ +selectedFiles.size()
+ +" file(s)"); //$NON-NLS-1$
+ }
+ return selectedFiles;
+ }
+
+}
Added: trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/ReplaceMojo.java
===================================================================
--- trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/ReplaceMojo.java (rev 0)
+++ trunk/maven-javadoc-tag-replacer/src/main/java/org/arakhne/maven/javadoc_tag_replacer/ReplaceMojo.java 2011-01-03 20:47:53 UTC (rev 194)
@@ -0,0 +1,672 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 Stéphane GALLAND
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * This program is free software; you can redistribute it and/or modify
+ */
+package org.arakhne.maven.javadoc_tag_replacer;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Replace all the Javadoc variables by the corresponding values.
+ * Supported variables are:<table>
+ * <thead>
+ * <tr><th>Name (case-sensitive)</th><th>Description</th></tr>
+ * </thead>
+ * <tbody>
+ * <tr><td>$ArtifactId$</td><td>The artifact id of the Maven module</td></tr>
+ * <tr><td>$Date$</td><td>The date of the last compilation of the Maven module</td></tr>
+ * <tr><td>$GroupId$</td><td>The group id of the Maven module</td></tr>
+ * <tr><td>$Name$</td><td>The name of the Maven module</td></tr>
+ * <tr><td>$Revision$</td><td>The version of the Maven module</td></tr>
+ * <tr><td>$Version$</td><td>The version of the Maven module</td></tr>
+ * </tbody>
+ * </table>
+ *
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @goal replace
+ * @phase site
+ * @requireProject true
+ */
+public class ReplaceMojo extends AbstractArakhneMojo {
+
+ private final Map<String,String> javaFileMap = new TreeMap<String,String>();
+ private final Map<String,ExtendedArtifact> currentArtifact = new TreeMap<String,ExtendedArtifact>();
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() throws MojoExecutionException {
+ File javadocDir = new File(this.outputDirectory, "site"+File.separator+"apidocs"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if ( javadocDir.isDirectory() ) {
+
+ fillJavaFileMap(this.outputDirectory.getParentFile());
+
+ // Search for files
+ Collection<File> htmlFiles = findFiles(javadocDir, new HTMLFileFilter());
+
+ try {
+ // Replace in files
+ for(File file : htmlFiles) {
+ replaceInFile(file);
+ }
+ }
+ finally {
+ this.currentArtifact.clear();
+ this.javaFileMap.clear();
+ }
+ }
+ }
+
+ private void fillJavaFileMap(File root) {
+ getLog().info("Building module descriptions"); //$NON-NLS-1$
+ Collection<File> javaFiles = findFiles(root, new JavaFileFilter());
+ String pattern = "^(.*)"+File.separator //$NON-NLS-1$
+ +"src"+File.separator //$NON-NLS-1$
+ +"main"+File.separator //$NON-NLS-1$
+ +"java"+File.separator //$NON-NLS-1$
+ +"(.*)$"; //$NON-NLS-1$
+ Pattern p = Pattern.compile(pattern);
+ for(File file : javaFiles) {
+ Matcher matcher = p.matcher(file.getAbsolutePath());
+ if (matcher.find()) {
+ String pomPath = matcher.group(1);
+ File pomDirectory = new File(pomPath);
+ String className = matcher.group(2);
+
+ this.javaFileMap.put(className, pomPath);
+
+ boolean foundPom = true;
+ while (!this.currentArtifact.containsKey(pomPath) &&
+ foundPom) {
+ ExtendedArtifact artifact = readPom(pomDirectory, pomPath);
+ if (artifact!=null) {
+ this.currentArtifact.put(pomPath, artifact);
+ getLog().info("Found module description for " //$NON-NLS-1$
+ +artifact.toString());
+ pomDirectory = pomDirectory.getParentFile();
+ pomPath = pomDirectory.getAbsolutePath();
+ }
+ else {
+ foundPom = false;
+ }
+ }
+ }
+ }
+ }
+
+ private ExtendedArtifact readPom(File pomDirectory, String pomPath) {
+ String groupId = null;
+ String artifactId = null;
+ String name = null;
+ String version = null;
+
+ getLog().info("Parsing pom description for "+pomDirectory.toString()); //$NON-NLS-1$
+
+ MavenXpp3Reader pomReader = new MavenXpp3Reader();
+ try {
+ Model model = pomReader.read(new FileReader(
+ new File(pomDirectory, "pom.xml"))); //$NON-NLS-1$
+ groupId = model.getGroupId();
+ artifactId = model.getArtifactId();
+ name = model.getName();
+ version = model.getVersion();
+ }
+ catch (IOException e) {
+ return null;
+ }
+ catch (XmlPullParserException e) {
+ return null;
+ }
+
+ Artifact a = this.artifactFactory.createArtifact(groupId, artifactId, version, "runtime", "jar"); //$NON-NLS-1$//$NON-NLS-2$
+ return new ExtendedArtifact(a, name);
+ }
+
+ private ExtendedArtifact searchArtifact(File file) {
+ String pattern = "^(.+)"+File.separator //$NON-NLS-1$
+ +"site"+File.separator //$NON-NLS-1$
+ +"apidocs"+File.separator //$NON-NLS-1$
+ +".*\\.html$"; //$NON-NLS-1$
+ Pattern p = Pattern.compile(pattern);
+ Matcher matcher = p.matcher(file.getAbsolutePath());
+ if (matcher.find()) {
+ File outDirectory = new File(matcher.group(1));
+ String pomPath = outDirectory.getParent();
+ ExtendedArtifact a = this.currentArtifact.get(pomPath);
+ if (a!=null) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ private void replaceInFile(File file) throws MojoExecutionException {
+
+ ExtendedArtifact artifact = searchArtifact(file);
+
+ if (artifact!=null) {
+ getLog().info("Replacing in "+file.getAbsolutePath()); //$NON-NLS-1$
+ File outputFile = null;
+ try {
+ outputFile = new File(file.getAbsolutePath()+".maven.tmp"); //$NON-NLS-1$
+ BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile));
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ String line = reader.readLine();
+ while (line!=null) {
+ line = replaceInString(artifact, line);
+ writer.write(line);
+ writer.write("\n"); //$NON-NLS-1$
+ line = reader.readLine();
+ }
+ writer.close();
+ reader.close();
+ fileCopy(outputFile, file);
+ outputFile.delete();
+ }
+ catch(IOException e) {
+ throw new MojoExecutionException(e.getLocalizedMessage(), e);
+ }
+ finally {
+ if (outputFile!=null && outputFile.exists()) outputFile.delete();
+ }
+ }
+ else {
+ getLog().error("Unable to found artifact description for "+file.toString()); //$NON-NLS-1$
+ }
+ }
+
+ private String replaceInString(ExtendedArtifact artifact, String line) {
+ String nline = line;
+
+ if (artifact!=null) {
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd-HHmmss:SSS"); //$NON-NLS-1$
+ nline = nline.replaceAll("[$]Name(:[^$]*)?[$]", artifact.getName()); //$NON-NLS-1$
+ nline = nline.replaceAll("[$]Revision(:[^$]*)?[$]", artifact.getVersion()); //$NON-NLS-1$
+ nline = nline.replaceAll("[$]Version(:[^$]*)?[$]", artifact.getVersion()); //$NON-NLS-1$
+ nline = nline.replaceAll("[$]Date(:[^$]*)?[$]", fmt.format(this.invocationDate)); //$NON-NLS-1$
+ nline = nline.replaceAll("[$]ArtifactId(:[^$]*)?[$]", artifact.getArtifactId()); //$NON-NLS-1$
+ nline = nline.replaceAll("[$]GroupId(:[^$]*)?[$]", artifact.getGroupId()); //$NON-NLS-1$
+ }
+
+ return nline;
+ }
+
+ /**
+ * Artifact with name.
+ *
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+ private class ExtendedArtifact implements Artifact {
+
+ private final String artifactName;
+ private final Artifact original;
+
+ /**
+ * @param a
+ * @param name
+ */
+ public ExtendedArtifact(Artifact a, String name) {
+ this.original = a;
+ this.artifactName = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return this.original.toString();
+ }
+
+ /** Replies the name of the artifact.
+ *
+ * @return the name of the artifact.
+ */
+ public String getName() {
+ if (this.artifactName==null || "".equals(this.artifactName)) //$NON-NLS-1$
+ return getArtifactId();
+ return this.artifactName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addMetadata(ArtifactMetadata metadata) {
+ this.original.addMetadata(metadata);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ArtifactHandler getArtifactHandler() {
+ return this.original.getArtifactHandler();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getArtifactId() {
+ return this.original.getArtifactId();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<?> getAvailableVersions() {
+ return this.original.getAvailableVersions();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBaseVersion() {
+ return this.original.getBaseVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getClassifier() {
+ return this.original.getClassifier();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDependencyConflictId() {
+ return this.original.getDependencyConflictId();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ArtifactFilter getDependencyFilter() {
+ return this.original.getDependencyFilter();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<?> getDependencyTrail() {
+ return this.original.getDependencyTrail();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDownloadUrl() {
+ return this.original.getDownloadUrl();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public File getFile() {
+ return this.original.getFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getGroupId() {
+ return this.original.getGroupId();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getId() {
+ return this.original.getId();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection<?> getMetadataList() {
+ return this.original.getMetadataList();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ArtifactRepository getRepository() {
+ return this.original.getRepository();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getScope() {
+ return this.original.getScope();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException {
+ return this.original.getSelectedVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getType() {
+ return this.original.getType();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getVersion() {
+ return this.original.getVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public VersionRange getVersionRange() {
+ return this.original.getVersionRange();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasClassifier() {
+ return this.original.hasClassifier();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isOptional() {
+ return this.original.isOptional();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isRelease() {
+ return this.original.isRelease();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isResolved() {
+ return this.original.isResolved();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSelectedVersionKnown() throws OverConstrainedVersionException {
+ return this.original.isSelectedVersionKnown();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSnapshot() {
+ return this.original.isSnapshot();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void selectVersion(String version) {
+ this.original.selectVersion(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setArtifactHandler(ArtifactHandler handler) {
+ this.original.setArtifactHandler(handler);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setArtifactId(String artifactId) {
+ this.original.setArtifactId(artifactId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public void setAvailableVersions(List versions) {
+ this.original.setAvailableVersions(versions);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setBaseVersion(String baseVersion) {
+ this.original.setBaseVersion(baseVersion);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDependencyFilter(ArtifactFilter artifactFilter) {
+ this.original.setDependencyFilter(artifactFilter);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public void setDependencyTrail(List dependencyTrail) {
+ this.original.setDependencyTrail(dependencyTrail);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDownloadUrl(String downloadUrl) {
+ this.original.setDownloadUrl(downloadUrl);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setFile(File destination) {
+ this.original.setFile(destination);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setGroupId(String groupId) {
+ this.original.setGroupId(groupId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setRelease(boolean release) {
+ this.original.setRelease(release);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setRepository(ArtifactRepository remoteRepository) {
+ this.original.setRepository(remoteRepository);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setResolved(boolean resolved) {
+ this.original.setResolved(resolved);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setResolvedVersion(String version) {
+ this.original.setResolvedVersion(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setScope(String scope) {
+ this.original.setScope(scope);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setVersion(String version) {
+ this.original.setVersion(version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setVersionRange(VersionRange newRange) {
+ this.original.setVersionRange(newRange);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void updateVersion(String version, ArtifactRepository localRepository) {
+ this.original.updateVersion(version, localRepository);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public int compareTo(Object o) {
+ return this.original.compareTo(o);
+ }
+
+ } // class ExtendedArtifact
+
+ /**
+ * File filter for HTML file.
+ *
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+ private class HTMLFileFilter implements FileFilter {
+
+ /**
+ */
+ public HTMLFileFilter() {
+ //
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean accept(File pathname) {
+ return pathname!=null &&
+ (pathname.isDirectory() ||
+ pathname.getName().endsWith(".html")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return "Hypertext (.html)"; //$NON-NLS-1$
+ }
+
+ } // class HTMLFileFilter
+
+ /**
+ * File filter for HTML Java file.
+ *
+ * @author Stéphane GALLAND <galland@xxxxxxxxxxx>
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+ private class JavaFileFilter implements FileFilter {
+
+ /**
+ */
+ public JavaFileFilter() {
+ //
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean accept(File pathname) {
+ return pathname!=null &&
+ (pathname.isDirectory() ||
+ pathname.getName().endsWith(".java")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return "Java Source (.java)"; //$NON-NLS-1$
+ }
+
+ } // class JavaFileFilter
+
+} // class ReplaceMojo
Added: trunk/maven-javadoc-tag-replacer/src/site/apt/usage.apt
===================================================================
--- trunk/maven-javadoc-tag-replacer/src/site/apt/usage.apt (rev 0)
+++ trunk/maven-javadoc-tag-replacer/src/site/apt/usage.apt 2011-01-03 20:47:53 UTC (rev 194)
@@ -0,0 +1,3 @@
+
+
+Regular Arakhne.org Module
\ No newline at end of file
Added: trunk/maven-javadoc-tag-replacer/src/site/fml/faq.fml
===================================================================
--- trunk/maven-javadoc-tag-replacer/src/site/fml/faq.fml (rev 0)
+++ trunk/maven-javadoc-tag-replacer/src/site/fml/faq.fml 2011-01-03 20:47:53 UTC (rev 194)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faqs id="FAQ" title="Frequently Asked Questions">
+ <part id="configuration">
+ <title>Configuration</title>
+ <faq id="configuration-pom">
+ <question>How can I configure the Maven Javadoc Replacer Plugin?</question>
+ <answer>In your pom.xml, type: <source>
+<build>
+<plugins>
+<plugin>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>maven-javadoc-tag-replacer</artifactId>
+ <executions>
+ <execution>
+ <phase>post-site</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+</plugins>
+</build>
+...
+<repositories>
+ <repository>
+ <id>org.arakhne-maven</id>
+ <name>Arakhn&ecirc; Maven Repository</name>
+ <url>http://download.tuxfamily.org/arakhne/maven/</url>
+ </repository>
+</repositories>
+...
+</project>
+ </source>
+ </answer>
+ </faq>
+ </part>
+</faqs>
\ No newline at end of file
Added: trunk/maven-javadoc-tag-replacer/src/site/site.xml
===================================================================
--- trunk/maven-javadoc-tag-replacer/src/site/site.xml (rev 0)
+++ trunk/maven-javadoc-tag-replacer/src/site/site.xml 2011-01-03 20:47:53 UTC (rev 194)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+ <item name="FAQ" href="faq.html"/>
+ </menu>
+
+ <menu name="Examples">
+ <item name="description1" href="examples/example-one.html"/>
+ <item name="description2" href="examples/example-two.html"/>
+ </menu>
+ </body>
+</project>
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-10-05 19:29:16 UTC (rev 193)
+++ trunk/pom.xml 2011-01-03 20:47:53 UTC (rev 194)
@@ -38,7 +38,8 @@
<module>arakhneRefs</module>
<module>arakhneVmutils</module>
<module>arakhneLog4J</module>
- </modules>
+ <module>maven-javadoc-tag-replacer</module>
+ </modules>
<licenses>
<license>
@@ -72,41 +73,41 @@
<name>Stephane Galland</name>
<email>galland@xxxxxxxxxxx</email>
<url>http://www.arakhne.org/homes/galland.html</url>
- <organization />
- <organizationUrl />
+ <organization/>
+ <organizationUrl/>
<roles>
<role>Founder</role>
<role>Architect</role>
<role>Developer</role>
</roles>
- <timezone />
- <properties />
+ <timezone/>
+ <properties/>
</developer>
<developer>
<id>gaud</id>
<name>Nicolas Gaud</name>
<email>gaud@xxxxxxxxxxx</email>
<url>http://www.arakhne.org/homes/gaud.html</url>
- <organization />
- <organizationUrl />
+ <organization/>
+ <organizationUrl/>
<roles>
<role>Developer</role>
</roles>
- <timezone />
- <properties />
+ <timezone/>
+ <properties/>
</developer>
<developer>
<id>willaume</id>
<name>Alexandre WILLAUME</name>
<email>willaume@xxxxxxxxxxx</email>
<url>http://www.arakhne.org/homes/willaume.html</url>
- <organization />
- <organizationUrl />
+ <organization/>
+ <organizationUrl/>
<roles>
<role>Developer</role>
</roles>
- <timezone />
- <properties />
+ <timezone/>
+ <properties/>
</developer>
</developers>
@@ -161,9 +162,9 @@
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
<plugin>
- <groupId>com.google.code.maven-replacer-plugin</groupId>
- <artifactId>maven-replacer-plugin</artifactId>
- <version>1.3.1</version>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>maven-javadoc-tag-replacer</artifactId>
+ <version>0.1</version>
<executions>
<execution>
<phase>site</phase>
@@ -172,41 +173,6 @@
</goals>
</execution>
</executions>
- <configuration>
- <includes>
- <include>**/target/site/apidocs/**/*.html</include>
- </includes>
- <regex>true</regex>
- <regexFlags>
- <regexFlag>CASE_INSENSITIVE</regexFlag>
- </regexFlags>
- <replacements>
- <replacement>
- <token>[$]Name(:[^$]*)?[$]</token>
- <value>${pom.name}</value>
- </replacement>
- <replacement>
- <token>[$]Revision(:[^$]*)?[$]</token>
- <value>${project.version}</value>
- </replacement>
- <replacement>
- <token>[$]Version(:[^$]*)?[$]</token>
- <value>${project.version}</value>
- </replacement>
- <replacement>
- <token>[$]Date(:[^$]*)?[$]</token>
- <value>${maven.build.timestamp}</value>
- </replacement>
- <replacement>
- <token>[$]ArtifactId(:[^$]*)?[$]</token>
- <value>${pom.artifactId}</value>
- </replacement>
- <replacement>
- <token>[$]GroupId(:[^$]*)?[$]</token>
- <value>${pom.groupId}</value>
- </replacement>
- </replacements>
- </configuration>
</plugin>
</plugins>
</build>
@@ -264,4 +230,4 @@
</plugins>
</reporting>
-</project>
+</project>
\ No newline at end of file