[Arakhnę-Dev] [276] * Add sources in snapshot releases. |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
Revision: 276
Author: galland
Date: 2011-08-26 17:29:32 +0200 (Fri, 26 Aug 2011)
Log Message:
-----------
* Add sources in snapshot releases.
Modified Paths:
--------------
trunk/arakhneLog4J/pom.xml
trunk/arakhneLogger/pom.xml
trunk/arakhneRefs/pom.xml
trunk/arakhneVmutils/java/pom.xml
trunk/pom.xml
trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java
trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateSourceMojo.java
Added Paths:
-----------
trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateReplaceSourceMojo.java
Modified: trunk/arakhneLog4J/pom.xml
===================================================================
--- trunk/arakhneLog4J/pom.xml 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/arakhneLog4J/pom.xml 2011-08-26 15:29:32 UTC (rev 276)
@@ -74,16 +74,22 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.arakhne.afc</groupId>
- <artifactId>tag-replacer</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
- <id>source_generation</id>
- <phase>generate-sources</phase>
+ <id>attach-sources</id>
+ <phase>verify</phase>
<goals>
- <goal>generatesrc</goal>
+ <goal>jar-no-fork</goal>
</goals>
</execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>tag-replacer</artifactId>
+ <executions>
<execution>
<id>property_preparation</id>
<phase>process-resources</phase>
@@ -91,6 +97,13 @@
<goal>replaceresource</goal>
</goals>
</execution>
+ <execution>
+ <id>source_generation</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>generatereplacesrc</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
<plugin>
Modified: trunk/arakhneLogger/pom.xml
===================================================================
--- trunk/arakhneLogger/pom.xml 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/arakhneLogger/pom.xml 2011-08-26 15:29:32 UTC (rev 276)
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>afc</artifactId>
+ <parent>
+ <artifactId>afc</artifactId>
+ <groupId>org.arakhne.afc</groupId>
+ <version>4.1-SNAPSHOT</version>
+ </parent>
+
<groupId>org.arakhne.afc</groupId>
- <version>4.1-SNAPSHOT</version>
- </parent>
+ <artifactId>arakhneLogger</artifactId>
+ <packaging>jar</packaging>
+ <version>1.6-SNAPSHOT</version>
+ <name>Logging API</name>
+ <url>http://www.arakhne.org/arakhneLogger/</url>
- <groupId>org.arakhne.afc</groupId>
- <artifactId>arakhneLogger</artifactId>
- <packaging>jar</packaging>
- <version>1.6-SNAPSHOT</version>
- <name>Logging API</name>
- <url>http://www.arakhne.org/arakhneLogger/</url>
-
<properties>
<manifest.file>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifest.file>
</properties>
@@ -22,7 +23,7 @@
<!-- ======================================= -->
<!-- ==== Project Information === -->
<!-- ======================================= -->
-
+
<build>
<plugins>
<plugin>
@@ -61,17 +62,23 @@
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.arakhne.afc</groupId>
- <artifactId>tag-replacer</artifactId>
- <executions>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
<execution>
- <id>source_generation</id>
- <phase>generate-sources</phase>
+ <id>attach-sources</id>
+ <phase>verify</phase>
<goals>
- <goal>generatesrc</goal>
+ <goal>jar-no-fork</goal>
</goals>
</execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>tag-replacer</artifactId>
+ <executions>
<execution>
<id>property_preparation</id>
<phase>process-resources</phase>
@@ -79,8 +86,15 @@
<goal>replaceresource</goal>
</goals>
</execution>
- </executions>
- </plugin>
+ <execution>
+ <id>source_generation</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>generatereplacesrc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.arakhne.afc</groupId>
<artifactId>license-installer</artifactId>
@@ -103,5 +117,5 @@
</plugin>
</plugins>
</build>
-
+
</project>
Modified: trunk/arakhneRefs/pom.xml
===================================================================
--- trunk/arakhneRefs/pom.xml 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/arakhneRefs/pom.xml 2011-08-26 15:29:32 UTC (rev 276)
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>afc</artifactId>
+ <parent>
+ <artifactId>afc</artifactId>
+ <groupId>org.arakhne.afc</groupId>
+ <version>4.1-SNAPSHOT</version>
+ </parent>
+
<groupId>org.arakhne.afc</groupId>
- <version>4.1-SNAPSHOT</version>
- </parent>
+ <artifactId>arakhneRefs</artifactId>
+ <packaging>jar</packaging>
+ <version>5.6-SNAPSHOT</version>
+ <name>Weak Reference Utilities</name>
+ <url>http://www.arakhne.org/arakhneRefs/</url>
- <groupId>org.arakhne.afc</groupId>
- <artifactId>arakhneRefs</artifactId>
- <packaging>jar</packaging>
- <version>5.6-SNAPSHOT</version>
- <name>Weak Reference Utilities</name>
- <url>http://www.arakhne.org/arakhneRefs/</url>
-
<properties>
<manifest.file>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifest.file>
</properties>
@@ -22,7 +23,7 @@
<!-- ======================================= -->
<!-- ==== Project Information === -->
<!-- ======================================= -->
-
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -69,17 +70,23 @@
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.arakhne.afc</groupId>
- <artifactId>tag-replacer</artifactId>
- <executions>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
<execution>
- <id>source_generation</id>
- <phase>generate-sources</phase>
+ <id>attach-sources</id>
+ <phase>verify</phase>
<goals>
- <goal>generatesrc</goal>
+ <goal>jar-no-fork</goal>
</goals>
</execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>tag-replacer</artifactId>
+ <executions>
<execution>
<id>property_preparation</id>
<phase>process-resources</phase>
@@ -87,8 +94,15 @@
<goal>replaceresource</goal>
</goals>
</execution>
- </executions>
- </plugin>
+ <execution>
+ <id>source_generation</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>generatereplacesrc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.arakhne.afc</groupId>
<artifactId>license-installer</artifactId>
Modified: trunk/arakhneVmutils/java/pom.xml
===================================================================
--- trunk/arakhneVmutils/java/pom.xml 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/arakhneVmutils/java/pom.xml 2011-08-26 15:29:32 UTC (rev 276)
@@ -81,16 +81,22 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.arakhne.afc</groupId>
- <artifactId>tag-replacer</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
- <id>source_generation</id>
- <phase>generate-sources</phase>
+ <id>attach-sources</id>
+ <phase>verify</phase>
<goals>
- <goal>generatesrc</goal>
+ <goal>jar-no-fork</goal>
</goals>
</execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.arakhne.afc</groupId>
+ <artifactId>tag-replacer</artifactId>
+ <executions>
<execution>
<id>property_preparation</id>
<phase>process-resources</phase>
@@ -98,6 +104,13 @@
<goal>replaceresource</goal>
</goals>
</execution>
+ <execution>
+ <id>source_generation</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>generatereplacesrc</goal>
+ </goals>
+ </execution>
</executions>
<configuration>
<projectGroupId>${project.groupId}</projectGroupId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/pom.xml 2011-08-26 15:29:32 UTC (rev 276)
@@ -258,6 +258,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
Modified: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java 2011-08-26 15:29:32 UTC (rev 276)
@@ -33,6 +33,7 @@
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
+import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -216,6 +217,13 @@
private RepositorySystemSession repoSession;
/**
+ * The directory where Maven may found the sources.
+ *
+ * @parameter default-value="${project.basedir}/src/main/java"
+ */
+ private File javaSourceRoot;
+
+ /**
* The project's remote repositories to use for the resolution of plugins and their dependencies.
*
* @parameter default-value="${project.remoteProjectRepositories}"
@@ -636,11 +644,15 @@
}
/** Replace the current source directory by the given directory.
+ * <p>
+ * CAUTION: this function override the source directory for all
+ * the Maven plugins. Invoking this function may cause failures
+ * in other maven plugins.
*
* @param newSourceDirectory
*/
protected void setSourceDirectoryForAllMojo(File newSourceDirectory) {
- /*List<String> sourceRoots = this.mavenProject.getCompileSourceRoots();
+ List<String> sourceRoots = this.mavenProject.getCompileSourceRoots();
getLog().debug("Old source roots: "+sourceRoots.toString()); //$NON-NLS-1$
Iterator<String> iterator = sourceRoots.iterator();
String removableSourcePath = this.javaSourceRoot.getAbsolutePath();
@@ -655,8 +667,7 @@
}
getLog().debug("Adding source root: "+newSourceDirectory.getAbsolutePath()); //$NON-NLS-1$
this.mavenProject.addCompileSourceRoot(newSourceDirectory.toString());
- this.sourceDirectory = newSourceDirectory;*/
- getLog().warn("Change of the source roots is not yet supported"); //$NON-NLS-1$
+ this.sourceDirectory = newSourceDirectory;
}
/**
Added: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateReplaceSourceMojo.java
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateReplaceSourceMojo.java (rev 0)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateReplaceSourceMojo.java 2011-08-26 15:29:32 UTC (rev 276)
@@ -0,0 +1,53 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2011 Stephane 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.plugins.tagreplacer;
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+
+/**
+ * Generate the Java source files and replace the macros by the corresponding values
+ * on the fly.
+ * Supported macros are described in {@link AbstractReplaceMojo}.
+ * <p>
+ * CAUTION: This Mojo override the value of the source directory.
+ *
+ * @author $Author: galland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ *
+ * @goal generatereplacesrc
+ * @phase pre-integration-test
+ * @requireProject true
+ * @threadSafe
+ */
+public class GenerateReplaceSourceMojo extends GenerateSourceMojo {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected synchronized void executeMojo(File targetDir) throws MojoExecutionException {
+ super.executeMojo(targetDir);
+ setSourceDirectoryForAllMojo(targetDir);
+ }
+
+}
Modified: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateSourceMojo.java
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateSourceMojo.java 2011-08-24 22:03:27 UTC (rev 275)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateSourceMojo.java 2011-08-26 15:29:32 UTC (rev 276)
@@ -61,7 +61,25 @@
* {@inheritDoc}
*/
@Override
- protected synchronized void executeMojo() throws MojoExecutionException {
+ protected final synchronized void executeMojo() throws MojoExecutionException {
+ File targetDir = null;
+ if (this.outputLocation==null) {
+ targetDir = new File(getGeneratedSourceDirectory(), "java"); //$NON-NLS-1$
+ }
+ else {
+ targetDir = this.outputLocation;
+ }
+
+ executeMojo(targetDir);
+ }
+
+ /**
+ * Execute the replacement mojo inside the given target directory.
+ *
+ * @param targetDir
+ * @throws MojoExecutionException
+ */
+ protected synchronized void executeMojo(File targetDir) throws MojoExecutionException {
File[] sourceDirs;
File mainDirectory = new File(getSourceDirectory(), "main"); //$NON-NLS-1$
if (this.sources==null || this.sources.length==0) {
@@ -72,15 +90,7 @@
else {
sourceDirs = this.sources;
}
-
- File targetDir = null;
- if (this.outputLocation==null) {
- targetDir = new File(getGeneratedSourceDirectory(), "java"); //$NON-NLS-1$
- }
- else {
- targetDir = this.outputLocation;
- }
-
+
clearInternalBuffers();
Map<File,File> htmlBasedFiles = new TreeMap<File,File>();
@@ -101,8 +111,6 @@
sourceDirs,
false);
}
-
- setSourceDirectoryForAllMojo(targetDir);
}
}